1. 首页
  2. IT资讯

How to get the SVN info use ANT

1.How to get the SVN info

There are two ways to get the SVN info:

Ø      Add some tags in one file and hope SVN will update them, but if this file is not get updated, it the tag will not changed neither, and we are not sure how to get those values though java codes.

Ø      The other one is retrieve the info at the building stage using ant task, and store them into one specified files, and read those files when needed.

 

There are two options when we choose the second approach.

1 Exec ”svn.exe” in Subversion Client  folder

Pre-condition:

You must install Command-line SVN (CollabNet) firstly. Download from http://www.collab.net/downloads/subversion/ .

Maybe TortoiseSVN(Download from:  http://tortoisesvn.net/downloads ) and setup the user accounts is also a must, because this ant task doesn’t need to input any user info.

 

< property file = “local.properties” />

 

< target name = “generate_svn_info” description = “generate an info file which contains the svn info” >

      < exec dir = “${SVN_HOME}” executable = “${SVN_CLIENT_HOME}/svn.exe” output = “svn_info.txt” >

            < arg line = “info” />

      </ exec >

</ target >

 

Below is a sample generated by this script

Path: .

URL: http://xxxxxxxxxxxxx/xxxxxxxxxxxxx/xxxxxxxxxxxxx

Repository Root: http://xxx/xxxxx/xxxx

Repository UUIDxxxx-xxx-x-x-x-x-x-xxxx-xxxxx:

Revision: 41454

Node Kind: directory

Schedule: normal

Last Changed Author: xxxxx

Last Changed Rev: 41453

Last Changed Date: 2010-10-20 08:29:46 +0800 (Wed, 20 Oct 2010)

 

2 Use ant jar files provide by CollabNet

Use the ant jar files provided by CollabNet (Download from: http://subclipse.tigris.org/servlets/ProjectDocumentList?folderID=1731&expandFolder=1731&folderID=0 ). The shortages are we need to include new jar files and we need to set the username and password in the build script.

< path id = “svnant.lib” >

        < fileset >

            < include name = “svnant.jar” />

            < include name = “svnClientAdapter.jar” />

            < include name = “svnjavahl.jar” />

        </ fileset >

</ path >

   

< taskdef name = “svn” classpathref = “project.classpath” classname = “org.tigris.subversion.svnant.SvnTask” />

 

 

< target name = “ant_generate_svn_info” >

    < svn username = “xxxx” password = “xxxxxx” >

       < status urlProperty = “http://axxxx/xxxx/xxxxxx/xxxx” path = “.” revisionProperty = “svn.revision” />

    </ svn >

   

    < echo > lastChangedRevisionProperty ${svn.revision} </ echo >

</ target >

 

 

  • 点赞
  • 收藏
  • 分享

    • 文章举报

How to get the SVN info use ANT How to get the SVN info use ANT
shaofeiwang
发布了63 篇原创文章 · 获赞 1 · 访问量 12万+

私信 关注

原文始发于:How to get the SVN info use ANT

主题测试文章,只做测试使用。发布者:sys234,转转请注明出处:http://www.cxybcw.com/102316.html

联系我们

13687733322

在线咨询:点击这里给我发消息

邮件:1877088071@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息

QR code