user3796703
user3796703

Reputation: 189

Production mode not enabled in Jhipster Application

I am using Jhipster to develop a Spring application.

When I need to deploy, I use mvn -Pprod package. This command generates 2 War files: xxx.war and xxx.original.war. I deploy the xxx.original War file in a local Tomcat.

Although I am convinced this is the right procedure, the application is still behaving as when the DEV profile is used.

Is the production mode supported or not ?

Upvotes: 3

Views: 2465

Answers (3)

ayman
ayman

Reputation: 11

Use this command to package:

./mvnw -Pprod -Dspring.profiles.active=prod package

Upvotes: 0

Chucky
Chucky

Reputation: 543

Production mode is supported by Jhipster, it is the procedure detailed above which is simply not complete.

Reason

The -Pprod argument is used to profile the build for production mode, but it does not tell Tomcat to actually enable that mode so it falls back to the default `dev' mode.

Solution

As explained in Jhipster on-line documentation, to enable production mode, simply add -Dspring.profiles.active=prod to your JAVA_OPTS. You may achieve this by editing your <tomcat-home>/bin/setenv.sh / .bat file, for instance.

Upvotes: 7

Narendra N
Narendra N

Reputation: 1270

You can add the following in conf/catalina.properties

spring.profiles.active=prod

for tomcat to have the prod profile picked.

if no profile is provided - JHipster picks the default profile - which is dev.

You can take a look at ApplicationWebXml.java, Application.java to see that, dev profile is made default.

One more change we have done to avoid any issues is

  1. Set prod as default profile in master

  2. Keep dev as default profile in develop branch (where active development happens)

Upvotes: 2

Related Questions