javamavensvnbuildnumber-maven-plugin

How can I take build number using SVN and Maven?


I use buildnumber-maven-plugin and I need take build number of project from svn. My pom.xml:

<scm>
    <connection>
        scm:svn:https://username:password@path_to_repositiry
    </connection>
</scm>

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>buildnumber-maven-plugin</artifactId>
    <version>1.1</version>
    <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>
    <dependencies>
        <dependency>
            <groupId>com.google.code.maven-scm-provider-svnjava</groupId>
            <artifactId>maven-scm-provider-svnjava</artifactId>
            <version>2.0.2</version>
        </dependency>
        <dependency>
            <groupId>org.tmatesoft.svnkit</groupId>
            <artifactId>svnkit</artifactId>
            <version>1.7.4-v1</version>
        </dependency>
    </dependencies>
</plugin>

But I have error, when I package a project:

[ERROR] Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.1:create (default)on project myproject: Cannot get the revision information from the scm repository : [ERROR] Exception while executing SCM command. svn: E155021: This client is too old to work with the working copy at [ERROR] 'D:\projects\myproject' (format {1}).

Although I use TortoiseSVN 1.8.2!

I read that buildnumber-maven-plugin behaves so with TortoiseSVN 1.7 and older. How can I take build number using SVN and Maven?


Solution

  • The buildnumber plugin will access your working copy to get the revision and since you use TortoiseSVN 1.8.x your working copy is in svn 1.8.x format. Hence svnkit which is used by the buildnumber plugin needs to support svn 1.8.x as well, which the version you're using (1.7.4-v1) most probably doesn't.

    You thus need a newer version of svnkit, e.g.

    <dependency>
      <groupId>org.tmatesoft.svnkit</groupId>
      <artifactId>svnkit</artifactId>
      <version>1.8.3-1</version>
    </dependency>