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的解析规则也就不同了。

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

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
删除maven仓库中以.lastupdated结尾文件可以通过以下步骤实现: 第一步,定位到maven仓库的目录。根据不同的操作系统,maven仓库一般位于用户目录下的.m2文件夹中。可以通过运行命令`echo %USERPROFILE%`(在Windows系统中)或`echo $HOME`(在Linux或Mac系统中)来获取用户目录。 第二步,进入.m2文件夹,找到repository文件夹。这个文件夹就是maven仓库的存储位置。 第三步,使用命令行工具(如Windows下的命令提示符或Linux/Mac下的终端)进入repository文件夹。 第四步,运行以下命令来删除以.lastupdated结尾文件: `find . -type f -name "*.lastupdated" -exec rm -rf {} +` 以上命令将递归查找repository文件夹中以.lastupdated结尾的所有文件,并使用rm命令将其删除。 删除maven仓库下的所有_remote.repositor文件可以通过以下步骤实现: 第一步,同样需要找到maven仓库的目录,即上述提到的.m2文件夹。 第二步,进入.m2文件夹,找到repository文件夹。 第三步,在repository文件夹中,删除所有名字以_remote.repositor结尾文件。可以通过运行以下命令实现: `find . -type f -name "*_remote.repositor" -exec rm -rf {} +` 以上命令将递归查找repository文件夹中所有名字以_remote.repositor结尾文件,并使用rm命令将其删除。 这样,我们就可以通过以上步骤来删除maven仓库中所有以.lastupdated结尾文件和所有_remote.repositor文件
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值