jenkins the definitive guide

(Jeff_L) #1

For example, if you decide to run mvn clean install instead of mvn clean deploy for your release
jobs and switch to alternative deployment methods, such as those provided by Artifactory plugin^1 , you’ll
have no choice but to visit all relevant jobs and update them manually.


Alternatively, you could take an advantage of the fact that Jenkins is a simple and straightforward tool
that keeps all of its definitions in plain files on the disk. Indeed you can update the config.xml files
of your jobs directly in the .jenkins/jobs directory where they are kept. While this approach will
work, it is still far from ideal as it involves quite a lot of manual picking and fragile replacements in
Jenkins XML files.


There is a third way to achieve the nirvana of massive job updates: generate your configuration files
automatically using some sort of definition file. The Maven Jenkins Plugin^2 does exactly that, generating
config.xml files for all jobs using standard Maven definitions kept in a single pom.xml file.


10.5.1. Configuring a Job


When configuring a single job with the Maven Jenkins Plugin, you can define all the usual Jenkins
configuration elements, such as Maven goals, POM location, repository URLs, e-mail addresses, number
of days to keep the logs, and so on. The plugin tries to bring you as close to possible to Jenkins’ usual
way of configuring a job manually.


Let’s take a look on a Google Guice^3 build job:


<job>
<id>google-guice-trunk</id>
<description>Building Google Guice trunk.</description>
<descriptionTable>
<row>
<key>Project Page</key>
<value>
<a href="http://code.google.com/p/google-guice/">
<b><code>code.google.com/p/google-guice</code></b>
</a>
</value>
<escapeHTML>false</escapeHTML>
<bottom>false</bottom>
</row>
</descriptionTable>
<jdkName>jdk1.6.0</jdkName>
<mavenName>apache-maven-3</mavenName>
<mavenOpts>-Xmx256m -XX:MaxPermSize=128m</mavenOpts>
<daysToKeep>5</daysToKeep>
<useUpdate>false</useUpdate>
<mavenGoals>-e clean install</mavenGoals>
<trigger>
<type>timer</type>

(^1) http://wiki.jenkins-ci.org/display/JENKINS/Artifactory+Plugin
(^2) http://evgeny-goldin.com/wiki/Maven-jenkins-plugin
(^3) http://code.google.com/p/google-guice/

Free download pdf