Why does maven build fails on dowloading itext from incorrect repo?

﹥>﹥吖頭↗ 提交于 2020-01-24 09:10:46

问题


I am downloading certain dependency from external repository. So I have added following repository tag to my 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> 

Everything works well. I can see my required dependencies downloaded as well. But when I try to build this project i get following exception and build fails\

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

I don't have itext dependency in my pom file but I do have jasper dependency.

<dependency>
    <groupId>net.sf.jasperreports</groupId>
    <artifactId>jasperreports</artifactId>
    <version>5.1.2</version>
</dependency>

Maven is trying to search itext dependency in cdatools repo but in case it does not get it maven build fails. How can i make it work. When I remove the repo everything works well as it was originally before I added new repo tag


回答1:


I resolved this problem adding 2 repositories in pom.xml:

<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> 


来源:https://stackoverflow.com/questions/24796190/why-does-maven-build-fails-on-dowloading-itext-from-incorrect-repo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!