DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • An Approach to Process Skewed Dataset in High Volume Distributed Data Processing
  • Apache Airflow Configuration and Tuning
  • Eight Must-Know Tips to Achieve Successful Project Management
  • Analysis of a Multithreading Test Task for Senior Software Engineer at Global Bank

Trending

  • Breaking Down Silos: The Importance of Collaboration in Solution Architecture
  • Message Construction: Enhancing Enterprise Integration Patterns
  • Bad Software Examples: How Much Can Poor Code Hurt You?
  • Modular Software Architecture: Advantages and Disadvantages of Using Monolith, Microservices and Modular Monolith

How to Use SVN Tasks with ANT

Mittal Bhiogade user avatar by
Mittal Bhiogade
·
Dec. 25, 08 · Interview
Like (0)
Save
Tweet
Share
126.43K Views

Join the DZone community and get the full member experience.

Join For Free

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. SVN Ant = http://subclipse.tigris.org/svnant.html
  2. ANT = http://ant.apache.org/

I 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:

Content of build.properties:

####START of SVN Properties ####svn.repository.url=http://xyz.com/repos/somereponamesvn.project.base.path=someprojectnamesvn.username=user name to access reposvn.password=password to access repo#This shall be name of the tag, #This property should always be updated before build starts#This property shall be used to exporttag.name=SOME_TAG_NAME_12222008#This shall be name of new branch, #this property should be used only when new branch is to be creatednew.branch.name=NEW_BRANCH_12222008####END of SVN Properties ####

Content of svn-tasks.xml:

<property file="build.properties"></property><!-- SVN and SVN-ANT Tasks properties --><property name="svn.repository.url" value="${svn.repository.url}"/><property name="svn.project.base.path" value="${svn.project.base.path}" /><property name="svn.base.url" value="${svn.repository.url}/${svn.project.base.path}"/><property name="svnant.lib.dir" location="svn-ant-lib"/><property name="svnant.javahl" value="false" /><property name="svnant.svnkit" value="true" /><!-- SVN and SVN-ANT Tasks properties --><!-- *************************************************************** --><!--   Set-Up of SVN-ANT classpath                                   --><!-- *************************************************************** -->  <path id="svnant.classpath"> <fileset dir="${svnant.lib.dir}">       <include name="**/*.jar" /> </fileset></path><!-- *************************************************************** --><!--   Loading of SVN task                                           --><!-- *************************************************************** -->  <typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.classpath" /><!-- *************************************************************** --><!-- tool-availability: Determine if SVN-ANT is available.           --><!-- *************************************************************** -->  <target name="tool-availability"> <available resource="org/tigris/subversion/svnant/svnantlib.xml"      classpathref="svnant.classpath"      property="available.svnant" />  <echo message="SVN-ANT is available = ${available.svnant}"/></target><!-- **************************************************************** --><!-- does-svnant-exist: depends on tool-availablility and     -->                   <!--                    displays error message                                   --><!-- ***************************************************************** --><target name="does-svnant-exist" depends="tool-availability"> <fail unless="available.svnant">  SVN-ANT is not available, cannot perform tagging or checkout/export svn ant task. </fail>  </target><!-- ****************************************************************** --><!-- svntag: performs tagging using properties from                              --><!--         build.properties and uses SVNANT tasks                              --><!-- ******************************************************************* --><target name="svntag" description="tags individual project using svnant task">      <property name="svn.tag.message" value="Tagging Project ${project.name} with tag name ${tag.name} from trunk "/>  <property name="src.url"  value="${svn.base.url}/${project.name}/trunk/"/>  <property name="dest.url" value="${svn.base.url}/${project.name}/tags/${tag.name}"/>  <echo message="${svn.tag.message}"/>  <echo message="${src.url}"/>  <echo message="${dest.url}"/> <svn javahl="${svnant.javahl}" svnkit="${svnant.svnkit}" username="${svn.username}" password="${svn.password}"> <copy srcUrl="${src.url}" destUrl="${dest.url}" message="${svn.tag.message}"/>     </svn> </target><!-- ****************************************************************** --><!-- svnexport: performs export using properties from                            --><!--            build.properties and uses SVNANT tasks                           --><!-- ****************************************************************** --><target name="svnexport" description="exports individual project using svnant task">      <property name="svn.tag.message" value="Exporting Project ${project.name} with tag name ${tag.name}"/>  <property name="src.url"  value="${svn.base.url}/${project.name}/tags/${tag.name}"/>  <property name="destPath" value="${dest.path}"/>  <echo message="${svn.tag.message}"/>  <svn javahl="${svnant.javahl}" svnkit="${svnant.svnkit}" username="${svn.username}" password="${svn.password}"> <export srcUrl="${src.url}" destPath="${destPath}/${project.name}"/>    </svn> </target><!-- ****************************************************************** --><!-- svnbranch: creates a new branch using properties from                       --><!--            build.properties and uses SVNANT tasks                           --><!-- ****************************************************************** --><target name="svnbranch" description="creates a new branch for individual project using svnant task">    
<property name="svn.branch.message" value="Creating new branch for
Project ${project.name} with new branch name ${new.branch.name} from
trunk"/>  <property name="src.url"  value="${svn.base.url}/${project.name}/trunk/"/>  <property name="dest.url" value="${svn.base.url}/${project.name}/branches/${new.branch.name}"/>  <echo message="${svn.branch.message}"/>  <echo message="${src.url}"/>  <echo message="${dest.url}"/> <svn javahl="${svnant.javahl}" svnkit="${svnant.svnkit}"            username="${svn.username}" password="${svn.password}"> <copy srcUrl="${src.url}" destUrl="${dest.url}" message="${svn.branch.message}"/>                        </svn> </target>
Task (computing)

Opinions expressed by DZone contributors are their own.

Related

  • An Approach to Process Skewed Dataset in High Volume Distributed Data Processing
  • Apache Airflow Configuration and Tuning
  • Eight Must-Know Tips to Achieve Successful Project Management
  • Analysis of a Multithreading Test Task for Senior Software Engineer at Global Bank

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: