inf/classes directory in war without unpacking?

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.


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.


这个怎么样....

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
链接地址: http://www.djcxy.com/p/55896.html

上一篇: 在没有运行单元测试的情况下构建Maven项目

下一篇: 战争中的inf / classes目录没有解包?