使用mvn deploy命令将本地jar包上传到maven私服

记录一下,之后少走弯路服务器

前提:已经搭建好nexus maven私服,地址192.168.110.240:9091maven

在maven的setting.xml中找到<mirrors></mirrors>标签,在中间加上:url

<mirror>
<id>nexus</id>
<mirrorOf>central</mirrorOf>
<url>http://192.168.110.240:9091/repository/maven-public/</url>
</mirror>

找到<servers></servers>标签,在中间加上:spa

<server>
      <id>nexus</id>
      <username>admin</username>
      <password>admin123</password>
    </server>

这里的<id>标签对应了<mirror>标签的<id>,用户名密码就是maven私服的登陆帐户密码code

使用命令mvn deploy部署jar包:server

例如:xml

mvn deploy:deploy-file -Dfile=G:\hive_service.jar -DgroupId=com.cloudera.hive -DartifactId=hive-service -Dversion=v4-cdh-5.13.1 -Dpackaging=jar -Durl=http://192.168.110.240:9091/repository/maven-releases/ -DrepositoryId=nexus

一一解释命令参数blog

-Dfile    jar包文件路径部署

-DgroupId   groupIdit

-DartifactId    artifactId

-Dversion   version

-Dpackaging    jar

-Durl     仓库地址:

 

服务器上有几个主要库,release,snapshots ,3rdParty,分表表明:发行版,快照版,第三方,发布到哪一个库可自行根据须要选择,点击列表右边的copy按钮可看到对应库的发布地址,将该地址拷贝到-Durl参数中便可

如:

最后一个参数:

-DrepositoryId       配置的私服ID,即刚刚在setting.xml中的<mirror>下的<id>标签中配置的内容

相关文章
相关标签/搜索