簡體   English   中英

如何使用SVN和Maven獲取內部版本號?

[英]How can I take build number using SVN and Maven?

我使用buildnumber-maven-plugin ,我需要從svn獲取構建數量的項目。 我的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>

但是當我打包一個項目時,我有錯誤:

[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}).

雖然我使用TortoiseSVN 1.8.2!

我讀到使用TortoiseSVN 1.7及更早版本的buildnumber-maven-plugin表現得如此。 如何使用SVN和Maven獲取內部版本號?

buildnumber插件將訪問您的工作副本以獲得修訂,因為您使用TortoiseSVN 1.8.x,您的工作副本是svn 1.8.x格式。 因此,buildnumber插件使用的svnkit也需要支持svn 1.8.x,你使用的版本(1.7.4-v1)很可能不支持。

因此,您需要更新版本的svnkit,例如

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM