4/29/2009

install ant and svn ant on ubuntu 8.X or later

1 install and config the ant(JRE has installed)


sudo apt-get install ant ant-optional
echo ‘ANT_HOME=”/usr/share/ant”‘ | sudo tee -a /etc/environment

2 download the svnant

firefox http://subclipse.tigris.org/svnant.html

3 unzip svnant-1.2.1.zip, and put lib/*.jar files to your ANT_HOME/lib directory
4 test it with the following build.xml


<?xml version="1.0"?>
<project name="svn-test" default="Main" basedir=".">
<!-- Sets variables which can be used. -->
<property name="checkout" location="./svncheckout" />
<!-- Define the classpath which includes the jars that are required for svnant.jar -->
<path id="svnant.class.path">
<pathelement location="lib/svnant.jar" />
<pathelement location="lib/svnClientAdapter.jar" />
<pathelement location="lib/svnjavahl.jar" />
<pathelement location="lib/svnkit.jar" />
</path>

<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.class.path" />


<!-- Deletes the existing build, docs and dist directory-->
<target name="clean">
<delete dir="${checkout}" />
</target>

<!-- Creates the build, docs and dist directory-->
<target name="makedir">
<mkdir dir="${checkout}" />
</target>


<!-- Checkout the latest source code of svnant itself-->
<target name="svn">
<svn username="guest" password="">
<checkout url="http://subclipse.tigris.org/svn/subclipse/trunk/svnant/" revision="HEAD" destPath="${checkout}" />
</svn>
</target>

<target name="Main" depends="clean, makedir, svn">
<description>Main target</description>
</target>
</project>



edwin@Castor:~/Desktop/svnTest$ ant
Buildfile: build.xml

clean:
[delete] Deleting directory /home/edwin/Desktop/svnTest/svncheckout

makedir:
[mkdir] Created dir: /home/edwin/Desktop/svnTest/svncheckout

svn:
[svn] started ...
[svn] finished.

Main:

BUILD SUCCESSFUL
Total time: 1 minute 58 seconds

No comments: