Add ability to specify mavenName for maven jobs.

Previously maven jobs did not specify a maven name so which maven
install Jenkins treated as default was used for all JJB maven jobs. Add
the ability to set a maven install explicitly so that multiple maven
installs may be used.

Change-Id: I6a26635c31c5504b855063e1d4f6fa53132f26b5
Reviewed-on: https://review.openstack.org/19756
Reviewed-by: James E. Blair <corvus@inaugust.com>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
Clark Boylan 2013-01-15 15:22:28 -08:00 committed by Jenkins
parent a11016979d
commit ff734c72dc
1 changed files with 8 additions and 1 deletions

View File

@ -20,7 +20,9 @@ attribute to the :ref:`Job` definition.
It also requires a ``maven`` section in the :ref:`Job` definition.
All of the fields below are required, except ``root-pom``, whose
default is ``pom.xml``.
default is ``pom.xml``, and ``maven-name`` which will default to being
unset. Not setting ``maven-name`` appears to use the first maven
install defined in the global jenkins config.
Example::
@ -34,6 +36,7 @@ Example::
artifact-id: example-guide
root-pom: doc/src/pom.xml
goals: "clean generate-sources"
maven-name: Maven3
"""
import xml.etree.ElementTree as XML
@ -54,6 +57,10 @@ class Maven(jenkins_jobs.modules.base.Base):
data['maven']['root-module']['artifact-id']
XML.SubElement(xml_parent, 'goals').text = data['maven']['goals']
maven_name = data['maven'].get('maven-name')
if maven_name:
XML.SubElement(xml_parent, 'mavenName').text = maven_name
XML.SubElement(xml_parent, 'rootPOM').text = \
data['maven'].get('root-pom', 'pom.xml')
XML.SubElement(xml_parent, 'aggregatorStyleBuild').text = 'true'