0

here is the structure of my war file.

MyApp.war
      WEB-INF
          classes/com/info/App.java
          classes/application.properties
          lib/
      META-INF
      test  

just before deployment of this war to tomcat, Ops team will need to update the application.properties file.

I prefer not to explode. but just to update the war and leave for tomcat to explode during start up

I tried this

jar uvf MyApp.war /var/data/prod/application.properties

After I executed this command, I see a new file being added at root level of MyApp.war. but I want WEB-INF/classes/application.properties to be replaced this one. How can I do it.

brain storm
  • 25,842
  • 54
  • 187
  • 349

2 Answers2

1

How about this....

mkdir -p /tmp/MyApp.war/WEB-INF/classes
cp  /var/data/prod/application.properties /tmp/MyApp.war/WEB-INF/classes
jar -uvf MyApp.war -C /tmp/MyApp.war WEB-INF
rm -rf /tmp/MyApp.war
Carlitos Way
  • 2,659
  • 16
  • 28
1

I don't believe that it is the good approach anyway, you should externalize your configuration file as it will change from one env to another, so it should not be part of your archive. You should adapt your code to be able to read the configuration of your application from an external folder. Your Ops team will then have the same war to deploy on all env instead of one per env, which is much less error prone.

Nicolas Filotto
  • 39,066
  • 11
  • 82
  • 105