Search code examples
mavenjenkinspom.xml

Jenkins choice parameter with different display


I want to add a choice parameter to a Jenkins job. The list is fixed, but I want the dropbox to display custom value, and not the actual ones (analogous to name of a web page and not its URL).

In the certain case this is the path of the pom.xml file, however, I want to display the module name instead of the full path. An example:

Actual value                         | What I want to be displayed
-------------------------------------|----------------------------
full/path/to/my/modules/pom.xml      | All modules
full/path/to/my/modules/util/pom.xml | Utilities
full/path/to/my/modules/data/pom.xml | Data handling

Thanks for the help in advance!


Solution

  • You can do this with the Extended Choice Parameter plugin.

    To set it the way you want, under "This build is parameterized", choose Extended Choice Parameter, and set it up like this:

    enter image description here

    Note it may look a little different depending on what version of Jenkins you have but it shouldn't be too different (this screenshot was on 2.0-beta-2).