Create a Java Web project using IntelliJ idea and maven

Source: Internet
Author: User
Tags java web tomcat server

1. Introduction to Maven

Projects managed and built under Maven are really good and simple compared to traditional projects, so it's also important to use such tools as much as possible to build projects that can manage the entire lifecycle of a project.

You can do all the relevant work with its commands, and its common commands are as follows:

    • MVN Compile
    • MVN test
    • MVN clean
    • MVN Package
    • MVN Install//put the newly created jar package into the warehouse
    • MVN archetype:generate//Create a new project

Central Factory URL:

    • http://search.maven.org/
    • Http://repo.maven.apache.org/maven2

This article mainly demonstrates how to configure and use the IntelliJ IDEA IDE environment.

2. Configure Maven

Software is configured once and all MAVEN projects are shared.

1) Select your own warehouse, if 3

1) as shown in callout 2, Import Maven projects automatically indicates that IntelliJ idea will monitor the project's Pom.xml file in real-time and make changes to the project settings.
2) whether the source code and documentation are downloaded automatically when Maven imports the dependent packages as shown in callout 3. The default is not checked, and is not recommended, because this can speed up the project from the external network to import the speed of the dependent package, if we need source code and documentation when we then to a dependent package for the Internet download. IntelliJ idea supports the download of source code and documentation directly from the public network.
3) as shown in callout 3, you can set the imported VM parameters. Generally this does not need to actively change, unless the project is really imported too slow, we will increase this parameter.

3. Maven Skeleton Create Java Web project

1) File--New Project ...

2) if

3) if

GroupID and artifactid< project name > also version, these three properties are intended to identify the uniqueness of your project.

4) if

5) if

6) After you click Finish, MAVEN will create a MAVEN-based Web App based on the configuration you just made.

-Create the end, whose log is as follows:

-Create the end with the following code structure:

Recources folder: Typically used to store some resource files
WebApp folder: Used to store Web configuration files and JSP pages, etc., which has formed an original web application

4. Start the Java Web project

1) Open "Project Structure"

2) Configure "Facets"

3) Configure "artifacts"

4) Start "Edit configurations"

5) Add New ' Tomcat Server ' configuration

6) Configuration Deplyment

7) Configure the server

The results are as follows:

8) Start Web Server

You can now access webserver's page through browser.

5. Deploying the war file in Tomcat

1) Copy the Mvndemo.war to the WebApps directory of Tomcat.

2) Access the url:http://localhost:8080/mvndemo/on the browser.

6. Create a Java program directory

1) Create a Java directory

2) Set the Java directory to sources

Select the Java folder, click on the Make As:sources, the folder will be blue, to save Java code, press OK.

Original link: http://blog.csdn.net/myarrow/article/details/50824793

Create a Java Web project using IntelliJ idea and maven

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.