maven私服上传jar包

将一下脚本保存在.bat文件执行,红色部分按实际情况修改:

@echo off

set groupId=com.xxx
set artifactId=xxx
set version=0.0.1
set jarFilePath=D:/file/%artifactId%-%version%.jar

set nexusUrl=http://xxx.xxx.xxx.xxx:8081/nexus/content/repositories/snapshots
set repositoryId=snapshots

echo groupId = %groupId%
echo artifactId = %artifactId%
echo version = %version%
echo jarFilePath = %jarFilePath%
echo nexusUrl = %nexusUrl%

echo ===== mvn 命令开始发布 start =====
pause

rem 在BAT文件里面执行Maven的mvn命令后,mvn之后的命令不会被执行,
rem 这是由于mvn本身也是BAT文件,并且其结束时执行了exit命令
rem 要让mvn命令不使当前脚本自动退出,只需要在mvn之前加上call命令:

call mvn deploy:deploy-file -DgroupId=%groupId% -DartifactId=%artifactId% -Dversion=%version% -Dpackaging=jar -Dfile=%jarFilePath% -Durl=%nexusUrl% -DrepositoryId=%repositoryId%

echo ===== mvn 命令结束 end=====
pause

https://files.cnblogs.com/files/liujf-a-mad-man/mvn_deploy.rar

原文地址:https://www.cnblogs.com/liujf-a-mad-man/p/10784253.html