为什么从不正确的仓库中下载itext时,maven构建会失败? [英] Why does maven build fails on dowloading itext from incorrect repo?

查看:138
本文介绍了为什么从不正确的仓库中下载itext时,maven构建会失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从外部存储库下载某些依赖项.因此,我在pom.xml中添加了以下存储库标记

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

我的pom文件中没有itext依赖项,但确实有jasper依赖项.

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试图在cdatools存储库中搜索itext依赖关系,但万一无法获取,则maven构建会失败.我如何使其工作.当我删除仓库时,一切都恢复原状,就像我添加新仓库标签之前一样

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

推荐答案

我解决了此问题,在pom.xml中添加了2个存储库:

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> 

这篇关于为什么从不正确的仓库中下载itext时,maven构建会失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆