很高兴通过cmd禁用buildnumber-maven-plugin

use*_*877 5 plugins build maven buildnumber-maven-plugin

我对maven有疑问.如何通过命令行选项禁用buildnumber-maven-plugin.我想在我们的持续集成服务器上运行"mvn test"命令,但是这个cmd失败了,因为它试图构建一个版本并且没有访问我们的vcs(在tag中配置)的权限.因此可以通过cmd选项禁用它,或者只运行测试而不构建新的发行版本?谢谢你的帮助.

Mar*_*nor 8

使用配置文件控制在构建期间启用哪些插件:

<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.me.test</groupId>
    <artifactId>demo</artifactId>
    <version>1.0</version>
    ..
    ..
    <profiles>
        <profile>
            <id>with-scm</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>buildnumber-maven-plugin</artifactId>
                        <version>1.0</version>
                        <executions>
                            <execution>
                                <phase>validate</phase>
                                <goals>
                                    <goal>create</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <doCheck>true</doCheck>
                            <doUpdate>true</doUpdate>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
Run Code Online (Sandbox Code Playgroud)

可以通过运行Maven来启用配置文件,如下所示:

mvn -Pwith-scm package
Run Code Online (Sandbox Code Playgroud)