Java EE Learning (4): Idea + maven build Web (2)

Source: Internet
Author: User
Tags tomcat server

Reference: http://www.bubuko.com/infodetail-1855067.html

Now use MAVEN to create the project: This section is followed by a section that focuses on creating a Web project using MAVEN and basic packaging operations that do not involve spring packages.

1 for convenience, first open the tool button:

Install IntelliJ idea the default interface is generally the case, no toolbar is displayed, the operation is very inconvenient

Because it is the first time use, so the whole tool is not very clear, if you want to display, we click on the view, and then tick toolbar on the line

Now we can see that our tool class has a lot more icons handy

2. Idea Configuration maven:

Prerequisite: The MAVEN,JDK has been configured. , please refer to the above section for details, and do not repeat here.

Just getting started we need to configure MAVEN, set up maven install directory and maven local repository.

3. Creating a Java Web project using Maven

new->project, choose to create a Maven project, such as

Fill in GroupId and Articfactid

Choose our Maven installation directory and the local repository

Fill in the project name (can be consistent with the previous Articfactid, can also be inconsistent), directory, and module name (can be consistent with the project name) Click Finish Finish

The project structure obtained at this time is as follows:

Recources folder: Typically used to store some resource files
WebApp folder: Used to store Web configuration files and JSP pages, etc.

4. Create a Java directory

Click Project structure/file--Project Structure, or CTRL + ALT + SHIFT + S to go into the item structure settings

Select modules, select TESTMVN Project, right-click new Java directory

set the Java directory to Sources, save the Java code, the folder will turn Blue after the setting is finished, click OK.

5. Configuring the Tomcat server

Click Edit Configurations

Click on the top left corner to add a symbol , select Tomcat server-"Local

Configure the following options click OK

If you want to deploy our program, select the deployment point to the right of the plus sign select Artifact Select our project

6. Maven Package Deployment Project

Click Maven Projects on the right to appear as

In the right margin, right-click to run Maven Build

The following results show that build succeeded

Then we choose Install run to package

When packaged successfully, the following results appear, showing the storage directory of our War packages

After that, we will generate the target file We configured in our project directory.

We copy the War package under Tomcat under the WebApps directory and run the Tomcat server

In the browser input URL display Helloword http://localhost:8080/

The following will continue with the web framework created by MAVEN, in the spring package that loads the response, building idea + maven + Spring MVC and Java authoring ...

Java EE Learning (4): Idea + maven build Web (2)

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.