• Post Reply Bookmark Topic Watch Topic
  • New Topic

Steps to check out from svn by ANT script:  RSS feed

mehul thakor
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steps to check out from svn by ANT script:

1] SvnAnt
You can find latest version of svnant on http://subclipse.tigris.org
2] extract the zip and get the jar file from lib folder
3] Put the svnant.jar and svnClientAdapter.jar files to classpath of your ant build file.
(Or directly to your ANT_HOME/lib directory.)
4] In the build file, load the <svn> task.
E.g. like this:
<taskdef resource="svntask.properties" classpathref="project.classpath"/>
(where svnant.jar lies in the "project.classpath")

5] To provide access to the Subversion API, svnant uses svnClientAdapter on top of
either the JavaHL native Subversion Java (JNI) bindings or Subverion's
command line programs (which must be installed and in your PATH).

FOR Subversioning ,SVN needs to be recognized by your system.
Get COMMAND LINE PROGRAM for this recognition.
Most preferable is SLIK Subversion for 32 -bit
Link is : http://www.sliksvn.com/en/download/
6] After installing restart the computer
7] now go to command prompt and write
Svn �version
It will get recognized�.as follows:
Type svn_help for more

8] Write the build.xml and build.properties to check out the file from SVN and place them under your WORK_DIR.

Sample of build.xml:

<?xml version="1.0"?>

<project name="svn-test" basedir="." default="checkoutThis">

<property file="build.properties" />
<path id="project.classpath">
<pathelement location="jsvn.jar" />
<pathelement location="svnant.jar" />
<pathelement location="svnClientAdapter.jar" />
<pathelement location="commons-lang-2.0.jar" />
<pathelement location="jakarta-regexp-1.3.jar" />
<pathelement location="svnjavahl.jar" />

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

<target name="checkoutThis">

<svn username="${svnant.repository.user}" password="${svnant.repository.passwd}">
<checkout url="${svnant.this.url}" revision="HEAD" destPath="${svnant.latest.url}" />

Sample of build.properties:

# -----------------------------------------------------------------------------
# build.properties
# This file is referenced by the build.xml file.
# $Id$
# -----------------------------------------------------------------------------


# -----------------------------------------------------------------------------
# all jar needed
# -----------------------------------------------------------------------------


svnant.latest.url=�Desination directory�
svnant.this.url=�SVN URL from where to checkout file�
svnant.repository.user=�Username for SVN athentication�
svnant.repository.passwd="password for SVN athentication"

9To checkout file, open command prompt and cd to WORK_DIR.

1.Execute ant.

2.If the build is successful, the following message will appear. Your files have been successfully checkout to the desination path.

3]if your file name is other then build.xml
Then write command as follows:

Ant �f file_name.xml
Jan Cumps
Posts: 2632
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your question?
Peter Johnson
Posts: 5856
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mehul, welcome to JavaRanch!

I should point out that the forums are used for asking questions about Java technologies. They are not intended to be blogs where you post tutorials on how to do various things. I do encourage you, however, to either post your own questions or post answers to other's questions.

Also, when making a lengthy post, please take the time to format it properly so that it is easy to read and understand. Use the 'code' UBBCode tag to format any source code, especially XML. You can edit your post to fix the formatting by clicking on the paper-and-pencil icon.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!