The svn-revision-number-maven-plugin could help you adding the SVN revision number to your built artifact. Configure your pom.xml as follow.
... <build> <finalName>${project.artifactId}-r${svn.revision}</finalName> <plugins> <!-- Use the svn revision number for the built artifact --> <plugin> <groupId>com.google.code.maven-svn-revision-number-plugin</groupId> <artifactId>svn-revision-number-maven-plugin</artifactId> <version>1.13</version> <executions> <execution> <goals> <goal>revision</goal> </goals> </execution> </executions> <configuration> <entries> <entry> <prefix>svn</prefix> <!-- create the ${svn.revision} --> </entry> </entries> </configuration> </plugin> </plugins> </build> ...
If you find the following error when running mvn package
- Failed to execute goal com.google.code.maven-svn-revision-number-plugin:svn-revision-number-maven-plugin:1.13:revision (default) on project MYPROJECT: svn: E155021: This client is too old to work with the working copy at…
Try adding the following dependencies
... <pluginRepositories> <pluginRepository> <id>opencast-project-repository</id> <name>Opencast Project Repository</name> <url>http://repository.opencastproject.org/nexus/content/groups/public</url> </pluginRepository> </pluginRepositories> ... <build> <finalName>${project.artifactId}-r${svn.revision}</finalName> <plugins> <!-- Use the svn revision number for the built artifact --> <plugin> <groupId>com.google.code.maven-svn-revision-number-plugin</groupId> <artifactId>svn-revision-number-maven-plugin</artifactId> <version>1.13</version> <executions> <execution> <goals> <goal>revision</goal> </goals> </execution> </executions> <configuration> <entries> <entry> <prefix>svn</prefix> <!-- create the ${svn.revision} --> </entry> </entries> </configuration> <dependencies> <dependency> <groupId>org.tmatesoft.svnkit</groupId> <artifactId>svnkit</artifactId> <version>1.8.1</version> </dependency> <dependency> <groupId>org.tmatesoft.sqljet</groupId> <artifactId>sqljet</artifactId> <version>1.1.9</version> </dependency> </dependencies> </plugin> </plugins> </build> ...
Done =)
Reference: