maven下载jar包出现.lastupdated结尾的文件问题及解决

近期接收公司的一个新项目,需要从公司maven私服下载依赖的jar包,setting.xml文件从同事那里要过来之后,克隆项目,编译项目,但总是有部分依赖无法成功下载。

提示报错信息:

com.abc.xxx::pom:3.1.7 failed to transfer from http://0.0.0.0/ during a previous attempt. 
This failure was cached in the local repository and resolution is not reattempted until the update interval of maven-default-http-blocker has elapsed or updates are forced. 
Original error: Could not transfer artifact com.abc:xxx:pom:3.1.7 from/to maven-default-http-blocker (http://0.0.0.0/): 
Blocked mirror for repositories: [alimaven (http://maven.aliyun.com/nexus/content/groups/public/, default, releases+snapshots), public-repository (http://nexus.xxx.com/nexus/content/groups/public/, default, releases+snapshots), central-repository (http://nexus.czb365.com/nexus/content/repositories/central/, default, releases+snapshots), snapshot-repository (http://nexus.xxx.com/nexus/content/repositories/snapshots/, default, releases+snapshots), release-repository (http://nexus.xxx.com/nexus/content/repositories/releases/, default, releases+snapshots), thirdparty-repository (http://nexus.xxx.com/nexus/content/repositories/thirdparty/, default, releases+snapshots)]

无论怎么清理缓存,重新加载都无法成功下载,尝试访问maven私服也可以正常访问,真的不知道该从何处着手解决问题了。于是果断跟身边的技术小伙伴反馈问题,寻求帮助。

小伙伴,看后也是一脸懵逼,但很快他就从Maven版本的角度思考问题,把3.6.1的maven包发我,让我降低下maven版本再试试。果真,问题解决了。

后分析发现,Maven不同版本的头文件是不一样的

maven版本:3.6.1

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

maven版本:3.9.8
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">

自然Maven的解析规则也就不同了。

通过这个日常工作中遇到的小问题,加深了对软件中间件大版本迭代兼容性问题的重视程度,规则并不是一成不变的,一定要在特定的版本下,遵从特定的版本规则。

猜你喜欢

转载自blog.csdn.net/caryeko/article/details/142084338