2

Currently we are working on the big maven project that has about 100 modules, some of them have submodules as well. Some of modules use Maven Build Number plugin. The project is hosted under subversion.

Recently we started to use git locally in our development team. After cloning subversion repo and trying to build the Project, we received following well known error:

The svn command failed.
Command output:
svn: ‘.’ is not a working copy

Unfortunately in our case it is not an option to create a new profile or just remove plugin definition from POM (this will follow to messing up hundreds of POM files). I found the following article http://abstractionextraction.wordpress.com/2012/09/27/git-svn-vs-maven-build-number-plugin/ but honestly, it's not something that I would really like to do...

Is there any smart way to disable this plugin. Like command-line parameter?

  • Is looks like duplicate of https://stackoverflow.com/questions/9851475/hot-to-disable-buildnumber-maven-plugin-through-cmd – Hubbitus May 07 '19 at 20:57

3 Answers3

3

I think you may skip failure on obtain revision without change project pom.xml - buildnumber-maven-plugin has option revisionOnScmFailure which you may use like:

mvn -Dmaven.buildNumber.revisionOnScmFailure=no-scm package

In that case value no-scm will be used if scm call was unsuccessful. Off course you may change it and provide any other string.

Hubbitus
  • 5,161
  • 3
  • 41
  • 47
0

Per the mojo documentation, you could use the revisionOnScmFailure property.

However, it doesn't have a command line option. You'll have to modify those pom.xml files.

See "Defining Parameters Within a Mojo" in the Maven Java Plugin Development Guide

noahlz
  • 10,202
  • 7
  • 56
  • 75
0

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
matt_smith
  • 41
  • 1