我是Maven的新用户,使用buildnumber-maven-plugin时遇到了困难。基本上,我想让maven构建我的项目并创建一个结果的JAR文件,并在manifest.mf文件中设置构建编号。我将在下面包含大部分的pom.xml文件。我已经发布了一个相关问题,但这个问题是关于另一个问题的!
当我运行“mvn clean compile package”时,我看到以下错误:
[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]
我已将doCheck和doUpdate都设置为false,所以不知道为什么SCM会被涉及。 我的解决方法是添加一些虚拟的SCM配置,但这感觉很笨重。 有更好的方法吗?
<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>
这是我的pom.xml文件的构建部分:
<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>