Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.



This plugin provides integration with Pipeline, 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.

It allows the use of various parameter to properly configure maven.

An example pipeline script using the plugin would be:

Code Block
   // Mark the code checkout 'stage'....
   stage 'Checkout'

   // Get some code from a GitHub repository
   git url: ''

   // Mark the code build
   stage 'Build'

   withMaven(mavenInstallation: 'M3', mavenLocalRepo: '.repository', mavenSettingsConfig: 'maven-settings-for-gameoflife') {
    // Run the maven build
    sh "mvn clean install"

In the above example the following parameters are use to configure maven:

  • mavenInstallation: 'M3' Maven Installation will be used, this installation has to be declared in the Global Jenkins configuration or Tool installations page. 
  • mavenLocalRepo: a local repository folder is specified to avoid shared repositories
  • mavenSettingsConfig: specifies an specific settings.xml configuration from File Configuration Provider plugin, allowing the replacement of variables and credentials.