Create a MAVEN Web project with idea

Source: Internet
Author: User
Tags tomcat tomcat server

Although there was a spring framework practice in the previous internship, it was basically tinkering on the basis of what was already done and did not have a deep understanding of the spring framework. So from today onwards, start learning about the spring framework from scratch. Before you do this, the first step is to create a Web project.

Description: Bloggers Here use IntelliJ idea, MAVEN, Tomcat as a development tool. For installation and configuration of related applications, please refer to the online tutorials. The following is a graphical step demonstration.


Open idea, view the top left toolbar, and click File->new->project. A window pops up, and Maven is selected in the left column, and a column of archetype appears on the right after a period of time is loaded. Tick create from Archtype, locate and select Org.apache.maven.archtypes:maven-archtype-webapp, and click Next.



Second, fill in the groupid,artifactid,version information for this MAVEN project. This is the three-dimensional coordinate that identifies the MAVEN project. Click Next



Third, this step is crucial. Above is the location of the MAVEN root directory, the settings.xml file, and the local repository, which do not need to be ignored and the path varies from person to person. Here are some properties, except for the existing 6, we need to add a archetypecatalog=internal. The implication of this parameter is that the skeleton of this MAVEN project is not to be remotely downloaded but locally acquired. If you do not add this parameter, then project creation may be stuck in downloading Maven plugins ... Continue to click Next



Four, for the project name, click Finish, the project was created in a moment.



Five, look at the structure of the project, you can find that the Web application has already had. Now that the MAVEN Web project has been created, let's look at how to build a packaged deployment.



Six, directly under idea left the terminal terminal input MVN install, the compilation package succeeds, displays the build success word. Re-viewing the project's directory, we found that the project root directory under the target directory, the directory also played a war package.




Vii. deploy the app to the Tomcat server. There are two ways to deploy, and you can choose either one.

Method One:

Place the Spring.war package in the Taget directory mentioned above in the WebApps directory of the Tomcat installation directory. Using the command line (CMD) to switch to the bin directory of the Tomcat installation directory, execute the Startup.bat script, after which Tomcat deploys the application war package under the WebApps directory. After the application is deployed, open the browser, enter Localhost:8080/spring, and you can see the output of Hello world!. As shown in figure:





Method Two:

Use idea to configure Tomcat and deploy the app directly. Find the toolbar Run->edit configurations ... Select the tool symbol, locate the tomcat->local, configure it (primarily to configure the Tomcat installation directory), select deployment-> ' + ', select Spring.war as the deployment package. Then it can be started, the effect is the same.



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.