我从外部存储库下载某些依赖项。所以我已经将以下存储库标记添加到我的pom.xml
<repository>
<id>cdatoolsrelease</id>
<name>cdatools.com-releases</name>
<url>http://www.cdatools.com:8081/artifactory/ext-release-local</url>
</repository>
<repository>
<id>cdatoolssnapshot</id>
<name>cdatools.com-snapshot</name>
<url>http://www.cdatools.com:8081/artifactory/libs-snapshot-local</url>
</repository>
一切都运作良好。我也可以看到下载所需的依赖项。但是当我尝试构建这个项目时,我得到以下异常并构建失败\
D:\WORKSPACE\some-project>mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count
of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building some-project 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://www.cdatools.com:8081/artifactory/libs-snapshot-local/com/lowagie/itext/2.1.7.js2/itext-2.1.7.js2.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.122 s
[INFO] Finished at: 2014-07-17T11:53:53+05:45
[INFO] Final Memory: 10M/246M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project some-project: Could not resolve dependencies for project ProjectName:some-project:war:0.0.1-SNAPSHOT: Failed to collect dependencies at net.sf.jasperrepor
ts:jasperreports:jar:5.1.2 -> com.lowagie:itext:jar:2.1.7.js2: Failed to read artifact descriptor for com.lowagie:itext:jar:2.
1.7.js2: Could not transfer artifact com.lowagie:itext:pom:2.1.7.js2 from/to cdatoolssnapshot (http://www.cdatools.com:8081/ar
tifactory/libs-snapshot-local): Failed to transfer file: http://www.cdatools.com:8081/artifactory/libs-snapshot-local/com/lowa
gie/itext/2.1.7.js2/itext-2.1.7.js2.pom. Return code is: 409 , ReasonPhrase:The repository 'libs-snapshot-local' rejected the
artifact 'libs-snapshot-local:com/lowagie/itext/2.1.7.js2/itext-2.1.7.js2.pom' due to its snapshot/release handling policy.. -
> [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
我的pom文件中没有itext依赖,但我确实有jasper依赖。
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>5.1.2</version>
</dependency>
Maven正在尝试在cdatools repo中搜索itext依赖项,但万一它没有得到maven构建失败。我怎样才能让它发挥作用。当我删除回购时,一切都运行良好,就像我之前添加新的回购标记
答案 0 :(得分:11)
我解决了这个问题,在pom.xml中添加了2个存储库:
<repository>
<id>jasper</id>
<url>http://jasperreports.sourceforge.net/maven2/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>jasper1</id>
<url>http://jaspersoft.artifactoryonline.com/jaspersoft/jaspersoft-repo/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>