Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-50662

withMaven for declarative pipeline

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Minor Minor
    • pipeline-maven-plugin
    • None
    • Jenkins 2.204.5
      Pipeline Maven Integration Plugin 3.8.2

      For declarative pipelines, the tools can be selected on a job-basis, in the tools section, https://jenkins.io/doc/book/pipeline/syntax/#tools:

      pipeline {
        agent {
          label 'docker'
        }
        tools {
          jdk 'Oracle-JDK8-64bit' <-- JDK
          maven 'apache-maven-3.x' <-- maven
        }
      

      But there are some nice features for the withMaven as well (such as flags for reports, setting the maven repo location). It would be nice if withMaven could use what has been declared in the tools section, so it need not be redefined for each maven execution.

      [Pipeline] withMaven
      11:43:50 [withMaven] Options: [org.jenkinsci.plugins.pipeline.maven.publishers.JunitTestsPublisher[disabled=false]]
      11:43:50 [withMaven] Available options: 
      11:43:50 [withMaven] use JDK installation provided by the build agent <-- pick up from tools section
      11:43:50 [withMaven] use Maven installation 'apache-maven-3.5.x' <-- pick up from tools section
      

            Unassigned Unassigned
            davidkarlsen davidkarlsen
            Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: