How can I checkout different Subversion tags/branches of the same Java project while using Ant/Jenkins?

Here is my dev configuration:

Under Subversion,

  • How to do a pre-checkout with Git
  • Git checkout revision of local repository
  • GIT: When checking out an alternative branch, I want to clear ignored files
  • Active Git branch is “(no branch)” on hudson CI
  • Check git current file version and how to handle removed files
  • LibGit2Sharp CheckoutPaths()
  • – I have my project_X/trunk (with my latest dev),
    – I have my project_X/tags (with different releases),
    – I am thinking of adding a branch folder.

    I am using Jenkins to build my project_X/trunk using an Ant script.
    My Ant script does many things, it checks-out, compiles, creates the documentation with graphs, runs the unit tests, performs pmd, creates a jar and zips everything.

    I would like to be able to use my Ant script on tags or branches (as well as the trunk) for the same Project.

    What’s the easiest way to do this:

    I think it is just a question of checking out the right path to the Subversion repository, Right?

    – If I am correct, I should make the path to the Subversion dynamic.
    – In my Ant script should my Subversion path be a variable?
    – How do I pass the path value from Jenkins’ interface?
    – Is there a plugin that lets me pass the Subversion path value from Jenkins to the Ant script?
    – Or should I just create a new job in Jenkins (with the same script but different path)?


    Thanks in advance for your help,
    Best regards,

  • Validating Jenkins plugin forms with Ruby
  • Jenkins Email-ext plugin - tokens
  • Error trying to run mstest on jenkins
  • How to process a github webhook payload in Jenkins?
  • Hudson hangs on “Started by user anonymous”
  • The Git Repositories tab from eclipse it's empty
  • 2 Solutions collect form web for “How can I checkout different Subversion tags/branches of the same Java project while using Ant/Jenkins?”

    You should parameterize your build by tag/branch name. The easiest way to do it is to add a parameter (say, SVN_BRANCH_DIR) to your Jenkins job which will have values such as trunk, branches/branch1, tags/sometag.

    Now, if you use Jenkins ANT build step that parameter will be passed automatically to your ANT script as a property (by way of ANT -D option). So you can use ${SVN_BRANCH_DIR} in it (e.g. svn://myserver/myrepo/${SVN_BRANCH_DIR}).

    Jenkins Subversion Plugin provides a “List subversion tags (and more)” project parameter since Version 1.24 (Mar 22, 2011).


    When used, this parameter will display a field at build-time so that the user is able to select a Subversion tag from which to create the working copy for this project.
    Once the two fields Name and Repository URL are set, you must (1) ensure the job uses Subversion and (2) set the Repository URL field of Subversion by concatenating the two fields of this parameter. For instance, if Name is set to SVN_TAG and Repository URL is set to, then Subversion’s Repository URL must be set to$SVN_TAG.
    Notice that you can set the Repository URL field to a Subversion repository root rather than just pointing to a tags dir (ie, you can set it to rather than In that case, if this repository root contains the trunk, branches and tags folders, then the dropdown will allow the user to pick the trunk, or a branch, or a tag.

    For unattended integration builds you could use the default “trunk” parameter value.

    I hope this helps.

    Git Baby is a git and github fan, let's start git clone.