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
Access
Finish!
Create a Java Web project using IntelliJ idea 14 and Maven