Improvements in the Maven Plugin.

Adding the ability to configure the following checkboxes -
* Incremental build - only build changed modules
* Disable automatic site documentation artifact archiving
* Disable automatic fingerprinting of consumed and produced artifacts
* Build modules in parallel
* Resolve Dependencies during Pom parsing
* Run Headless
* Process plugins during pom parsing
* Use custom workspace

Change-Id: Ie379e8812175a5b2dcb68546520994e9ce04d66a
This commit is contained in:
Somay Jain 2015-05-26 00:55:56 +05:30
parent 9ecafdc284
commit d09f6d5ec0
5 changed files with 53 additions and 11 deletions

View File

@ -35,8 +35,23 @@ in the :ref:`Job` definition.
`local-to-executor`.
* **ignore-upstream-changes** (`bool`): Do not start a build whenever
a SNAPSHOT dependency is built or not. (default true)
* **incremental-build** (`bool`): Activate incremental build - only build
changed modules (default false).
* **automatic-archiving** (`bool`): Activate automatic artifact archiving
(default true).
* **automatic-site-archiving** (`bool`): Activate automatic site
documentation artifact archiving (default true).
* **automatic-fingerprinting** (`bool`): Activate automatic fingerprinting
of consumed and produced artifacts (default true).
* **parallel-build-modules** (`bool`): Build modules in parallel
(default false)
* **resolve-dependencies** (`bool`): Resolve Dependencies during Pom
parsing (default false).
* **run-headless** (`bool`): Run headless (default false).
* **process-plugins** (`bool`): Process Plugins during Pom parsing
(default false).
* **custom-workspace** (`str`): Path to the custom workspace. If no path is
provided, custom workspace is not used. (optional)
* **settings** (`str`): Path to custom maven settings file.
It is possible to provide a ConfigFileProvider settings file as well
see CFP Example below. (optional)
@ -111,15 +126,27 @@ class Maven(jenkins_jobs.modules.base.Base):
XML.SubElement(xml_parent, 'rootPOM').text = \
data['maven'].get('root-pom', 'pom.xml')
XML.SubElement(xml_parent, 'aggregatorStyleBuild').text = 'true'
XML.SubElement(xml_parent, 'incrementalBuild').text = 'false'
XML.SubElement(xml_parent, 'aggregatorStyleBuild').text = str(
not data['maven'].get('parallel-build-modules', False)).lower()
XML.SubElement(xml_parent, 'incrementalBuild').text = str(
data['maven'].get('incremental-build', False)).lower()
XML.SubElement(xml_parent, 'siteArchivingDisabled').text = str(
not data['maven'].get('automatic-site-archiving', True)).lower()
XML.SubElement(xml_parent, 'fingerprintingDisabled').text = str(
not data['maven'].get('automatic-fingerprinting', True)).lower()
XML.SubElement(xml_parent, 'perModuleEmail').text = 'true'
XML.SubElement(xml_parent, 'archivingDisabled').text = str(
not data['maven'].get('automatic-archiving', True)).lower()
XML.SubElement(xml_parent, 'resolveDependencies').text = 'false'
XML.SubElement(xml_parent, 'processPlugins').text = 'false'
XML.SubElement(xml_parent, 'resolveDependencies').text = str(
data['maven'].get('resolve-dependencies', False)).lower()
XML.SubElement(xml_parent, 'processPlugins').text = str(
data['maven'].get('process-plugins', False)).lower()
XML.SubElement(xml_parent, 'mavenValidationLevel').text = '-1'
XML.SubElement(xml_parent, 'runHeadless').text = 'false'
XML.SubElement(xml_parent, 'runHeadless').text = str(
data['maven'].get('run-headless', False)).lower()
if 'custom-workspace' in data['maven']:
XML.SubElement(xml_parent, 'customWorkspace').text = str(
data['maven'].get('custom-workspace'))
config_file_provider_settings(xml_parent, data['maven'])
run_post_steps = XML.SubElement(xml_parent, 'runPostStepsIfResult')

View File

@ -7,14 +7,17 @@
<goals>deploy</goals>
<ignoreUpstremChanges>true</ignoreUpstremChanges>
<rootPOM>pom.xml</rootPOM>
<aggregatorStyleBuild>true</aggregatorStyleBuild>
<incrementalBuild>false</incrementalBuild>
<aggregatorStyleBuild>false</aggregatorStyleBuild>
<incrementalBuild>true</incrementalBuild>
<siteArchivingDisabled>true</siteArchivingDisabled>
<fingerprintingDisabled>false</fingerprintingDisabled>
<perModuleEmail>true</perModuleEmail>
<archivingDisabled>false</archivingDisabled>
<resolveDependencies>false</resolveDependencies>
<processPlugins>false</processPlugins>
<archivingDisabled>true</archivingDisabled>
<resolveDependencies>true</resolveDependencies>
<processPlugins>true</processPlugins>
<mavenValidationLevel>-1</mavenValidationLevel>
<runHeadless>false</runHeadless>
<runHeadless>true</runHeadless>
<customWorkspace>path/to/some/repository</customWorkspace>
<settings class="jenkins.mvn.FilePathSettingsProvider">
<path>test</path>
</settings>

View File

@ -7,3 +7,11 @@ maven:
artifact-id: hey
settings: test
global-settings: test
incremental-build: true
automatic-archiving: false
automatic-site-archiving: false
parallel-build-modules: true
resolve-dependencies: true
process-plugins: true
run-headless: true
custom-workspace: path/to/some/repository

View File

@ -6,6 +6,8 @@
<rootPOM>pom.xml</rootPOM>
<aggregatorStyleBuild>true</aggregatorStyleBuild>
<incrementalBuild>false</incrementalBuild>
<siteArchivingDisabled>false</siteArchivingDisabled>
<fingerprintingDisabled>false</fingerprintingDisabled>
<perModuleEmail>true</perModuleEmail>
<archivingDisabled>false</archivingDisabled>
<resolveDependencies>false</resolveDependencies>

View File

@ -5,6 +5,8 @@
<rootPOM>pom.xml</rootPOM>
<aggregatorStyleBuild>true</aggregatorStyleBuild>
<incrementalBuild>false</incrementalBuild>
<siteArchivingDisabled>false</siteArchivingDisabled>
<fingerprintingDisabled>false</fingerprintingDisabled>
<perModuleEmail>true</perModuleEmail>
<archivingDisabled>false</archivingDisabled>
<resolveDependencies>false</resolveDependencies>