背景
在進行maven開發時,往往需要下載大量jar包,而由於網絡不穩定等其他因素可能導致jar未下載完畢,然后保留了lastUpdated文件,導致無法更新失效的jar包。
現在提供個bat腳本,只需要輸入maven本地倉庫地址就可以將失效的lastUpdated信息刪除,maven就能夠重新下載失效的jar。
工具封裝
- 只需要將倉庫文件夾拖入bat窗口或者將倉庫文件夾路徑填入bat中,就可以清除失效的lastUpdated信息。
- 工具已上傳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;