將一下腳本保存在.bat文件執行,紅色部分按實際狀況修改:url
@echo offspa
set groupId=com.xxx
set artifactId=xxx
set version=0.0.1
set jarFilePath=D:/file/%artifactId%-%version%.jarblog
set nexusUrl=http://xxx.xxx.xxx.xxx:8081/nexus/content/repositories/snapshots
set repositoryId=snapshotsrem
echo groupId = %groupId%
echo artifactId = %artifactId%
echo version = %version%
echo jarFilePath = %jarFilePath%
echo nexusUrl = %nexusUrl%get
echo ===== mvn 命令開始發佈 start =====
pauseit
rem 在BAT文件裏面執行Maven的mvn命令後,mvn以後的命令不會被執行,
rem 這是因爲mvn自己也是BAT文件,而且其結束時執行了exit命令
rem 要讓mvn命令不使當前腳本自動退出,只須要在mvn以前加上call命令:io
call mvn deploy:deploy-file -DgroupId=%groupId% -DartifactId=%artifactId% -Dversion=%version% -Dpackaging=jar -Dfile=%jarFilePath% -Durl=%nexusUrl% -DrepositoryId=%repositoryId%file
echo ===== mvn 命令結束 end=====
pausecall
https://files.cnblogs.com/files/liujf-a-mad-man/mvn_deploy.rar腳本