How to disable nexus-staging-maven-plugin in sub-modules

后端 未结 3 1139
无人共我
无人共我 2021-01-11 19:19

I\'m looking into replacing the maven-deploy-plugin with the nexus-staging-maven-plugin.

Now some of the sub-modules of my project (e.g. integration test modules) ar

相关标签:
3条回答
  • 2021-01-11 19:57

    You can set the configuration property skipNexusStagingDeployMojo of a given submodule to true. See more configuration properties documented in the Nexus book chapter about deployment to staging.

    0 讨论(0)
  • 2021-01-11 20:12

    Faced similar problem. Solution that worked for me was adding deployment plugin with skip as true in modules that need to be excluded from deploy task.

               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-deploy-plugin</artifactId>
                  <configuration>
                    <skip>true</skip>
                  </configuration>
                </plugin>
    
    0 讨论(0)
  • 2021-01-11 20:22

    The easiest way I found to deal the limitations of nexus-staging-maven-plugin is to isolate any module you do not want to deploy into a separate Maven profile, and exclude it when a deploy occurs. Example:

    <profile>
        <id>no-deploy</id>
        <!--
        According to https://github.com/sonatype/nexus-maven-plugins/tree/master/staging/maven-plugin
        skipNexusStagingDeployMojo may not be set to true in the last reactor module. Because we don't
        want to deploy our last module, nor a dummy module, we simply omit the relevant modules when
        a deploy is in progress.
        -->
        <activation>
            <property>
                <name>!deploy</name>
            </property>
        </activation>
        <modules>
            <module>test</module>
            <module>benchmark</module>
        </modules>
    </profile>
    

    In the above example, I avoid building and deploying the "test" and "benchmark" modules. If you want to run unit tests without deploying them, use separate runs:

    mvn test
    mvn -Ddeploy deploy
    
    0 讨论(0)
提交回复
热议问题