gpt4 book ai didi

Maven 找不到依赖项 [dependencyResolutionException]

转载 作者:行者123 更新时间:2023-12-04 20:02:34 29 4
gpt4 key购买 nike

我在我的项目中添加了一个 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 和包。)

可能是什么问题呢?

最佳答案

第一行“正在下载:...”仅表示 maven 尝试下载 Artifact 。这不是关于成功的声明。如果 maven 成功,您将获得另一行以“Downloaded: ...”开头的行

因此,在您的情况下,maven 无法下载该文件。检查浏览器中记录的 url 是否存在并且是否受到保护。

顺便说一句 <updatePolicy>always</updatePolicy>对于发行版存储库来说非常罕见,因为发行版不应再更改。

关于Maven 找不到依赖项 [dependencyResolutionException],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28296181/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com