maven打包发布到nexus

maven打包发布到nexus

  1. 使用服务器安装nexus

    没有服务器可以使用本地安装nexus

    Docker安装Nexus.md

  2. 下载maven并修改setting.xml

    <servers>
        <server>
             <id>releases</id>
             <username>admin</username>
             <password>admin123</password>
        </server>
        <server>
            <id>snapshots</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
    </servers>
    

    其中usernamepassword为nexus的登陆密码及账号

  3. 修改maven项目中的pom.xml

    <!-- pom.xml -->
    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
    </dependency>
    
    <!-- 用于发布到nexus -->
    <distributionManagement>
        <snapshotRepository>
            <id>snapshots</id>
            <name>repo-snapshots</name>
            <url>http://47.95.253.18:8081/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
        <repository>
            <id>releases</id>
            <name>repo-releases</name>
            <url>http://47.95.253.18:8081/nexus/content/repositories/releases/</url>
        </repository>
    </distributionManagement>
    
    

    注意:

    ​ 第2步的servers和第3步的distributionManagement中的id必须一致

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 目前版本已经更新到了3.X下载地址:https://www.sonatype.com/download-oss-s...
    yunqing_71阅读 2,385评论 0 0
  • pom文件常见名词的意义 properties 定义父pom里出现的一些参数变量 dependencyManage...
    我也有键盘阅读 850评论 0 0
  • 搭建环境 平台:阿里云 系统:CentOS 7 应用:Nexus 2.x Nexus 私服的安装 Nexus 下载...
    一世梦魇阅读 4,551评论 0 1
  • 搭建 nexus 私服(centos6.7) 备注:Centos 6.7 、 nexus-2.12.1-01-bu...
    逐暗者阅读 2,526评论 3 9
  • Maven私服搭建- nexus公司内部搭建。测试团队,运维团队,开发团队,所有团队共用。私服本身也是一个公司内的...
    神豪VS勇士赢阅读 468评论 0 0