The usual development is that we deploy the project through the IDE, but sometimes we have to deploy it manually (for example, on the server).
Manual deployment is divided into the following steps:
1th Step: use Maven to fight the war package (if the resulting war package is named: Appkit-web.war)
MVN Package
If you want to skip the test during the packaging process, use the following command:
MVN package-dmaven.test.skip=ture
2nd Step:Copy the war package to the Tomcat-installed WebApps directory
CP Target/appkit-web.war ~/software/apache-tomcat-7.0.54/webapps/
3rd Step: Start Tomcat (The root directory of my tomcat is:/users/aborn/software/apache-tomcat-7.0.54)
./bin/catalina.sh Run
Then open the http://localhost:8080/appkit-web/index.html in the browser
Here is a problem, it is the default root directory is to add the project name, such as the Appkit-web, so that some resource files are not loaded (because the resource file is the root directory as a relative path).
To modify this root directory, just modify the Tomcat server.xml configuration file (it's in conf/server.xml)
Add the following phrase between <Host> and </Host>
<context path= "/" docbase= "Appkit-web" debug= "0" privileged= "true"/>
This configuration is
PathRefers to
root directory, docbase refers to the war name
So just open it on the browser: http://localhost:8080/index.html on the line.
Tomcat 7 How to manually deploy the corresponding Java project for the war package