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

Here is my dev configuration:

Under Subversion,

- I have project_X / trunk (with my last developer),
- I have my project_X / tags (with different versions),
- I'm going to add a branch folder.

I am using Jenkins to create a project_X / trunk project using an Ant script. My Ant script does a lot of things, it checks, compiles, creates documentation with graphs, runs unit tests, runs pmd, creates a jar and fastens everything.

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

The easiest way to do this:

I think it's just a matter of checking the correct path to the Subversion repository, right?

- If I'm right, I have to make a path to Subversion dynamics.
- In my Ant script, should my Subversion path be a variable?
- How to transfer the path value from the Jenkins interface?
- Is there a plugin that allows me to pass the value of the Subversion path from Jenkins to Ant script?
- Or do I just need to create a new job in Jenkins (with the same script, but with a different path)?

Hope

Thanks in advance for your help,
Best wishes,

+4
source share
2 answers

You must parameterize your assembly by tag / branch name. The easiest way to do this is to add a parameter (e.g. SVN_BRANCH_DIR) to your Jenkins job, which will have values ​​like trunk , branches/branch1 , tags/sometag .

Now, if you use the Jenkins ANT build step, this parameter will be automatically passed to your ANT script as a property (via the ANT -D option). Thus, you can use ${SVN_BRANCH_DIR} in it (for example, svn://myserver/myrepo/${SVN_BRANCH_DIR} ).

+5
source

Jenkins Subversion Plugin provides a “Subversion tag parameter (and more)” with a version parameter of 1.24 (March 22, 2011).

Literally

When used, this option displays the field at build time so that the user can select a Subversion tag from which to create a working copy for this project. After setting the two “Name and Storage Address” fields, you must (1) ensure that the job uses Subversion and (2) specify the Subversion repository URL field by combining the two fields of this parameter. For example, if the Name parameter is set to SVN_TAG, and the repository URL is set to https://svn.jenkins-ci.org/tags , then the Subversion repository URL should be set to https: //svn.jenkins- ci.org/tags/ $ SVN_TAG. Please note that the repository URL field can be set in the root of the Subversion repository, and not just point to the tag directory (i.e. you can install it in https://svn.jenkins-ci.org and not https: // svn.jenkins-ci.org/tags ). In this case, if this root of the repository contains folders of connecting lines, branches, and tags, a drop-down list will allow the user to select a connecting line, branch, or tag.

To automatically build integration, you can use the default value of the trunk parameter.

Hope this helps.

+3
source

All Articles