maven 3.0+在'mvn deploy'上跳过插件执行

时间:2015-09-07 10:45:41

标签: java maven build maven-3

我想在运行命令'mvn deploy'时跳过插件执行。比如下面的例子,我不想在'mvn deploy'中执行'properties-maven-plugin'

<plugins>
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>properties-maven-plugin</artifactId>
        <version>1.0-alpha-2</version>
        <executions>
            <execution>
                <phase>prepare-package</phase>
                <goals>
                    <goal>read-project-properties</goal>
                </goals>
                <configuration>
                    <files>
                        <file>${session.executionRootDirectory}/xxxx.properties</file>
                    </files>
                </configuration>
            </execution>
        </executions>
    </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5.1</version>
        <configuration>
            <tagNameFormat>@{artifactId}/@{artifactId}-@{version}</tagNameFormat>
        </configuration>
    </plugin>
<plugins>

1 个答案:

答案 0 :(得分:1)

您的插件已绑定到prepare-package阶段,因此我认为您在部署时无法避免执行。

但是,可以创建包含该插件的配置文件,这样您就可以在运行插件时激活(命令行,Jenkins配置......)配置文件。

通过这种方式,您可以控制是否运行它,但这不是您问题的答案,因为这样您无法避免在部署时执行插件。

相关问题