Maven setting.xml的仓库配置

一、setting.xml中私服仓库下载配置

<mirror>
      <id>mirrorNexusId</id>
      <mirrorOf>*</mirrorOf>
      <name>mirror nexus</name>
      <url>http://localhost:8081/nexus/content/groups/public/</url>
    </mirror>

<!-- 根据开发环境和生产环境选择性激活 -->
<profile>
    <id>nexusProfile-prod</id>
    <repositories>
        <repository>
            <id>nexus-prod</id>
            <name>nexus prod repository</name>
            <url>http://localhost:8081/nexus/content/groups/public/</url>
            <releases><enabled>true</enabled></releases>
            <!-- snapshtos默认关闭请记住打开-->
            <snapshots><enabled>true</enabled></snapshots>
        </repository>
    </repositories>
</profile>
<profile>
    <id>nexusProfile-dev</id>
    <repositories>
        <repository>
            <id>nexus-dev</id>
            <name>nexus prod repository</name>
            <url>http://192.168.3.30/nexus/content/groups/public/</url>
            <releases><enabled>true</enabled></releases>
            <!-- snapshtos默认关闭请记住打开-->
            <snapshots><enabled>true</enabled></snapshots>
        </repository>
    </repositories>
</profile>
  <activeProfiles>
    <activeProfile>nexusProfile-dev</activeProfile>
  </activeProfiles>

上报(父类)

<distributionManagement>
        <repository>
            <id>nexus-releases</id>
            <name>nexus releases respository</name>
            <url>http://localhost:8081/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>nexus-snapshots</id>
            <name>nexus snapshots respository</name>
            <url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

error code:400
setting.xml


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

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

    

error code:401
nexus allow redeploy

疑问: 怎么批量更改pom.xml的version

<packaging>jar</packaging>作用

Source Plugin
父工程 写入定义进行管理

 <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.0.1</version>
                    <!-- 绑定生命周期  clean test package install deploy complie-->
                    <executions>
                        <execution>
                            <phase>complie</phase>
                            <goals><goal>jar</goal><goal>test-jar</goal></goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

子工程引入


  <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
          </plugin>
    </plugins>
  </build>

测试 run clean complie

    原文作者:空山Echo
    原文地址: https://www.jianshu.com/p/4060c30f31f8
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞