The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.

For a list of other such plugins, see the Pipeline Steps Reference page.

Pipeline Maven Integration Plugin

withMaven: Provide Maven environment

Configures maven environment to use within a pipeline job by calling sh mvn or bat mvn. The selected maven installation will be configured and prepended to the path.
  • globalMavenSettingsConfig : String (optional)
    Select a global maven settings element from File Config Provider. The settings element in the settings.xml file contains elements used to define values which configure Maven execution in various ways, like the pom.xml, but should not be bundled to any specific project, or distributed to an audience. These include values such as the local repository location, alternate remote repository servers, and authentication information.

    see also: settings.xml reference

  • globalMavenSettingsFilePath : String (optional)
    Specify a global maven settings.xml file. The specified path can be absolute or relative to the workspace. Shell-like environment variable expansions work in this field, by using the ${VARIABLE} syntax. The file existence is checked on the build agent, if found, that one is used. If not found it will be checked on the master. The settings element in the settings.xml file contains elements used to define values which configure Maven execution in various ways, like the pom.xml, but should not be bundled to any specific project, or distributed to an audience. These include values such as the local repository location, alternate remote repository servers, and authentication information.
    There are two locations where a settings.xml file per default may live:
    • The Maven install - default: $M2_HOME/conf/settings.xml
    • A user's install - default: ${user.home}/.m2/settings.xml
    The former settings.xml are also called global settings, the latter settings.xml are referred to as user settings. If both files exists, their contents gets merged, with the user-specific settings.xml being dominant.

    see also: settings.xml reference

  • jdk : String (optional)
    Select a JDK installation. If auto-install is enabled, the JDK will be downloaded and made available for the pipeline job.

    Note: This option does not work with docker.image('xxx').inside or container('xxx'), the preinstalled JDK on the docker image will be used.

  • maven : String (optional)
    Select a Maven installation. If auto-install is enabled, maven will be downloaded and made available for the pipeline job.

    Note: This option does not work with docker.image('xxx').inside or container('xxx'), the preinstalled maven on the docker image will be used.

  • mavenLocalRepo : String (optional)
    Specify a custom local repository path. Shell-like environment variable expansions work with this field, by using the ${VARIABLE} syntax. Normally, Jenkins uses the local Maven repository as determined by Maven, by default ~/.m2/repository and can be overridden by <localRepository> in ~/.m2/settings.xml (see Configuring your Local Repository))

    This normally means that all the jobs that are executed on the same node shares a single Maven repository. The upside of this is that you can save the disk space, the downside is that the repository is not multi process safe and having multiple builds run concurrently can corrupt it. Additionally builds could interfere with each other by sharing incorrect or partially built artifacts. For example, you might end up having builds incorrectly succeed, just because your have all the dependencies in your local repository, despite that fact that none of the repositories in POM might have them.

    By using this option, Jenkins will tell Maven to use a custom path for the build as the local Maven repository by using -Dmaven.repo.local
    If specified as a relative path then this value well be resolved against the workspace root and not the current working directory.
    ie. if .repository is specified then $WORKSPACE/.repository will be used.

    This means each job could get its own isolated Maven repository just for itself. It fixes the above problems, at the expense of additional disk space consumption.

    When using this option, consider setting up a Maven artifact manager so that you don't have to hit remote Maven repositories too often.

  • mavenOpts : String (optional)
    Specify JVM specific options needed when launching Maven as an external process, these are not maven specific options. See: Java Options

    Shell-like environment variable expansions work in this field, by using the ${VARIABLE} syntax.

  • mavenSettingsConfig : String (optional)
    Select a maven settings element from File Config Provider. The settings element in the settings.xml file contains elements used to define values which configure Maven execution in various ways, like the pom.xml, but should not be bundled to any specific project, or distributed to an audience. These include values such as the local repository location, alternate remote repository servers, and authentication information.

    see also: settings.xml reference

  • mavenSettingsFilePath : String (optional)
    Specify a maven settings.xml file. The specified path can be absolute or relative to the workspace. Shell-like environment variable expansions work in this field, by using the ${VARIABLE} syntax. The file existence is checked on the build agent, if found, that one is used. If not found it will be checked on the master. The settings element in the settings.xml file contains elements used to define values which configure Maven execution in various ways, like the pom.xml, but should not be bundled to any specific project, or distributed to an audience. These include values such as the local repository location, alternate remote repository servers, and authentication information.
    There are two locations where a settings.xml file per default may live:
    • The Maven install - default: $M2_HOME/conf/settings.xml
    • A user's install - default: ${user.home}/.m2/settings.xml
    The former settings.xml are also called global settings, the latter settings.xml are referred to as user settings. If both files exists, their contents gets merged, with the user-specific settings.xml being dominant.

    see also: settings.xml reference

  • options (optional)
      Array / List of Nested Choice of Objects
    • concordionPublisher
      Publish Concordion reports, if found, regarding the given pattern.
      Test results are by default published if the Jenkins HTMLPublisher Plugin is installed.
      • disabled : boolean (optional)
        Skip the publishing of tests reports.
    • dependenciesFingerprintPublisher
      Fingerprint the Maven dependencies used by the maven project.
      • disabled : boolean (optional)
        Skip the fingerprinting of the dependencies of the maven project.
      • includeReleaseVersions : boolean (optional)
      • includeScopeCompile : boolean (optional)
      • includeScopeProvided : boolean (optional)
      • includeScopeRuntime : boolean (optional)
      • includeScopeTest : boolean (optional)
      • includeSnapshotVersions : boolean (optional)
    • findbugsPublisher
      Publish FindBugs reports generated by "org.codehaus.mojo:findbugs-maven-plugin:findbugs".
      FindBugs results are by default published if the Jenkins FindBugs Plugin is installed.
      • disabled : boolean (optional)
        Skip the publishing of findbugs reports.
      • healthy : String (optional)
      • thresholdLimit : String (optional)
      • unHealthy : String (optional)
    • artifactsPublisher
      Archive and fingerprint the artifact and the attached artifacts generated by the maven project.
      • archiveFilesDisabled : boolean (optional)
      • disabled : boolean (optional)
        Skip the archiving and the fingerprinting of generated artifacts.
      • fingerprintFilesDisabled : boolean (optional)
    • invokerPublisher
      Publish Invoker reports generated by "org.apache.maven.plugins:maven-invoker-plugin:run".
      Invoker results are by default published if the Jenkins Maven Invoker Plugin is installed.
      • disabled : boolean (optional)
        Skip the publishing of invoker reports.
    • jgivenPublisher
      Publish JGiven reports, if found.
      Test results are by default published if the Jenkins JGiven Plugin is installed.
      • disabled : boolean (optional)
        Skip the publishing of tests reports.
    • jacocoPublisher
      Publish JaCoCo Java Code Coverage Library reports, if found.
      Test results are by default published if the Jenkins JaCoCo Plugin is installed.
      • disabled : boolean (optional)
        Skip the publishing of JaCoCo reports.
    • junitPublisher
      Publish tests reports generated by "maven-surefire-plugin:test" or by "maven-failsafe-plugin:integration-test".
      Test results are by default published if the Jenkins JUnit Plugin is installed.
      • disabled : boolean (optional)
        Skip the publishing of tests reports.
      • healthScaleFactor : double (optional)
        The amplification factor to apply to test failures when computing the test result contribution to the build health score.
        The default factor is 1.0
        • A factor of 0.0 will disable the test result contribution to build health score.
        • A factor of 0.1 means that 10% of tests failing will score 99% health
        • A factor of 0.5 means that 10% of tests failing will score 95% health
        • A factor of 1.0 means that 10% of tests failing will score 90% health
        • A factor of 2.0 means that 10% of tests failing will score 80% health
        • A factor of 2.5 means that 10% of tests failing will score 75% health
        • A factor of 5.0 means that 10% of tests failing will score 50% health
        • A factor of 10.0 means that 10% of tests failing will score 0% health
        The factor is persisted with the build results, so changes will only be reflected in new builds.
      • ignoreAttachments : boolean (optional)
        Skip the publishing of tests reports attachments.
        Test result attachments are by default published if the Jenkins JUnit Attachments Plugin is installed.
      • keepLongStdio : boolean (optional)
        If checked, any standard output or error from a test suite will be retained in the test results after the build completes. (This refers only to additional messages printed to console, not to a failure stack trace.) Such output is always kept if the test failed, but by default lengthy output from passing tests is truncated to save space. Check this option if you need to see every log message from even passing tests, but beware that Jenkins's memory consumption can substantially increase as a result, even if you never look at the test results!
    • mavenLinkerPublisher
      This publisher generates and publishes the links (url) of deployed Maven artifacts.
      • disabled : boolean (optional)
        Skip generating and publishing the links.
    • pipelineGraphPublisher
      Build a graph of pipelines based on their Maven dependencies and on the Maven artifacts they generate.
      • disabled : boolean (optional)
        Skip the depedencies graph computing of the maven project, and triggering of dependent pipelines.
      • ignoreUpstreamTriggers : boolean (optional)
      • includeReleaseVersions : boolean (optional)
      • includeScopeCompile : boolean (optional)
      • includeScopeProvided : boolean (optional)
      • includeScopeRuntime : boolean (optional)
      • includeScopeTest : boolean (optional)
      • includeSnapshotVersions : boolean (optional)
      • lifecycleThreshold : String (optional)

        Threshold to trigger downstream pipelines based on the Maven lifecycle phase successfully reached during the Maven execution.

        If "install" is selected then downstream pipelines will be triggered for "mvn clean install", "mvn clean deploy" but NOT "mvn clean verify" or "mvn clean package".

        Example

        Configure a Jenkins Multibranch Pipeline with

        • Threshold: "deploy"
        • execution of "mvn clean deploy" on branches (incl. master) and execution of "mvn clean verify on pull requests
        So that:
        • The builds of branches (incl. "master") would upload the generated jar/war file to your enterprise Maven repository and would trigger downstream pipelines
        • The builds of pull request would only build the package but NOT upload the generated jar/war file to your enterprise Maven repository and would NOT trigger downstream pipelines

      • skipDownstreamTriggers : boolean (optional)
    • spotbugsPublisher
      Publish SpotBugs reports generated by "com.github.spotbugs:spotbugs-maven-plugin:spotbugs".
      SpotBugs results are by default published if the Jenkins FindBugs Plugin is installed.
      • disabled : boolean (optional)
        Skip the publishing of SpotBugs reports.
      • healthy : String (optional)
      • thresholdLimit : String (optional)
      • unHealthy : String (optional)
    • openTasksPublisher
      Publish Open Task Scanner reports.
      Open Task Scanner reports are by default published if the Jenkins Task Scanner Plugin is installed.
      The default setup is to look in Java source code for "FIXME" comments as high priority tasks and for "TODO" comments as normal priority tasks.
      • asRegexp : boolean (optional)
        Use task identifiers as regular expressions.
      • disabled : boolean (optional)
        Skip the publishing of Task Scanner reports.
      • excludePattern : String (optional)
        Ant style pattern of exclude source code.
      • healthy : String (optional)
      • highPriorityTaskIdentifiers : String (optional)
        Coma separated list of high priority task identifiers.
      • ignoreCase : boolean (optional)
        Ignore case when scanning task identifiers.
      • lowPriorityTaskIdentifiers : String (optional)
        Coma separated list of low priority task identifiers.
      • normalPriorityTaskIdentifiers : String (optional)
        Coma separated list of normal priority task identifiers.
      • pattern : String (optional)
        Ant style pattern of the source code to scan for task identifiers.
      • thresholdLimit : String (optional)
      • unHealthy : String (optional)
  • publisherStrategy (optional)
    IMPLICIT All Maven publishers are implicitly enabled and used, even if they are not configured in "withMaven(options:...)".
    EXPLICIT Only the Maven publishers explicitly configured in "withMaven(options:...)" are used.
    • Values: IMPLICIT, EXPLICIT
  • tempBinDir : String (optional)
    Specify a custom temporary binaries directory. Allow to have a constant path to the maven binaries, then a constant environment for reproducible compilations. Some tools detect an environment change as a sources change, which will retrigger the compilation of all sources.
  • traceability : boolean (optional)
    Should additional information be added to the script execution.

    Note: This option adds --show-version to the maven execution and marks the beginning of the maven wrapper script with ----- withMaven Wrapper script -----.


Was this page helpful?

Please submit your feedback about this page through this quick form.

Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?

    


See existing feedback here.