我是Maven的新用户,并且很难获得buildnumber-maven-plugin来做我期望的事情。本质上,我希望maven构建我的项目并创建结果的JAR文件,并在manifest.mf文件中设置内部版本号。我将在下面包含我的大部分pom.xml文件。我已经发布了一个相关的问题,但这个问题是关于一个不同的问题!
当我运行mvn clean编译包时,我看到以下错误:
[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>