How should I configure a Jenkins maven job that will implement the .mvn/extensions.xml?

44 views
Skip to first unread message

Adam Hardy

unread,
Oct 24, 2018, 1:48:47 PM10/24/18
to Jenkins Users
Hi, 

sorry if this is a basic question but I can't find a way to set up a Jenkins job so that it will run a maven deploy.

The simple maven job bombs because it's a yam pom and maven needs the io.takari.polyglot:polyglot-yaml extension, defined in the .mvn/extensions.xml in the repo.

I figured I'd need to set up freestyle job, but then I can't figure out whether I'd need to run a Jenkinsfile and where I should define that.

I guess I'm missing something - help appreciated!

Thanks,
Adam

Jan Monterrubio

unread,
Oct 24, 2018, 7:06:33 PM10/24/18
to jenkins...@googlegroups.com
Are you using the Freestyle Job or the Pipeline job? You mention Jenkinsfile and freestyle in the same paragraph (which at least to me is a bit confusing)

How do you run this locally? You should be able to use the same command either through the Pipeline DSL in an ‘sh “command”’ block. 

pipeline {

    agent any

    stages {

        stage('Example') {

            steps {

                sh 'mvn clean deploy'

            }

        }

    }

}


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/57535916-22d0-4cd5-b7d0-3b013b626055%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Adam Hardy

unread,
Oct 29, 2018, 7:25:39 AM10/29/18
to Jenkins Users
Thanks. I run it locally like this:

mvn clean deploy

Locally mvn can read the pom.yml because it loads the .mvn/extensions.xml in the project directory first.

It looks like the Jenkins maven functionality just can't do this, judging by your answer recommending the command line approach.

Is there anything on the horizon to add the functionality? Yaml really makes the maven pom so much more readable, I'd hate to ditch it and I'm not going to persuade other team members to change their poms over to yaml if they can't use the straight-forward Jenkins freestyle or maven job types :(

Regards
Adam
Reply all
Reply to author
Forward
0 new messages