更换maven库的私服地址之后出现无法下载jar包问题
今天公司领导说maven项目的私服地址从北京搬到了广东,然后让吧项目所有的setting文件中的私服地址全部修改了。我更换了私服地址,重新upload我的项目的时候出现所有jar包都不能下载的情况。
感觉前两条信息报错尤为重要
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-war-plugin:2.0.2 or one of its dependencies could not be resolved: Failure to transfer org.apache.maven.plugins:maven-war-plugin:jar:2.0.2 from *~~私服地址~~ * was cached in the local repository, resolution will not be reattempted until the update interval of archiva.default has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-war-plugin:jar:2.0.2 from/to archiva.default (*~~私服地址~~ *): Failed to transfer*~~私服地址~~ */org/apache/maven/plugins/maven-war-plugin/2.0.2/maven-war-plugin-2.0.2.jar. Error code 500, Unable to fetch artifact resource. Plugin org.apache.maven.plugins:maven-war-plugin:2.0.2 or one of its dependencies could not be resolved: Failure to transfer org.apache.maven.plugins:maven-war-plugin:jar:2.0.2 from *~~私服地址~~ *l was cached in the local repository, resolution will not be reattempted until the update interval of archiva.default has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-war-plugin:jar:2.0.2 from/to archiva.default *~~私服地址~~ *): Failed to transfer *~~私服地址~~ */org/apache/maven/plugins/maven-war-plugin/2.0.2/maven-war-plugin-2.0.2.jar. Error code 500, Unable to fetch artifact resource.
出现 Error code 500
的错误。但是从网页下载jar,访问私服地址都是可以的我想不通为什么。
可能明天就要找到了解决办法,现在先把问题写上来。
然后这是我们setting配置文件(关键信息我用xxx标识)
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
-->
<localRepository>E:/eclipseWorspace/guanzhoujar</localRepository>
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
<server>
<id>archiva.default</id>
<username>XXXX</username>
<password>****</password>
</server>
<server>
<id>archiva.apache.snapshots</id>
<username>XXXX</username>
<password>****</password>
</server>
<!-- tomcat7配置-->
<server>
<id>tomcat7</id>
<username>admin</username>
<password>admin</password>
</server>
</servers>
<mirrors>
<mirror>
<id>archiva.default</id>
<name>archiva.default</name>
<url>私服地址</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>profile-archiva</id>
<repositories>
<repository>
<id>archiva</id>
<name></name>
<url>私服地址</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>nexus</id>
<name>nexus</name>
<url>http://www.sonatype.org/nexus/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>mvnrepository</id>
<name>mvnrepository</name>
<url>http://mvnrepository.com/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>maven22</id>
<name>maven22</name>
<url>http://repo1.maven.org/maven2/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<pluginRepositories>
<pluginRepository>
<name>repository.sonatype.org</name>
<id>repository.sonatype.org</id>
<url>http://repository.sonatype.org/content/groups/public/</url>
</pluginRepository>
<pluginRepository>
<name>maven2</name>
<id>maven2</id>
<url>http://repo1.maven.org/maven2/</url>
</pluginRepository>
<pluginRepository>
<name>mvnrepository</name>
<id>mvnrepository</id>
<url>http://mvnrepository.com/</url>
</pluginRepository>
<pluginRepository>
<name>repository</name>
<id>repository</id>
<url>http://repository.jboss.com/maven2/</url>
</pluginRepository>
</pluginRepositories>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>profile-archiva</activeProfile>
<activeProfile>profile-artifact</activeProfile>
</activeProfiles>
</settings>
第一次用不太会用这个编辑器 大家凑合着看 明天如果有解决办法我会把解决办法贴上来。
ps:
- 不要问私服地址能不能访问,答案是肯定能。因为我一下午把所有非公共jar包都放上去,并且也能下载到。
- 目录的文件夹都会建好。
后面领导给出了解决方案,运维人员没有将私服的外网权限打开,打开之后,便可以正常使用。