Quantcast
Channel: Eureka! » Ant
Viewing all articles
Browse latest Browse all 26

Apache Ant and SVN Integration

$
0
0

We could setup a SVN client in Apache Ant. Here is an example.

1. Download the following .jar files @ the repository.pentaho.org

  • svnant-1.3.0.jar
  • svnClientAdapter-svnant-1.3.0.jar
  • svnjavahl-svnant-1.3.0.jar

 

2. Put the above downloaded .jar files into a folder called ant-lib in your project webroot.

ant-for-example
  | - ant-lib
  |    | - svnant-1.3.0.jar
  |    | - svnClientAdapter-svnant-1.3.0.jar
  |    | - svnjavahl-svnant-1.3.0.jar
  | - build.xml

 

3. Edit the build.xml as follow:

<project name="ant-svn-example" default="run" basedir=".">

  <property name="svn_user" value="[your svn username]"/>
  <property name="svn_pass" value="[your svn password]"/>
  <property name="svn_path" value="[the svn path in your local machine]"/>

  <!-- Load the svnant lib -->
  <path id="svn_class_path">
    <pathelement location="${basedir}/ant-lib/svnant-1.3.0.jar"/>
    <pathelement location="${basedir}/ant-lib/svnClientAdapter-svnant-1.3.0.jar"/>
    <pathelement location="${basedir}/ant-lib/svnjavahl-svnant-1.3.0.jar"/>
  </path>
  <taskdef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svn_class_path"/>

  <target name="run">
    <svn username="${svn_user}" password="${svn_pass}">
      <status path="${svn_path}" revisionProperty="svn_version"/>
    </svn>
    <echo message="Current version: ${svn_version}"/>
  </target>
</project>

 

4. Try it out.
ant-svn-integration

You can also call svn checkout, update and other SVN client functions. For more information, you can refer to Tigris.org – svntask.

Done =)

Reference:


Filed under: Ant, SVN Tagged: Ant, Subversion, SVN

Viewing all articles
Browse latest Browse all 26

Trending Articles