为什么忽略pom.xml中的shortrevisionlength属性?

时间:2015-12-06 20:45:07

标签: git maven

我尝试使用" org.codehaus.mojo"插件在我的项目中。我的pom.xml的构建部分如下。我设置了shortrevisionlength但是它被忽略了。我用过Git。可能是什么原因?

生成的战争文件的名称是"行李-1.0_6c2837f8b962396e82489eb4503b8ecfb5361779"

<build>
    <finalName>${project.artifactId}-${project.version}_${buildNumber}</finalName>

<resources>
    <resource>
        <directory>src/main/webapp</directory>
    </resource>
    <resource>
        <directory>src/main/resources</directory>
    </resource>
</resources>

<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.3</version>
    <configuration>
      <source>1.6</source>
      <target>1.6</target>
    </configuration>
  </plugin>

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>buildnumber-maven-plugin</artifactId>
    <version>1.4</version>
    <executions>
      <execution>
        <phase>validate</phase>
        <goals>
          <goal>create</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <doCheck>false</doCheck>
      <doUpdate>true</doUpdate>
      <shortrevisionlength>5</shortrevisionlength>
    </configuration>
  </plugin>

</plugins>
</build>

1 个答案:

答案 0 :(得分:2)

配置属性区分大小写:您不应使用shortrevisionlength,而应使用shortRevisionLength

<configuration>
  <doCheck>false</doCheck>
  <doUpdate>true</doUpdate>
  <shortRevisionLength>5</shortRevisionLength>
</configuration>