Hot to disable buildnumber-maven-plugin through cmd

前端 未结 4 689
故里飘歌
故里飘歌 2021-01-18 20:02

I have question about maven. How can I disable buildnumber-maven-plugin through command line option. I want to run \"mvn test\" command on our continuous integration server,

相关标签:
4条回答
  • 2021-01-18 20:25
    mvn clean install deploy -Dbuildnumber.phase=none
    
    0 讨论(0)
  • 2021-01-18 20:37

    You may skip failure without change pom.xml in project. Please look at my answer at Disable maven build number plugin

    0 讨论(0)
  • 2021-01-18 20:40

    Use a profile to control which plug-ins are enabled during the build:

    <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>
    

    The profile can be enabled by running Maven as follows:

    mvn -Pwith-scm package
    
    0 讨论(0)
  • 2021-01-18 20:40

    One approach would be to use a property in your pom to specify the execution phase of the build number plugin, as shown below.

    <project>
      ..
      <properties>
        <buildnumber.plugin.phase>validate</buildnumber.plugin.phase>
        ..
      </properties>
      ..
      <plugins>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>buildnumber-maven-plugin</artifactId>
          <version>1.2</version>
          <executions>
            <execution>
              <phase>${buildnumber.plugin.phase}</phase>
              <goals>
                <goal>create</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            ..
          </configuration>
        </plugin>
      </plugins>
      ..
    </project>
    

    Then provide the property on the command line to disable the plugin, as shown in the following example.

    mvn install -Dbuildnumber.plugin.phase=none
    
    0 讨论(0)
提交回复
热议问题