美文网首页
maven命令上传到maven仓库

maven命令上传到maven仓库

作者: 大冷月 | 来源:发表于2021-07-05 16:17 被阅读0次

1、安装maven

2、上传命令

# 该命令只能一行
mvn -e -X deploy:deploy-file -Dfile=D:\test\test.jar -DgroupId=com.moon.test -DartifactId=ttt -Dversion=1.0.2 -Dpackaging=jar -Durl=http://localhost:8081/repository/thirdparty/ -DrepositoryId=thirdparty -s D:/test/settings.xml
解释:
mvn deploy:deploy-file 
-Dfile=D:\rate-limit-core-1.1.1.jar 
-DpomFile=.\xxxx.pom
-DgroupId=com.alitrip.ratelimit 
-DartifactId=rate-limit-core 
-Dversion=1.1.1 
-Dpackaging=jar 
-Durl=http://xxxx:xxxx/repository/3rd-party 
-DrepositoryId=thirdparty   //需要与settings.xml里面server的id一样 
-s D:/test/settings.xml  指定setting文件(不指定则读取maven安装目录下的settings.xml)
-DpomFile=D:\rate-limit-core\target\pom.xml   指定pom文件

setting.xml配置

1、不指定则使用maven安装目录下的setting.xml配置username、password

2、指定专用的settings.xml(格式必须和maven下的settings.xml一致)

如:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
        <server>
            <id>thirdparty</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
</servers>
</settings>

相关文章

网友评论

      本文标题:maven命令上传到maven仓库

      本文链接:https://www.haomeiwen.com/subject/juuisqtx.html