zoukankan      html  css  js  c++  java
  • maven从nexus下载构件以及maven部署构件到nexus的配置

    1、maven从nexus下载构件的配置

    1.1、在项目pom中配置远程仓库(方式一)

    <repositories>
        <repository>
            <id>remote</id>
            <name>my nexus repository</name>
            <url>http://192.1.1.103:8081/nexus/content/groups
                     /public/</url>
        </repository>
    </repositories>
    <pluginRepositories>
            <pluginRepository>
                <id>nexus</id>
                <name>Nexus</name>            
                <url>http://192.1.1.103:8081/nexus/content/groups
                        /public/</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </pluginRepository>
    </pluginRepositories>

    1.2、或者在setting.xml中以镜像形式配置远程仓库(方式二)

    这样就不需要每个项目都配置一次

    <mirrors>
      <mirror>
           <id>remote</id>
           <name>remote</name>          
           <url>http://192.1.1.103:8081/nexus/content/
                   repositories/central/</url>
           <mirrorOf>*</mirrorOf>        
      </mirror>
    </mirrors>

    <mirrorOf>*</mirrorOf> 这句话意思是所有构件都会从私服中下载

    1.3、或者在setting中配置<profile>标签(方式三)

    <profiles>
        <profile>
            <id>dev</id>
            <repositories>
                <repository>
                    <id>nexus</id>
                    <name>Nexus</name>               
                    <url>http://192.1.1.103:8081/nexus/content/groups
                             /public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>public</id>
                    <name>Nexus</name>             
                    <url>http://192.1.1.103:8081/nexus/content/groups
                            /public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                 </pluginRepository>
            </pluginRepositories>
        </profile>
       </profiles>
       <!-- 激活私服 -->
    <activeProfiles> <activeProfile>dev</activeProfile> </activeProfiles>

     2、maven部署构件到nexus的配置

    2.1、项目pom中配置

        <distributionManagement>
            <repository>
                <id>releases</id>
                <name>nexus release</name>          
                    <url>http://192.1.1.103:8081/nexus/content/
                             repositories/releases/</url>
            </repository>
            <snapshotRepository>
                <id>snapshots</id>
                <name>nexus snapshot</name>          
                    <url>http://192.1.1.103:8081/nexus/content/
                             repositories/snapshots/</url>
            </snapshotRepository>
        </distributionManagement>

    2.2、setting.xml中配置

      <servers>
        <server>
                 <id>releases</id>
                 <username>deployment</username>
                 <password>deployment123</password>
         </server>
         <server>
                 <id>snapshots</id>
                 <username>deployment</username>
                 <password>deployment123</password>
         </server>
        
      </servers>

    2.3、maven命令

    mvn deploy

    本文作者:hjjay
    原文出处:https://www.cnblogs.com/jayhou/p/12271566.html
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接。

  • 相关阅读:
    ZUCC2129 The Tree of Power(树形DP)
    ZUCC Flower Name(01字典树)
    JDBC 测试01
    CF1355E Restorer Distance(三分)
    CF1352E Special Permutation(桶排序+前缀和)
    CF1350E Orac and Game of Life(BFS)
    CF1350D Orac and Medians(找规律)
    Python机器学习(五十七)SciPy 积分
    Python机器学习(五十六)SciPy fftpack(傅里叶变换)
    Python机器学习(五十五)SciPy 常量
  • 原文地址:https://www.cnblogs.com/jayhou/p/12271566.html
Copyright © 2011-2022 走看看