如何把自己项目中的jar包部署或pom部署到私服Nexus【实践可行版】

发布时间 2023-11-06 20:03:09作者: 程序员兔哥

如何把自己项目中的jar包部署到私服

1、在项目的pom.xml文件中加入私服地址:

<distributionManagement>
<snapshotRepository>
<id>snapshots</id>
<url>http://www.test.com/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>

 2、修改Maven的配置文件settings.xml

<server>
        <id>snapshots</id>
        <username>admin</username>
        <password>管理员密码</password>
    </server>

加入镜像id:snapshots,注意ID必须要相同

<mirror>
   <id>snapshots</id>
   <name>snapshots nexus repository</name>
   <!-- 118.24.12.213  -->
   <!-- <url>http://192.168.1.100:9081/nexus/content/groups/public/</url> -->
   <url>http://www.test.com/nexus/content/repositories/snapshots/</url>
   <mirrorOf>*</mirrorOf>
 </mirror>

3、Maven deploy插件发布即可,我这使用的是idea开发工具

4、查看私服,jar部署是否成功