Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

maven

nexus

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) are not to be deployed to the Nexus server. I used to disable the deployment of these modules via the "maven.deploy.skip" property. I cannot find anything comparable for the nexus-staging-maven-plugin, though. Is there another way for skipping single modules from deployment using this plug-in?

I also tried to bind the plug-in to the pseudo phase "none" as described here, but examining the effective POM, there is still the injected execution of the plug-in (I assume that's due to the way how it replaces the existing deploy plug-in).

like image 527
Gunnar Avatar asked Aug 14 '14 10:08

Gunnar


People also ask

What is Nexus staging Maven plugin?

Provides support to access staging functionality in a remote Nexus Professional server.

What is Maven deploy command?

mvn deploy This command is used to deploy the artifact to the remote repository. The remote repository should be configured properly in the project pom. xml file distributionManagement tag. The server entries in the maven settings. xml file is used to provide authentication details.


2 Answers

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
like image 200
Gili Avatar answered Oct 24 '22 00:10

Gili


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.

like image 3
Manfred Moser Avatar answered Oct 23 '22 23:10

Manfred Moser