0
votes

I have 15 jobs in Jenkins which runs through ANT build. For each project I have a separate ANT build file. The build process is same for all the 15 projects. Could any one please suggest a approach to keep a common ant build file across the project or a Jenkins configuration to do the same. Each project is there in separate repository

1
Wouldn't you want to keep the builds separate? A commit in one project should trigger a single build. You don't want to run ANT on the other 14 projects. An advanced topic is when one project depends on another. If you're using ivy for dependency management you can install a Jenkins plugin to trigger downstream builds: wiki.jenkins-ci.org/display/JENKINS/IvyTrigger+Plugin . If your ANT build does not use dependency management, you'll have to manually setup configuration in each build to trigger downstream jobs.Mark O'Connor
We have a similar problem (a common build.xml) and our solution is to create a symbolic link whenever a job is created.VirtualTroll

1 Answers

0
votes

You may use the include task.

Your build_job_1.xml:

<project name="job_1" basedir="." default="...">
  <include file="${path_to_common_build}/common_build.xml"/>
</project>

which includes a common_build.xml:

<project name="common" basedir="." default="...">
  <dirname property="common_build.dir" file="${ant.file}"/>
  <property file="${common_build.dir}/common.properties"/>
</project>