Reputation: 613
Jhipster docs say you have to
mvn -Pprod package
and then you can execute the generated war with
java -jar jhipster-0.0.1-SNAPSHOT.war --spring.profiles.active=prod
you may configure the server port with
java -jar jhipster-0.0.1-SNAPSHOT.war --spring.profiles.active=prod --server.port=9000
as per the Spring Boot docs specify that command line arguments take precedence over application properties files and YAML variants.
But, when trying to run the app with maven on a different port
mvn -Pprod -Dserver.port=9000 spring-boot:run
it still reads the server.port from application-prod.yml
Upvotes: 3
Views: 7574
Reputation: 93
For me, passing the SERVER_PORT as env variable worked:
SERVER_PORT=9000 mvn spring-boot:run
Spring translates the os env variables SERVER_PORT
into spring's server.port
configuration.
Upvotes: 0
Reputation: 4681
mvn -Pprod spring-boot:run -Drun.arguments="--server.port=9000,--spring.profiles.active=prod"
Upvotes: 10