How can I take build number using SVN and Maven?
Asked Answered
C

1

5

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?

Corelli answered 27/3, 2014 at 15:31 Comment(0)
T
7

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>
Tridentine answered 27/3, 2014 at 15:38 Comment(3)
Also, there's a newer version of the buildnumber-maven-plugin available: Version 1.2. Make sure both the svnkit and buildnumber-maven-plugin versions are up-to-date.Packsaddle
@user3186861 feel free to accept the answer then ;)Tridentine
Adding some extra information, I was using a framework where this dependency was stated correctly, but my Parent POM was overriding it without this dependency (started with <plugin> <groupId>org.codehaus.mojo</groupId>...) so it didn't find the correct verison, when I expanded with Thomas' dependency it worked fine.Liggett

© 2022 - 2024 — McMap. All rights reserved.