我正面临通过maven安装下载依赖项jar的问题。
从eclipse控制台,我可以说maven正试图从旧的中央存储库url下载jar:" https://repo.maven.apache.org/maven2"而不是" http://repo1.maven.org/maven2/"
我的pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xxxx</groupId>
<artifactId>TestServices</artifactId>
<version>7.0.3.6</version>
<dependencies>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.0.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
我的构建失败,出现以下错误消息:
[ERROR] Failed to execute goal on project 'xxxyyy': Could not resolve dependencies for project xxxyyy:jar:4.0.3.6: The following artifacts could not be resolved: org.codehaus:xstream:jar:1.3.1, gxs:ai:jar:0.5, javax.activation:activation:jar:1.0.2, com.oracle.jdbc:classes12:jar:9.2.0.5, org.eclipse.core:resources:jar:3.1.0, org.eclipse.core:runtime:jar:3.2.0.v20060603, org.eclipse.emf:common:jar:2.2.1.v200609210005, org.eclipse.emf:ecore:jar:2.2.1.v200609210005, org.eclipse.emf:ecore.xmi:jar:2.2.1.v200609210005, org.eclipse.equinox:common:jar:3.2.0.v20060603, org.eclipse:osgi:jar:3.2.1.R32x_v20060919, org.eclipse.wst.xml:core:jar:1.1.1.v200609210600, org.eclipse:xsd:jar:2.2.1.v200609210005, javax.mail:mail:jar:1.3.2, org.apache:log4j:jar:1.2.8: Failure to find org.codehaus:xstream:jar:1.3.1 in ${localRepo} was cached in the local repository, resolution will not be reattempted until the update interval of 'abcd' has elapsed or updates are forced -> [Help 1]
答案 0 :(得分:1)
尝试添加此
<repositories>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2/</url>
</repository>
</repositories>
的此文档
并遵循文档:
存储库
存储库是Maven最强大的功能之一 社区。默认的中央Maven存储库依然存在 https://repo.maven.apache.org/maven2/。工件的另一个来源 还没有在iBiblio中是Codehaus快照回购。
Maven存储库默认Doc
答案 1 :(得分:0)
更改存储库地址后:
<repositories>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2/</url>
</repository>
您必须手动清理存储库中的每个以前缓存的数据,或者通过使用-U选项package -U
-U表示强制更新所有依赖项。