{"id":231,"date":"2010-04-14T07:45:35","date_gmt":"2010-04-14T07:45:35","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/2010\/04\/14\/integrating-subversion-into-your-ant-build\/"},"modified":"2017-12-27T07:23:57","modified_gmt":"2017-12-27T07:23:57","slug":"integrating-subversion-into-your-ant-build","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/integrating-subversion-into-your-ant-build\/","title":{"rendered":"How to Integrate Subversion Into Your Ant Build ? &#8211; Step by step guide"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4256\" src=\"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/04\/integrating-subversion-into.png\" alt=\"svn-integration-in-ant-build \" width=\"600\" height=\"400\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2010\/04\/integrating-subversion-into.png 600w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2010\/04\/integrating-subversion-into-300x200.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><b>SVNAnt<a class=\"mceItemAnchor\" name=\"SVNAnt\"><\/a><\/b><br \/>\nSVNAnt is an Ant task allowing you to interact with Subversion within the convenience of your Ant build script. No more writing custom scripts to get the revision of your repository to tag your release jars. Nor do you have to make command line calls to checkout your latest and greatest as part of your continuous integration process. With SVNAnt, you have the familiarity of the Ant syntax and the flexibility you need for interacting with Subversion.<br \/>\n<b>Features<a class=\"mceItemAnchor\" name=\"Features\"><\/a><\/b><br \/>\nSVNAnt is a full-featured Subversion client capable of using the native Java bindings or command-line wrappering depending on which is available. Beyond how it works, SVNAnt allows you to do all <b>svn<\/b> subcommands but the following:<\/p>\n<table class=\"mceItemTable\" border=\"0\" width=\"50%\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>blame<\/td>\n<td>cleanup<\/td>\n<td>help<\/td>\n<td>list<\/td>\n<\/tr>\n<tr>\n<td>lock<\/td>\n<td>log<\/td>\n<td>merge<\/td>\n<td>propedit<\/td>\n<\/tr>\n<tr>\n<td>proplist<\/td>\n<td>resolved<\/td>\n<td>unlocked<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>If the <b>svn<\/b> subcommand is not listed here, you can use it in your Ant build file. Before we continue start using SVNAnt, we have to install it and configure Ant to use it.<br \/>\n<b>Installation<a class=\"mceItemAnchor\" name=\"Installation\"><\/a><\/b><br \/>\nNow that we know what SVNAnt is and what its features are, lets install SVNAnt so that you can begin to use SVNAnt to access Subversion within your Ant build cycle.<\/p>\n<p><b>Step 1. (Download, Compile and Extract)<\/b><br \/>\nThis step will download, compile, and &#8220;install&#8221; the latest version of SVNAnt.<br \/>\n<b>1.1<\/b> Using Subversion, checkout the SVNAnt project located here: <a href=\"http:\/\/subclipse.tigris.org\/svn\/subclipse\/trunk\/svnant\" target=\"_blank\" rel=\"noopener\"><b>http:\/\/subclipse.tigris.org\/svn\/subclipse\/trunk\/svnant<\/b><\/a><br \/>\n<b>1.2<\/b> From the command line, while inside of the location where you checked out SVNAnt to, run <b>&#8220;ant makeDistrib&#8221;<\/b><br \/>\n<b>1.3<\/b> Extract the .zip file created in the <b>build<\/b> directory of your SVNAnt source to a location of your choosing<\/p>\n<p><b>Step 2. (Modify your build.xml)<\/b><br \/>\nThe next step is to tell Ant how to find your SVNAnt task by adding the following to your build.xml file:<br \/>\n&lt;path id= &#8220;svnant.classpath&#8221; &gt;<br \/>\n&lt;fileset dir= &#8220;\/PATH\/TO\/YOUR\/EXTRACTED\/SVNANT-ZIP&#8221; &gt;<br \/>\n&lt;include name= &#8220;*.jar&#8221; \/&gt;<br \/>\n&lt;\/fileset&gt;<br \/>\n&lt;\/path&gt;<\/p>\n<p>&lt;typedef resource=&#8221;org\/tigris\/subversion\/svnant\/svnantlib.xml&#8221; classpathref=&#8221;svnant.classpath&#8221; \/&gt;<br \/>\nThat should be it. I know that it appears to be too good to be true so lets verify this.<\/p>\n<p><b>Step 3. (Verify installation)<\/b><br \/>\nBuilding upon <b>Step 2<\/b>, lets create a new ant task that will use the <a href=\"http:\/\/subclipse.tigris.org\/svn\/subclipse\/trunk\/svnant\/doc\/svn.html#wcVersion\" target=\"_blank\" rel=\"noopener\">wcVersion<\/a> feature of SVNAnt to get some information about your repository from a local working copy:<br \/>\n&lt;target name=&#8221;testSVNAnt&#8221;&gt;<br \/>\n&lt;svn&gt;<br \/>\n&lt;wcVersion path= &#8220;PATH\/TO\/YOUR\/WORKINGCOPY&#8221; \/&gt;<br \/>\n&lt;\/svn&gt;<\/p>\n<p>&lt;echo message= &#8220;Subversion repository url: ${repository.url}&#8221; \/&gt;<br \/>\n&lt;\/target&gt;<br \/>\n<b>(Note: In the event that you need to pass credentials to Subversion, look <\/b><a href=\"http:\/\/subclipse.tigris.org\/svn\/subclipse\/trunk\/svnant\/doc\/svn.html\" target=\"_blank\" rel=\"noopener\"><b>here<\/b><\/a><b>.)<\/b><br \/>\nThe output should be something similar to this:<br \/>\n$ ant testSVNAnt<\/p>\n<p>Buildfile: build.xml<\/p>\n<p>testSVNAnt:<br \/>\n[svn] &lt;WcVersion&gt; started &#8230;<br \/>\n[svn]\u00a0 finished.<br \/>\n[echo] Subversion repository url: http:\/\/svn.apache.org\/repos\/asf\/incubator\/openejb\/trunk<\/p>\n<p>BUILD SUCCESSFUL<br \/>\nTotal time: 43 seconds<\/p>\n<p>Pat yourself on the back. You have successfully installed SVNAnt and you are ready to implement Subversion into your Ant build cycle. Instead of us going through each available feature for SVNAnt, please view the <a href=\"http:\/\/subclipse.tigris.org\/svn\/subclipse\/trunk\/svnant\/doc\/svn.html\" target=\"_blank\" rel=\"noopener\">SVNAnt Documentation<\/a>. Now lets talk about why you may want to use SVNAnt to allow for Subversion interaction inside of your Ant build cycle.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SVNAnt SVNAnt is an Ant task allowing you to interact with Subversion within the convenience of your Ant build script. No more writing custom scripts to get the revision of your repository to tag your release jars. Nor do you have to make command line calls to checkout your latest and greatest as part of&#8230;<\/p>\n","protected":false},"author":1,"featured_media":4256,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[8],"tags":[209,3827,91,3830,3832,588,593,732,394,3831,3828,3829,395,3833,3835,3834,3251],"class_list":["post-231","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-training","tag-ant","tag-ant-build","tag-build","tag-how-to-integrate-svn-in-ant-build","tag-implement-subversion-into-ant-build","tag-integration","tag-process","tag-steps","tag-subversion","tag-subversion-and-ant-integration","tag-subversion-integration","tag-subversion-integration-in-ant-build","tag-svn","tag-svn-integration-in-ant-build-guide","tag-svn-integration-in-ant-build-instruction","tag-svn-integration-in-ant-build-tutorial","tag-svnant"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/231","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=231"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/231\/revisions"}],"predecessor-version":[{"id":4258,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/231\/revisions\/4258"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/4256"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}