Maven buildnumber plugin error scm url cannot be null

I am a new Maven user and am having difficulty getting the buildnumber-maven plugin to do what I expect. Basically I want maven to build my project and create a result JAR file and also set the build number in the manifest.mf file. I'll include most of my pom.xml file below. I already posted a related question, but this question addresses a different issue!

When I run mvn clean compile package I see the following error:

[ERROR] Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.4:create (buildnumber) on project xcase: Execution buildnumber of goal org.codehaus.mojo:buildnumber-maven-plugin:1.4:create failed: The scm url cannot be null. -> [Help 1]

      

I set both doCheck and doUpdate to false, so I don't know why SCM is involved. My workaround was to add some dummy SCM configuration, but this is inconvenient. Is there a better way?

  <scm>
    <connection>scm:svn:http://127.0.0.1/dummy</connection>
    <developerConnection>scm:svn:https://127.0.0.1/dummy</developerConnection>
    <tag>HEAD</tag>
    <url>http://127.0.0.1/dummy</url>
  </scm>

      

Here is the build section of my pom.xml file:

  <build>
    <outputDirectory>build</outputDirectory>
    <plugins>
      <plugin>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <configuration>
          <buildNumberPropertyName>buildNumber</buildNumberPropertyName>
          <doCheck>false</doCheck>
          <doUpdate>false</doUpdate>
          <format>{0,number,integer}</format>
          <items>
            <item>buildNumber</item>
          </items>
          <revisionOnScmFailure>true</revisionOnScmFailure>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>create</goal>
            </goals>
            <id>buildnumber</id>
          </execution>
        </executions>
        <groupId>org.codehaus.mojo</groupId>
        <version>1.4</version>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.0.2</version>
        <executions>
          <execution>
            <id>copy-resources</id>
            <phase>validate</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${basedir}/build</outputDirectory>
              <resources>          
                <resource>
                  <directory>${basedir}</directory>
                  <filtering>true</filtering>
                  <excludes>
                    <exclude>*local*.properties</exclude>
                  </excludes>
                  <includes>
                    <include>*.properties</include>
                  </includes>
                </resource>
                <resource>
                  <directory>${basedir}/src/java</directory>
                  <filtering>true</filtering>
                  <includes>
                    <include>log4j2.xml</include>
                  </includes>
                </resource>
              </resources>              
            </configuration>            
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.1</version>
        <configuration>
          <archive>
            <manifest>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
            </manifest>
            <manifestEntries>
              <Implementation-Build>${buildNumber}</Implementation-Build>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
    </plugins>
    <sourceDirectory>src/java</sourceDirectory>
  </build>

      

+3


source to share





All Articles