After the <build> tag, add
<finalName>${project.artifactId}-${lane}</finalName>
And set the env variable "lane" to the profile name, for example.
mvn -P DEV -Dlane = DEV etc.
Or you can be a little more creative and discover an active profile identifier as described here Maven - Can I refer to a profile identifier in a profile definition?
EDIT ------
If you want to avoid redundant arguments.
Why not invoke the appropriate profiles using env. property.
so on the command line
mvn -Dlane=DEV|STAGE|PROD
and in pom
<profile> <id>DEV</id> <activation> <property> <name>lane</name> <value>DEV</value> </property> </activation> <build> // rest of the profile </profile>
And the same for STAGE and PROD profiles.
user507484
source share