Add subversion revision to war manifest using maven2

I want to find maven native (i.e. without invoking external programs) to inject the svn version into the war manifest.

Does anyone know a way to do this?

I found a mention of how to add subversion revision to manifests in jar files, but not with war files.

I searched for SO but could not find this problem on purpose.

+5
source share
2 answers

I want to find maven native (i.e. without invoking external programs) to inject the svn version into the war manifest.

This is possible using the Build Maven Plugin using the provider svnjava:

If you need to execute a plugin on a machine without any svn in the way, you can configure mojo to use the svnjava provider.

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <version>1.0-beta-3</version>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>create</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <doCheck>true</doCheck>
          <doUpdate>true</doUpdate>
          <providerImplementations>
            <svn>javasvn</svn>
          </providerImplementations>          
        </configuration>
      </plugin>
    </plugins>
  </build>

Maven ${buildNumber}, POM.

, subversion jar, .

, MANIFEST , , Usage:

  <build>
    ...
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.0.2</version>
        <configuration>
          <archive>
            <manifest>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
            </manifest>
            <manifestEntries>
              <Implementation-Build>${buildNumber}</Implementation-Build>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>
+4

this. , maven-war-plugin

  <build>
    ...
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.0.2</version>
        <configuration>
          <archive>
            <manifest>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
            </manifest>
            <manifestEntries>
              <Implementation-Build>${buildNumber}</Implementation-Build>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>
+2

All Articles