How to deploy war file to tomcat using command prompt?

后端 未结 8 803
慢半拍i
慢半拍i 2021-01-30 11:05

I have created a war file and put into tomcat/webapps. How to deploy a war file to tomcat using command prompt?

8条回答
  •  盖世英雄少女心
    2021-01-30 11:43

    The earlier answers on this page are correct that you can copy/move the WAR file into place and restart tomcat, but they omit to mention something: you must remove the previously exploded assets (from the previously deployed WAR file) if any are present.

    # My tomcat webapps are found at /var/lib/tomcat6/webapps
    # The application I wish to deploy is the main (ROOT) application
    webapps_dir=/var/lib/tomcat6/webapps
    # Remove existing assets (if any)
    rm -rf $webapps_dir/ROOT
    # Copy WAR file into place
    cp example_dir/ROOT.war $webapps_dir
    # Restart tomcat
    service tomcat6 restart
    

    Modify the following for your own system:

    • Path of your compiled WAR file (to be deployed)
    • Path of your tomcat webapps files
    • How to restart tomcat (i.e. if not installed as a service)

提交回复
热议问题