Maven Project

The Maven Project module handles creating Maven Jenkins projects.

To create a Maven project, specify maven in the project-type attribute to the Job definition. It also requires a maven section in the Job definition.

Job Parameters:
  • root-module:
    • group-id (str): GroupId.
    • artifact-id (str): ArtifactId.
  • root-pom (str): The path to the pom.xml file. (default ‘pom.xml’)
  • goals (str): Goals to execute. (required)
  • maven-opts (str): Java options to pass to maven (aka MAVEN_OPTS)
  • maven-name (str): Installation of maven which should be used. Not setting maven-name appears to use the first maven install defined in the global jenkins config.
  • private-repository (‘str’): Whether to use a private maven repository Possible values are default, local-to-workspace and 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).
  • per-module-email (bool): Send an e-mail for each failed module (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. If settings type is ‘file’ then this is a Path. Otherwise it is the id for ConfigFileProvider. (optional)
  • settings-type (str): Type of settings file file|cfp. (default file)
  • global-settings (str): Path to custom maven global settings file. If settings type is ‘file’ then this is a Path. Otherwise it is the id for ConfigFileProvider. (optional)
  • global-settings-type (str): Type of settings file file|cfp. (default file)
  • post-step-run-condition (str): Run the post-build steps only if the build succeeds (‘SUCCESS’), build succeeds or is unstable (‘UNSTABLE’), regardless of build result (‘FAILURE’). (default ‘FAILURE’).

Requires the Jenkins Config File Provider Plugin for the Config File Provider “settings” and “global-settings” config.

Example:

project-type: maven
maven:
  root-pom: pom.xml
  goals: deploy
  root-module:
    group-id: gabba.gabba
    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

CFP Example:

project-type: maven
maven:
  root-pom: pom.xml
  goals: deploy
  settings: org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig0123456789012
  global-settings: org.jenkinsci.plugins.configfiles.maven.GlobalMavenSettingsConfig0123456789012
  post-step-run-condition: SUCCESS