When I make war file I decomment block 2 and comment block 1 to have the proper connection params.
Is there a solution to have 2 application.properties files and tell the graddle when making war file to choose the one for production ? Or how i should do it right ?
Here is my situatiuon, may be y can help me.
In Intelij, i have 3 application.properties resource files.
1.) application.properties with all settings except database connection. Also I have put
spring.profiles.active=@spring.profiles.active@
2.) application-dev.properties with connection for development
3.) application-prod.properties with connection for production
In Intelij, Run configuration for jmix app I have added environment variable: spring.profiles.active=dev.
When building jmix app from Intelij and run it is ok, it takes the right connection from -dev properties file.
But when i build gradle war file it doesn’t work. I have added also environment variable spring.profiles.active=prod for war gradle run configuration.
How can I tell gradle to take that =prod file when building the war file ?
In build.gradle i have added:
apply plugin: ‘war’
war {
setBaseName(‘myapp’)
setWebAppDirName(“myapp”)
setEnabled(true)
}
and added the environment variable for run configuratuin for war
The environment variable should be specified at the run time, on the target server where the WAR file is deployed to the Tomcat.
One WAR file can be used for several deployments with different profiles (dev, prod, aws, …).
good question.
I went through different solutions I found in the forum to get the .war deployment working.
On that way I added that line.
Will take it out.