Merge "Adding Maven3 Builder Targets"

This commit is contained in:
Jenkins 2015-06-16 10:10:32 +00:00 committed by Gerrit Code Review
commit 08cc053fd3
4 changed files with 52 additions and 0 deletions

View File

@ -1101,6 +1101,41 @@ def conditional_step(parser, xml_parent, data):
build_step(steps_parent, step)
def maven_builder(parser, xml_parent, data):
"""yaml: maven-builder
Execute Maven3 builder
:arg str name: Name of maven installation from the configuration
:arg str pom: Location of pom.xml (default 'pom.xml')
:arg str goals: Goals to execute
:arg str maven-opts: Additional options for maven (optional)
Requires the Jenkins `Artifactory Plugin
<https://wiki.jenkins-ci.org/display/JENKINS/Artifactory+Plugin>`_
allows your build jobs to deploy artifacts automatically to Artifactory.
Example:
.. literalinclude:: /../../tests/builders/fixtures/maven-builder001.yaml
:language: yaml
"""
maven = XML.SubElement(xml_parent, 'org.jfrog.hudson.maven3.Maven3Builder')
required = {
'mavenName': 'name',
'goals': 'goals',
}
for key in required:
try:
XML.SubElement(maven, key).text = data[required[key]]
except KeyError:
raise MissingAttributeError(required[key])
XML.SubElement(maven, 'rootPom').text = data.get('pom', 'pom.xml')
XML.SubElement(maven, 'mavenOpts').text = data.get('maven-opts', '')
def maven_target(parser, xml_parent, data):
"""yaml: maven-target
Execute top-level Maven targets

View File

@ -63,6 +63,7 @@ jenkins_jobs.builders =
groovy=jenkins_jobs.modules.builders:groovy
inject=jenkins_jobs.modules.builders:inject
managed-script=jenkins_jobs.modules.builders:managed_script
maven-builder=jenkins_jobs.modules.builders:maven_builder
maven-target=jenkins_jobs.modules.builders:maven_target
msbuild=jenkins_jobs.modules.builders:msbuild
multijob=jenkins_jobs.modules.builders:multijob

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<builders>
<org.jfrog.hudson.maven3.Maven3Builder>
<mavenName>mvn3</mavenName>
<goals>clean install</goals>
<rootPom>modules/pom.xml</rootPom>
<mavenOpts/>
</org.jfrog.hudson.maven3.Maven3Builder>
</builders>
</project>

View File

@ -0,0 +1,5 @@
builders:
- maven-builder:
name: mvn3
pom: modules/pom.xml
goals: clean install