Skip to content

Instantly share code, notes, and snippets.

@yangsaipp
Last active June 16, 2023 00:58
Show Gist options
  • Save yangsaipp/50332e68e81f2dace83f16379d048602 to your computer and use it in GitHub Desktop.
Save yangsaipp/50332e68e81f2dace83f16379d048602 to your computer and use it in GitHub Desktop.
批量上传jar到nexus仓库
@echo off
:: init params
set version=5.1.208.1
set groupId=com.xxxx.xxxx.xxx.xxx
set artifactIdPrefix=portal
set url=http://xxx.xxxx.xxxxx:8081/nexus/content/repositories/releases/
set repositoryId=xxxxx
set deployFile=*.jar
echo Searching jar file...
rem 启用"延缓环境变量扩充"
set index=1
SETLOCAL ENABLEDELAYEDEXPANSION
for %%f in (%deployFile%) do (
echo ================ !index! ======================
set name=%%f
set prefixName=!name:.jar=!
echo !name! to deploy to %url%
echo group:%groupId%
echo artifact:!prefixName!
echo version=%version%
rem 第一次暂停10秒用于检查
if !index! == 1 ping -n 10 127.1>nul
set /a index = !index!+1
rem deploy to server
call mvn deploy:deploy-file -DgroupId=%groupId% -DartifactId=!prefixName! -Dversion=%version% -Dpackaging=jar -Dfile=!name! -Durl=%url% -DrepositoryId=%repositoryId%
)
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment