简体   繁体   中英

Jenkins builds - parameterized maven goals

In Jenkins I have a "parameterized build".

I click "This build is parameterized". Then add "Choice parameter":

SELECT_TARGET=install -DskipTests=true
SELECT_TARGET=install
SELECT_TARGET=clean install

in Build option - Goals and options : ${SELECT_TARGET}

Then Build With parameter, it failed with

[ERROR] Unknown lifecycle phase "${SELECT_TARGET}". You must specify a valid lifecycle phase or a goal in the format

In https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build .

Open issues

How can i pass the configured parameter to the maven execution of the build? Eg I've got a maven build and a specific profile should be given as a String parameter in the Jenkins build.

How can I make it work?

Update :

I played with Jenkins plugins and settings, I think Jenkins has a miss-configuration.

How I made it work:

  1. Use Extensible choice plugin
  2. Remove "SELECT_TARGET="
  3. use $SELECT_TARGET as Pointed out in comment.

And it worked. Thanks for the help.

To achieve this you can simply

  • tick the parameterized build flag
  • create a choice named eg SELECT_TARGET with the values you want to choose from (the first one being the default)
install
install -DskipTests=true
clean install
  • Use $SELECT_TARGET (or which ever name you have chosen) in your build goals.

There is no need for any plugins. Note that this works for every thing you want to configure - that's the target of parameterized builds

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM