Create a Java Web project using IntelliJ idea 14 and Maven

Source: Internet
Author: User

Install maven Download Installation

Download the latest version of the MAVEN website.

Unzip to the installation directory.

Configuration

Right-click the desktop computer icon, properties –> advanced system settings –> environment variable, add the M2_HOME environment variable, and then add the variable PATH in.

Note that you must have JAVA_HOME an environment variable, or MAVEN will prompt you for an error.

If you want to modify MAVEN's local warehouse location, you can set it in the Settings.xml configuration file under the Conf directory under MAVEN's installation directory.

Open cmd, enter mvn --version , see the following prompt to show that the installation is successful.

Configure IntelliJ

In IntelliJ settings, you can set up MAVEN's installation directory, the location of the settings.xml file, and the location of the local repository.

New

Create a new MAVEN project, create from archetype, select Maven-archetype-webapp

Next, fill in Groupid,artifactid and version

Next, adding a parameter to the properties archetypeCatalog=internal , without this parameter, will be very slow when Maven builds the skeleton, and sometimes it will get stuck directly.

Explanations from the Internet:

Archetypecatalog represents the plug-in uses the archetype metadata, does not add this parameter when the default is Remote,local, that is, the central warehouse archetype metadata, because the central warehouse archetype too much, so the result is very slow, Specify internal to indicate that only internal metadata is used.

Next, fill in the project name and module name.

Click Finish.

The directory structure of the project is as follows:

Set up

Configuring the JDK and Language level for a project

Create a new Java folder under the main folder and set it as the source code folder.

Adds an externally dependent jar package to the module.

The addition of Tomcat dependency is to satisfy servlet and jsp rely on Tomcat as a servlet container for enhanced servlet jsp API.

Add a jar package dependency.

Set the artifact.

Set up Tomcat.

Start TOMCA

Create a Java Web project using IntelliJ idea 14 and Maven

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.