https://javaadventure.blogspot.ie/2013/11/jenkins-maven-job-type-considered-evil.html
is the message from your friendly neighbourhood Apache Maven PMC member and
Jenkins committer!

Two options:
1. (oldschool) Freestyle Job with a Maven build step
2. (coolkids) Multibranch Pipeline Job with a Jenkinsfile in the
repository... At present the Jenkinsfile will have to invoke Maven via a
shell/batch step... which gets a tad ugly

node() {
  withMaven(...) {
  if (isUnix()) {
    sh 'mvn clean verify'
  } else {
    bat 'mvn clean verify'
  }
  junit '**/target/surefire-reports/*.xml, **/target/failsafe-reports/*.xml'
  // plus whatever else you are having yourself
  }
}

There is a dedicated `mvn` step in the works... not here yet... and there
is a newer better syntax for Jenkinsfile in progress:
https://github.com/jenkinsci/pipeline-model-definition-plugin

So hopefully, you'll soon be able to do

pipeline {
  agent label:'linux'
  stages {
    stage('Build') {
      // the syntax to specify the Maven tool version is still in progress
      steps {
        mvn 'clean verify'
        // remains to be seen if the `mvn` step will auto-junit
      }
    }
  }
  notifications {
    always {
      mail ...
    }
  }
}

On 13 October 2016 at 14:59, Benson Margulies <bimargul...@gmail.com> wrote:

> We've about had it with bamboo, and are dusting off our old Jenkins
> instance.
>
> I recall some messages here about things _not_ to do with Jenkins and
> Maven. Do we avoid the 'maven build type' altogether and just run
> Maven from the shell, or is my memory faulty? Anything else.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

Reply via email to