如何在子模块中禁用nexus-staging-maven-plugin [英] How to disable nexus-staging-maven-plugin in sub-modules

查看:561
本文介绍了如何在子模块中禁用nexus-staging-maven-plugin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑将nevus-deploy-plugin替换为nexus-staging-maven-plugin.

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

现在,我的项目中的某些子模块(例如集成测试模块)将不会部署到Nexus服务器.我曾经通过"maven.deploy.skip"属性来禁用这些模块的部署.但是,我找不到与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).

推荐答案

我发现解决nexus-staging-maven-plugin限制的最简单方法是将不需要部署的任何模块隔离到单独的Maven配置文件中,并在发生部署时将其排除.示例:

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

这篇关于如何在子模块中禁用nexus-staging-maven-plugin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆