1

I am developing a spring boot application in that am using application.yml configuration for Three different environment PROD/DEV/STAGE

am using maven to build as executable jar i need help in when am building

  • for DEV environment the jar name should be abc-dev.jar
  • for PROD environment the jar name should be abc-PROD.jar

am using mvn package -Dspring.profiles.active=dev

for building the application

how can i pick the application name dynamically and update in pom.xml file

Naveen Kumar
  • 106
  • 2
  • 11
  • 1
    You shouldn't do things like that. That basically means you are promoting an untested artifact to a different environment. You should build 1 artifact and promote that to the different stages. – M. Deinum Nov 24 '18 at 18:34

1 Answers1

4

Try something like this in your pom.xml

<packaging>jar</packaging> <build> <finalName>abc-${spring.profiles.active}</finalName> </build>

This should work for Maven version >= 3

Aliaksei Stadnik
  • 1,692
  • 3
  • 15
  • 32