我向我的项目添加了 Maven 依赖项,并且我的项目在本地编译,但不在服务器上编译。它无法解析新添加的依赖项。
这是我的 pom.xml 文件:
<repositories>
<repository>
<id>rep</id>
<name>Repository</name>
<url>http://artifacts.com/rep</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.project.rest</groupId>
<artifactId>common</artifactId>
<version>2.0.5</version>
</dependency>
</dependencies>
这是我的控制台输出,有错误:
Downloading: http://artifacts.com/rep/com/project/rest/common/2.0.5/common-2.0.5.pom
[WARNING] The POM for com.project.rest:common:jar:2.0.5 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.154s
[INFO] Finished at: Tue Feb 03 06:58:35 BRT 2015
[INFO] Final Memory: 9M/152M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project server: Could not resolve dependencies for project org.server:
server:jar:2.5.1-SNAPSHOT: The following artifacts could not be resolved: com.project.rest:common:jar:2.0.5:
Could not find artifact com.project.rest:common:jar:2.0.5 in rep (http://artifacts.com/rep) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
(我隐藏了所有真实的 URL 和包。)
可能是什么问题呢?
第一行“Downloading:...”仅表示 maven 尝试下载工件。它没有关于成功的声明。如果 Maven 成功,您将得到另一行以“已下载:...”开头的行
所以在你的情况下,maven 无法下载该文件。检查浏览器中记录的 URL 是否存在以及是否受保护。
BTW <updatePolicy>always</updatePolicy>
对于发行版存储库来说这是相当罕见的,因为发行版不应该再改变。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)