IntelliJ idea Create a MAVEN project __maven create

Source: Internet
Author: User

Create Maven Project File-->new-->project


Select Maven, tick the create from archetype Select WebApp


Click Next to enter the next step and fill out groupid and Artifactid


Click Next to go to the next step and select the local maven that was previously downloaded; here, add a parameter archetypecatalog=internal to the properties, which, without this parameter, will be very slow when Maven builds the skeleton, sometimes directly.

Archetypecatalog represents the archetype metadata used by Plug-ins, the default for this parameter is remote,local, which is the central warehouse archetype metadata, because the archetype of the central warehouse is too much, so it causes very slow, Specify internal to represent the use of internal metadata only



Click Next to enter the next step and fill in the project name


Click the Finish button to complete the creation of the MAVEN project



Configure the MAVEN project, file--"Project Structure

Select the installed JDK


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


Sources is commonly used to annotate such a compiled directory like SRC. Sometimes we are not only the project's SRC directory to be compiled, there are some other special directories maybe we also want to be a compiled directory, we need to do this annotation. It is important to keep in mind that only Sources this compiled directory can create new Java classes and packages. Tests is typically used to annotate a compiled unit test directory. In the canonical MAVEN project structure, the top-level directory is Src,maven src We are not set to Sources, but the Java directory in its subdirectory main directory, we will set to Sources. The directory of unit tests is Src-test-java, and the Java directory here is set to Tests, which means that the directory is used as a compiled unit test directory. Typically this and the next few of us are configured under the MAVEN project, but I'll talk about it first. From this we can also see that IntelliJ idea's support for the MAVEN project is quite thorough. Resources are typically used to annotate resource file directories. Under the MAVEN project, the resource directory is partitioned separately, and its directory is: Src-main-resources, where the resources directory is set to resources, indicating that the directory is a resource directory. The files in the resource directory are compiled into the output directory.
Test resources are typically used to annotate the resource file directory for unit tests. Under the MAVEN project, the Resource directory for unit tests is partitioned separately, and the directory is: Src-test-resources, where the resources directory is set to test resources, indicating that the directory is a resource directory as a unit test. The files in the resource directory are compiled into the output directory. Excluded is typically used to annotate exclusion catalogs. Excluded directories are not indexed by IntelliJ idea, which is the equivalent of being discarded by IntelliJ idea, which is a code file that does not have regular code features such as code checking and smart hints.

Add an external-dependent jar pack for modules


Adding tomcat dependencies is designed to meet the servlet and JSP dependencies, and Tomcat is easy to improve the servlet and JSP APIs as a servlet


Facets Web settings, click the plus sign, select the web, configure Web.xml files and Webroot file paths



Add jar bundle dependencies, click on the plus sign, select external dependent jar package location


Configure artifacts, there are two war in Aritifaces, one is war, one is war exploded, you need to select War exploded when configuring server

Be aware that the two war should not be added by yourself, but rather based on the configuration of Maven.

Without these two war, they are created by themselves, often the consequence is that the project is missing a jar package after compiling, and the dependent jar is not automatically copied.

In fact, the Mavan project configuration in IntelliJ is dependent on the configuration in the Pom, and if the Pom is configured correctly, you do not need to modify the IDE configuration for the project.

First Pom to have <packaging>war</packaging>, if this is configured in the POM, aritifaces will have the above two war

Second Pom to have <build> <finalName>test</finalName> </build> This relates to the configuration in output directory in the above figure, Finalname as the project directory under target and the war package that will create the corresponding name (such as Test.war)
Configure Tomcat


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.