maven本地仓库存在为什么还要连接外网下载?

上邪
  • 106

我们配置有私服的maven中央仓库,但是前几天停电服务器有问题了,现在私服的中央仓库连接不上,可是我在一个项目中需要下载jar包的时候,已经连接外网把jar下载下来了,然后我就又把地址改成私服的不能连接的中央仓库了(工程需要,我也不知道怎么回事),可是在又执行的时候,本地工程还要连接中央仓库进行下载,是不是从不同仓库下载下来的jar不能共用呢?

[INFO] Downloading: http://10.12.12.108:8081/nexus/content/groups/public/org/mybatis/generator/mybatis-generator-maven-plugin/1.3.2/mybatis-generator-maven-plugin-1.3.2.pom
[WARNING] Failed to retrieve plugin descriptor for org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2: Plugin org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.mybatis.generator:mybatis-generator-maven-plugin:jar:1.3.2
[INFO] Downloading: http://10.12.12.108:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-deploy-plugin:2.7: Plugin org.apache.maven.plugins:maven-deploy-plugin:2.7 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-deploy-plugin:jar:2.7
[INFO] Downloading: http://10.12.12.108:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-site-plugin/3.3/maven-site-plugin-3.3.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-site-plugin:3.3: Plugin org.apache.maven.plugins:maven-site-plugin:3.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-site-plugin:jar:3.3
[INFO] Downloading: http://10.12.12.108:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-antrun-plugin/1.3/maven-antrun-plugin-1.3.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-antrun-plugin:1.3: Plugin org.apache.maven.plugins:maven-antrun-plugin:1.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-antrun-plugin:jar:1.3
[INFO] Downloading: http://10.12.12.108:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-assembly-plugin/2.2-beta-5/maven-assembly-plugin-2.2-beta-5.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5: Plugin org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-assembly-plugin:jar:2.2-beta-5
[INFO] Downloading: http://10.12.12.108:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-dependency-plugin/2.8/maven-dependency-plugin-2.8.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-dependency-plugin:2.8: Plugin org.apache.maven.plugins:maven-dependency-plugin:2.8 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-dependency-plugin:jar:2.8
[INFO] Downloading: http://10.12.12.108:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-release-plugin/2.3.2/maven-release-plugin-2.3.2.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-release-plugin:2.3.2: Plugin org.apache.maven.plugins:maven-release-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-release-plugin:jar:2.3.2
[INFO] Downloading: http://10.12.12.108:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-metadata.xml

可是如果这个工程我连接到公网的仓库就可以运行,连接本地私服仓库就不能运行!!

终极问题 : 为什么我本地仓库已经存在这个jar包了,运行的时候,工程还要去中央仓库下载呢?

回复
阅读 14.6k
3 个回答

可能是jar版本 或者 配置的jdk版本不一致 引起的!

Damon_001
  • 1
新手上路,请多包涵

没有日志不好说具体什么原因引起的,提供个思路:
1.可能是本地jar包的版本不对,先删掉本地jar包,并把相应目录下以.lastupdated结尾的文件删掉
2.重新编译:mvn clean install

宣传栏