{"id":146,"date":"2009-10-06T10:48:12","date_gmt":"2009-10-06T10:48:12","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/2009\/10\/06\/how-to-use-svn-tasks-with-ant\/"},"modified":"2017-12-26T08:37:34","modified_gmt":"2017-12-26T08:37:34","slug":"how-to-use-svn-tasks-with-ant","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/how-to-use-svn-tasks-with-ant\/","title":{"rendered":"How to Use SVN Tasks with ANT ?"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4080 aligncenter\" src=\"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2009\/10\/svn-tasks-ant.png\" alt=\"svn-tasks-with-ant\" width=\"600\" height=\"400\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2009\/10\/svn-tasks-ant.png 600w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2009\/10\/svn-tasks-ant-300x200.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>This post is about using ANT to perform some of the most common source-control related tasks such as export, tagging, and branching. I am using ANT version 1.7.0 and SVN Ant version 1.1-rc3, bound against Subversion 1.4.0.<\/p>\n<p>The related software can be downloaded here:<br \/>\n1.\u00a0\u00a0\u00a0 SVN Ant = <a href=\"http:\/\/subclipse.tigris.org\/svnant.html\" target=\"_blank\" rel=\"noopener\">http:\/\/subclipse.tigris.org\/svnant.html<\/a><br \/>\n2.\u00a0\u00a0\u00a0 ANT = <a href=\"http:\/\/ant.apache.org\/\" target=\"_blank\" rel=\"noopener\">http:\/\/ant.apache.org\/<\/a><br \/>\nI shall start with build.properties, which lists a few key\/value pairs used in our SVN Ant task build file, referred as svn-tasks.xml:<\/p>\n<p><b>Content of build.properties:<\/b><br \/>\n####START of SVN Properties ####<br \/>\nsvn.repository.url=http:\/\/xyz.com\/repos\/somereponame<br \/>\nsvn.project.base.path=someprojectname<br \/>\nsvn.username=user name to access repo<br \/>\nsvn.password=password to access repo<br \/>\n#This shall be name of the tag,<br \/>\n#This property should always be updated before build starts<br \/>\n#This property shall be used to export<br \/>\ntag.name=SOME_TAG_NAME_12222008<br \/>\n#This shall be name of new branch,<br \/>\n#this property should be used only when new branch is to be created<br \/>\nnew.branch.name=NEW_BRANCH_12222008<br \/>\n####END of SVN Properties ####<br \/>\nContent of svn-tasks.xml:<br \/>\n&lt;property file=&#8221;build.properties&#8221;&gt;&lt;\/property&gt;<\/p>\n<p>&lt;!&#8211; SVN and SVN-ANT Tasks properties &#8211;&gt;<br \/>\n&lt;property name=&#8221;svn.repository.url&#8221; value=&#8221;${svn.repository.url}&#8221;\/&gt;<br \/>\n&lt;property name=&#8221;svn.project.base.path&#8221; value=&#8221;${svn.project.base.path}&#8221; \/&gt;<br \/>\n&lt;property name=&#8221;svn.base.url&#8221; value=&#8221;${svn.repository.url}\/${svn.project.base.path}&#8221;\/&gt;<br \/>\n&lt;property name=&#8221;svnant.lib.dir&#8221; location=&#8221;svn-ant-lib&#8221;\/&gt;<br \/>\n&lt;property name=&#8221;svnant.javahl&#8221; value=&#8221;false&#8221; \/&gt;<br \/>\n&lt;property name=&#8221;svnant.svnkit&#8221; value=&#8221;true&#8221; \/&gt;<br \/>\n&lt;!&#8211; SVN and SVN-ANT Tasks properties &#8211;&gt;<\/p>\n<p>&lt;!&#8211; *************************************************************** &#8211;&gt;<br \/>\n&lt;!&#8211;\u00a0\u00a0 Set-Up of SVN-ANT classpath\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;&gt;<br \/>\n&lt;!&#8211; *************************************************************** &#8211;&gt;<br \/>\n&lt;path id=&#8221;svnant.classpath&#8221;&gt;<br \/>\n&lt;fileset dir=&#8221;${svnant.lib.dir}&#8221;&gt;<br \/>\n&lt;include name=&#8221;**\/*.jar&#8221; \/&gt;<br \/>\n&lt;\/fileset&gt;<br \/>\n&lt;\/path&gt;<\/p>\n<p>&lt;!&#8211; *************************************************************** &#8211;&gt;<br \/>\n&lt;!&#8211;\u00a0\u00a0 Loading of SVN task\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;&gt;<br \/>\n&lt;!&#8211; *************************************************************** &#8211;&gt;<br \/>\n&lt;typedef resource=&#8221;org\/tigris\/subversion\/svnant\/svnantlib.xml&#8221; classpathref=&#8221;svnant.classpath&#8221; \/&gt;<\/p>\n<p>&lt;!&#8211; *************************************************************** &#8211;&gt;<br \/>\n&lt;!&#8211; tool-availability: Determine if SVN-ANT is available.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;&gt;<br \/>\n&lt;!&#8211; *************************************************************** &#8211;&gt;<br \/>\n&lt;target name=&#8221;tool-availability&#8221;&gt;<br \/>\n&lt;available resource=&#8221;org\/tigris\/subversion\/svnant\/svnantlib.xml&#8221;<br \/>\nclasspathref=&#8221;svnant.classpath&#8221;<br \/>\nproperty=&#8221;available.svnant&#8221;<br \/>\n\/&gt;<br \/>\n&lt;echo message=&#8221;SVN-ANT is available = ${available.svnant}&#8221;\/&gt;<br \/>\n&lt;\/target&gt;<\/p>\n<p>&lt;!&#8211; **************************************************************** &#8211;&gt;<br \/>\n&lt;!&#8211; does-svnant-exist: depends on tool-availablility and\u00a0\u00a0\u00a0\u00a0 &#8211;&gt;<br \/>\n&lt;!&#8211;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 displays error message\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;&gt;<br \/>\n&lt;!&#8211; ***************************************************************** &#8211;&gt;<br \/>\n&lt;target name=&#8221;does-svnant-exist&#8221; depends=&#8221;tool-availability&#8221;&gt;<br \/>\n&lt;fail unless=&#8221;available.svnant&#8221;&gt;<br \/>\nSVN-ANT is not available, cannot perform tagging or checkout\/export svn ant task.<br \/>\n&lt;\/fail&gt;<br \/>\n&lt;\/target&gt;<\/p>\n<p>&lt;!&#8211; ****************************************************************** &#8211;&gt;<br \/>\n&lt;!&#8211; svntag: performs tagging using properties from\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;&gt;<br \/>\n&lt;!&#8211;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 build.properties and uses SVNANT tasks\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;&gt;<br \/>\n&lt;!&#8211; ******************************************************************* &#8211;&gt;<br \/>\n&lt;target name=&#8221;svntag&#8221; description=&#8221;tags individual project using svnant task&#8221;&gt;<br \/>\n&lt;property name=&#8221;svn.tag.message&#8221; value=&#8221;Tagging Project ${project.name} with tag name ${tag.name} from trunk &#8220;\/&gt;<br \/>\n&lt;property name=&#8221;src.url&#8221;\u00a0 value=&#8221;${svn.base.url}\/${project.name}\/trunk\/&#8221;\/&gt;<br \/>\n&lt;property name=&#8221;dest.url&#8221; value=&#8221;${svn.base.url}\/${project.name}\/tags\/${tag.name}&#8221;\/&gt;<\/p>\n<p>&lt;echo message=&#8221;${svn.tag.message}&#8221;\/&gt;<br \/>\n&lt;echo message=&#8221;${src.url}&#8221;\/&gt;<br \/>\n&lt;echo message=&#8221;${dest.url}&#8221;\/&gt;<\/p>\n<p>&lt;svn javahl=&#8221;${svnant.javahl}&#8221; svnkit=&#8221;${svnant.svnkit}&#8221; username=&#8221;${svn.username}&#8221; password=&#8221;${svn.password}&#8221;&gt;<br \/>\n&lt;copy srcUrl=&#8221;${src.url}&#8221; destUrl=&#8221;${dest.url}&#8221; message=&#8221;${svn.tag.message}&#8221;\/&gt;<br \/>\n&lt;\/svn&gt;<br \/>\n&lt;\/target&gt;<\/p>\n<p>&lt;!&#8211; ****************************************************************** &#8211;&gt;<br \/>\n&lt;!&#8211; svnexport: performs export using properties from\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;&gt;<br \/>\n&lt;!&#8211;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 build.properties and uses SVNANT tasks\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;&gt;<br \/>\n&lt;!&#8211; ****************************************************************** &#8211;&gt;<br \/>\n&lt;target name=&#8221;svnexport&#8221; description=&#8221;exports individual project using svnant task&#8221;&gt;<br \/>\n&lt;property name=&#8221;svn.tag.message&#8221; value=&#8221;Exporting Project ${project.name} with tag name ${tag.name}&#8221;\/&gt;<br \/>\n&lt;property name=&#8221;src.url&#8221;\u00a0 value=&#8221;${svn.base.url}\/${project.name}\/tags\/${tag.name}&#8221;\/&gt;<br \/>\n&lt;property name=&#8221;destPath&#8221; value=&#8221;${dest.path}&#8221;\/&gt;<br \/>\n&lt;echo message=&#8221;${svn.tag.message}&#8221;\/&gt;<br \/>\n&lt;svn javahl=&#8221;${svnant.javahl}&#8221; svnkit=&#8221;${svnant.svnkit}&#8221; username=&#8221;${svn.username}&#8221; password=&#8221;${svn.password}&#8221;&gt;<br \/>\n&lt;export srcUrl=&#8221;${src.url}&#8221; destPath=&#8221;${destPath}\/${project.name}&#8221;\/&gt;<br \/>\n&lt;\/svn&gt;<br \/>\n&lt;\/target&gt;<\/p>\n<p>&lt;!&#8211; ****************************************************************** &#8211;&gt;<br \/>\n&lt;!&#8211; svnbranch: creates a new branch using properties from\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;&gt;<br \/>\n&lt;!&#8211;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 build.properties and uses SVNANT tasks\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;&gt;<br \/>\n&lt;!&#8211; ****************************************************************** &#8211;&gt;<br \/>\n&lt;target name=&#8221;svnbranch&#8221; description=&#8221;creates a new branch for individual project using svnant task&#8221;&gt;<\/p>\n<p>&lt;property name=&#8221;svn.branch.message&#8221; value=&#8221;Creating new branch for<br \/>\nProject ${project.name} with new branch name ${new.branch.name} from<br \/>\ntrunk&#8221;\/&gt;<br \/>\n&lt;property name=&#8221;src.url&#8221;\u00a0 value=&#8221;${svn.base.url}\/${project.name}\/trunk\/&#8221;\/&gt;<br \/>\n&lt;property name=&#8221;dest.url&#8221; value=&#8221;${svn.base.url}\/${project.name}\/branches\/${new.branch.name}&#8221;\/&gt;<\/p>\n<p>&lt;echo message=&#8221;${svn.branch.message}&#8221;\/&gt;<br \/>\n&lt;echo message=&#8221;${src.url}&#8221;\/&gt;<br \/>\n&lt;echo message=&#8221;${dest.url}&#8221;\/&gt;<\/p>\n<p>&lt;svn javahl=&#8221;${svnant.javahl}&#8221; svnkit=&#8221;${svnant.svnkit}&#8221;<br \/>\nusername=&#8221;${svn.username}&#8221; password=&#8221;${svn.password}&#8221;&gt;<br \/>\n&lt;copy srcUrl=&#8221;${src.url}&#8221; destUrl=&#8221;${dest.url}&#8221; message=&#8221;${svn.branch.message}&#8221;\/&gt;<br \/>\n&lt;\/svn&gt;<br \/>\n&lt;\/target&gt;<\/p>\n<p><b>Link:<\/b> <a href=\"http:\/\/java.dzone.com\/articles\/how-use-svn-tasks-with-ant\" target=\"_blank\" rel=\"noopener\">http:\/\/java.dzone.com\/articles\/how-use-svn-tasks-with-ant<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post is about using ANT to perform some of the most common source-control related tasks such as export, tagging, and branching. I am using ANT version 1.7.0 and SVN Ant version 1.1-rc3, bound against Subversion 1.4.0. The related software can be downloaded here: 1.\u00a0\u00a0\u00a0 SVN Ant = http:\/\/subclipse.tigris.org\/svnant.html 2.\u00a0\u00a0\u00a0 ANT = http:\/\/ant.apache.org\/ I shall&#8230;<\/p>\n","protected":false},"author":1,"featured_media":4080,"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":[12,23],"tags":[209,3266,3113,588,1023,3264,394,395,3267,3265,3271,3262,3263,3268,3270,3269,1947,1980],"class_list":["post-146","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apache-ant","category-svnsubversion","tag-ant","tag-ant-source-control-related-tasks","tag-how-to","tag-integration","tag-software-development","tag-source-control","tag-subversion","tag-svn","tag-svn-ant","tag-svn-ant-task","tag-svn-integration-with-ant","tag-svn-tasks","tag-svn-tasks-with-ant","tag-svn-tasks-with-ant-guide","tag-svn-tasks-with-ant-reference","tag-svn-tasks-with-ant-tutorial","tag-tasks","tag-use"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/146","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=146"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/146\/revisions"}],"predecessor-version":[{"id":4081,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/146\/revisions\/4081"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/4080"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}