如何在使用Ant/Jenkins时检出同一Java项目的不同Subversion标记/分支? [英] How can I checkout different Subversion tags/branches of the same Java project while using Ant/Jenkins?

查看:117
本文介绍了如何在使用Ant/Jenkins时检出同一Java项目的不同Subversion标记/分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的开发配置:

在Subversion下,

-我有我的project_X/trunk(以及我的最新开发者),
-我有我的project_X/tags(具有不同的发行版),
-我正在考虑添加分支文件夹.

我正在使用Jenkins使用Ant脚本来构建我的project_X/trunk. 我的Ant脚本可以完成很多事情,包括签出,编译,创建带有图形的文档,运行单元测试,执行pmd,创建jar以及压缩所有内容.

Here is my dev configuration:

Under Subversion,

- 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.

我希望能够在同一项目的标签或分支(以及主干)上使用我的Ant脚本.

最简单的方法是:

我认为这只是检查Subversion存储库正确路径的问题,对吗?

-如果我是正确的,我应该使Subversion的路径动态化.
-在我的Ant脚本中,我的Subversion路径应该是变量吗?
-如何从Jenkins的界面传递路径值?
-是否有让我将Subversion路径值从Jenkins传递到Ant脚本的插件?
-还是我应该在Jenkins中创建新工作(使用相同的脚本但使用不同的路径)?

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,

推荐答案

您应该通过标签/分支名称对构建进行参数化.最简单的方法是在Jenkins作业中添加一个参数(例如 SVN_BRANCH_DIR ),该参数的值将为trunkbranches/branch1tags/sometag.

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.

现在,如果您使用Jenkins ANT构建步骤,则该参数将作为属性自动传递到ANT脚本(通过ANT -D选项).因此,您可以在其中使用${SVN_BRANCH_DIR}(例如svn://myserver/myrepo/${SVN_BRANCH_DIR}).

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}).

这篇关于如何在使用Ant/Jenkins时检出同一Java项目的不同Subversion标记/分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆