maven - 一键删除maven仓库无效jar包工具

背景

在进行maven开发时,往往需要下载大量jar包,而由于网络不稳定等其他因素可能导致jar未下载完毕,然后保留了lastUpdated文件,导致无法更新失效的jar包。
现在提供个bat脚本,只需要输入maven本地仓库地址就可以将失效的lastUpdated信息删除,maven就能够重新下载失效的jar。

工具封装

  1. 只需要将仓库文件夹拖入bat窗口或者将仓库文件夹路径填入bat中,就可以清除失效的lastUpdated信息。
  2. 工具已上传github : 点我进入
@echo off
echo @describe Find out all lastUpdated, and delete its.
echo @github https://github.com/cjunn/script_tool/
echo @author cjunn
echo @date Mon Jan 13 2020 13:13:56 GMT+0800
:again
set /p REPOSITORY_PATH=Please enter the local Maven warehouse Path:
:: Remove all double quotes
set REPOSITORY_PATH=%REPOSITORY_PATH:"=%
if not exist "%REPOSITORY_PATH%" (
   echo Maven warehouse address not found, please try again.
   goto again
)
for /f "delims=" %%i in ('dir /b /s "%REPOSITORY_PATH%\*lastUpdated*"') do (
    del /s /q "%%i"
)
echo Expired files deleted successfully.
pause;

猜你喜欢

转载自www.cnblogs.com/cjunn/p/12191405.html
今日推荐