Fuji
Fuji

Reputation: 45

Set up Jenkins to run a specific maven command

I’m new to Jenkins and currently working on a maven project.

I am able to run a simple Jenkins job using maven commands.

mvn clean install

However, the extended requirement requires me to us an additional parameter in the maven command

mvn clean install -DfileName=file1

Is it possible to have a drop down with file names (e.g. file1, file2 ..) and have the user selected one append to the maven command.

mvn clean install -DfileName = {selected filename from dropdown}.

Could some one please assist with this along with what plugin and how can I setup.

Upvotes: 0

Views: 5142

Answers (1)

ben5556
ben5556

Reputation: 3018

Parameterize your jenkins job see https://wiki.jenkins.io/plugins/servlet/mobile?contentId=34930782#content/view/34930782.

Use choice parameter to add your file name choices

Active Choices Plugin - https://wiki.jenkins.io/display/JENKINS/Active+Choices+Plugin

The user selected choice can be used in your maven command using "{params.param_name}".

Upvotes: 4

Related Questions