How to get SVN size of a specific branch in Maven

I am doing SVN for a tree with several branches, and I use the buildnumber plugin to get the version of SVN with the javasvn implementation provider.

When I try to build a specific branch, it seems that Maven is retrieving a revision of the top-level folder of the tree, and not a revision of that particular branch.

For instance:
root revision number: 100
root / branch1 Revision No: 99
root / branch2 Revision No: 97

In my case, when I build branch 1, I need 99 for the number with number, not 100.

I am using SVN 1.7.

This is how I configure the plugin:

<build> <finalName>${project.artifactId}-${project.version}-SVN${buildNumber}</finalName> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>buildnumber-maven-plugin</artifactId> <executions> <execution> <phase>validate</phase> <goals> <goal>create</goal> </goals> </execution> </executions> <configuration> <doCheck>false</doCheck> <doUpdate>false</doUpdate> <providerImplementations> <svn>javasvn</svn> </providerImplementations> </configuration> </plugin> 

Any idea is much appreciated.

Thanks

+4
source share
2 answers

Try using the useLastCommittedRevision configuration, which is set to false by default. This should take the last fixed revision instead of revising the repository on the specific module from which pom is created.

+2
source

Here's how we do it in our project:

  <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <phase>generate-resources</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <!-- http://stackoverflow.com/questions/3532135/using-maven-to-output-the-version-number-to-a-text-file --> <!-- Safety --> <mkdir dir="${project.build.directory}"/> <exec executable="svn" output="${basedir}/src/main/filters/svn.properties" dir=".."> <arg value="info"/> </exec> <replace file="${basedir}/src/main/filters/svn.properties" token="Last Changed Rev" value="Last.Changed.Rev"/> </tasks> </configuration> </execution> </executions> </plugin> 

This displays a line in src/main/filters/svn.properties , which has Last.Changed.Rev: 22479 in it. We will rename Last Changed Rev to Last.Changed.Rev , so this is a valid variable name. Then you can use this as a filter in other files. You may not need a filter, but perhaps this example will help you with your needs.

+3
source

All Articles