Recommendations for embedding SVN version number in Java jar manifest?

I see questions such as How to get the version number from subversion using maven? , but are there any standards (defacto or otherwise) for which the actual fields used in the manifest are for version # and for the repository URL (i.e. showing that it is on a trunk or branch)? I saw the used version of the implementation, with and without the leading "r" (for revision), I saw the implementation-Build: used as well.

edit I removed the maven tag, which should not have been. My question is about the contents of the can, not the toolkit itself.

+5
source share
1 answer

, jar- .

. svn: keywords, . $Revision$ $HeadURL$ URL- . :

$Revision$ $HeadURL$

maven, version.properties:

revision=$Revision$
repourl=$HeadURL$

pom.xml ( maven ):

<plugins>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>properties-maven-plugin</artifactId>
    <version>1.0-alpha-1</version>
    <executions>
      <execution>
        <phase>initialize</phase>
        <goals>
          <goal>read-project-properties</goal>
        </goals>
        <configuration>
          <files>
            <file>version.properties</file>
          </files>
        </configuration>
      </execution>
    </executions>
  </plugin>

url :

<manifest>
  <attribute name="Revision" value="${revision}" />
  <attribute name="Repository URL" value="${repourl}" />
</manifest>

, svn:keywords, subversion, $Revision$ $HeadURL$ replace . version.properties, :

svn propset svn:keywords Revision version.properties
svn propset svn:keywords HeadURL version.properties
+2

All Articles