How to unpackage and repackage a WAR file

后端 未结 8 1084

I have a WAR file. I would like to open it, edit an XML file, remove some jars and then re-package it.

I used WINRAR to open the WAR file and I removed some Jars and

8条回答
  •  旧时难觅i
    2020-12-02 12:45

    Adapting from the above answers, this works for Tomcat, but can be adapted for JBoss as well or any container:

    sudo -u tomcat /opt/tomcat/bin/shutdown.sh
    cd /opt/tomcat/webapps
    sudo mkdir tmp; cd tmp
    sudo jar -xvf ../myapp.war
    #make edits...
    sudo vi WEB-INF/classes/templates/fragments/header.html
    sudo vi WEB-INF/classes/application.properties
    #end of making edits
    sudo jar -cvf myapp0.0.1.war *
    sudo cp myapp0.0.1.war ..
    cd ..
    sudo chown tomcat:tomcat myapp0.0.1.war
    sudo rm -rf tmp
    sudo -u tomcat /opt/tomcat/bin/startup.sh
    

提交回复
热议问题