I am trying to setup a Jenkins pipeline to trigger builds using gradle for multiple environments.My requirement is that the artifacts produced when I run gradlew clean build within my Jenkins pipeline it should produce artifacts with name indicating the environment for which the pipeline was run. Example my-application-dev.jar
Currently when I run build it produces artifacts from the name of the directory containing the project.
The value of the environment would be selected by the user when build will be triggered from Jenkins. What is the optimal way to achieve this ? Does build allow to configure any such property via command line or do I need to define a task in my build.gradle and define properties within that task for which I will pass value from command line