这是一个很好的答案乔。谢谢。我一直在寻找它。
我只是举了一个例子,其中我和Nathan有同样的问题。
我使用Maven企业存储库(Nexus或Artifactory),我位于代理之后,这意味着我不能从我的任何其他存储库直接下载(并且不想)。
Jasper的报告net.sf.jasperreports:jasperreports:6.2.0在它的pom中定义了一些存储库。
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.2.0</version>
...
<repositories>
<repository>
<id>jasperreports</id>
<url>http://jasperreports.sourceforge.net/maven2</url>
</repository>
<repository>
<id>jaspersoft-third-party</id>
<url>http://jaspersoft.artifactoryonline.com/jaspersoft/third-party-ce-artifacts/</url>
</repository>
</repositories>
这会导致以下情况例外:
C:\my-project>mvn verify
[INFO] Scanning for projects...
[INFO] Building my-project 1.0.0-SNAPSHOT
[INFO]
Downloading: http://mynexus/nexus/content/groups/ch-public/com/lowagie/itext/2.1.7.js4/itext-2.1.7.js4.pom
Downloading: http://jasperreports.sourceforge.net/maven2/com/lowagie/itext/2.1.7.js4/itext-2.1.7.js4.pom
Downloading: http://jaspersoft.artifactoryonline.com/jaspersoft/third-party-ce-artifacts/com/lowagie/itext/2.1.7.js4/itext-2.1.7.js4.pom
[INFO] BUILD FAILURE
[INFO] Could not resolve dependencies for project ... :
Failed to collect dependencies at net.sf.jasperreports:jasperreports:jar:6.2.0 ->
com.lowagie:itext:jar:2.1.7.js4: Failed to read artifact descriptor for com.lowagie:itext:jar:2.1.7.js4:
Could not transfer artifact com.lowagie:itext:pom:2.1.7.js4
from/to jasperreports (http://jasperreports.sourceforge.net/maven2):
Connect to jasperreports.sourceforge.net:80 [jasperreports.sourceforge.net/216.34.181.96]
failed: Connection timed out:
如由Joe描述的解决方案是: 在全球的settings.xml(C:/maven-installation/conf/settings.xml)或私人settings.xml中(〜/ .m2目录/ settings.xml中),添加以下文件:
<profiles>
<profile>
<id>ignore-repositories</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<repositories>
<repository>
<id>jasperreports</id>
<url>http://mynexus/nexus/content/groups/ch-public/
</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>jaspersoft-third-party</id>
<url>http://mynexus/nexus/content/groups/ch-public/
</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
重要:在配置文件的存储库id(碧玉报告,jaspersoft第三方)完全匹配在pom.xml中使用的存储库的ID - 在这种情况下,net.sf.jasperreports的pom.xml:jasperreports:6.2.0
不要忘记添加将“外部”存储库添加到Maven Enterprise Repository的“代理”列表中
感谢您的解决方法和链接! –