How to configure maven project to deploy both snapshot and releases to Nexus?

前端 未结 3 653
臣服心动
臣服心动 2020-12-28 14:52

How to configure maven project to deploy both snapshot and releases to Nexus?


    
        Interna         


        
相关标签:
3条回答
  • 2020-12-28 15:18

    You can do both.

    Add the maven-release-plugin 2.5.3

    Run the following:

    mvn deploy clean:release release:prepare release:perform

    0 讨论(0)
  • 2020-12-28 15:27

    Example of pom.xml configuration

    <!-- http://maven.apache.org/pom.html#Distribution_Management -->
    <distributionManagement>
        <snapshotRepository>
            <id>InternalSnapshots</id>
            <name>Internal Snapshots</name>
            <url>http://192.168.16.232:8081/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
        <repository>
            <id>InternalReleases</id>
            <name>Internal Releases</name>
            <url>http://192.168.16.232:8081/nexus/content/repositories/releases/</url>
        </repository>
    </distributionManagement>
    

    Snippets for .m2/settings.xml for default Nexus installation

    <server>   
        <id>thirdparty</id>   
      <username>deployment</username>
      <password>deployment123</password>
    </server>
    <server>
      <id>InternalReleases</id>
      <username>deployment</username>
      <password>deployment123</password>
     </server>  
    <server>
      <id>InternalSnapshots</id>
      <username>deployment</username>
      <password>deployment123</password>
     </server>  
    

    0 讨论(0)
  • 2020-12-28 15:31

    You need to distinguish between the releases and snapshots repository. <distributionManagement> only allows one <repository> and one <snapshotRepository> child.

    http://maven.apache.org/pom.html#Distribution_Management

    0 讨论(0)
提交回复
热议问题