Tomcat 7 How to manually deploy the corresponding Java project for the war package

Source: Internet
Author: User
Tags tomcat server

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.