Web front-end development artifact Intellij idea

Source: Internet
Author: User

1 Preface

In the project creation, IDEA provides a number of project templates, such as the Spring MVC template, which can be directly created with a MAVEN-based spring MVC demo, with all configurations set up and ready to be used for direct compilation of the deployment.

The first time you create a MAVEN Web project yourself, either create a SPRINGMVC project to modify it, create a MAVEN project (not a Web project), add a WebApp directory to add the configuration Web. xml file, and add a website moudle. Configuration properties, and so on.

In addition to the previous summary of several IntelliJ use the article, there are more or less some problems, please take this article as the subject.

The interface for creating a project after IntelliJ 13.1 has been adjusted, but the exact steps are still the same. The version used in this article is 13.1.2,

2 Creating a MAVEN Web project

New project--maven--Check the Create from archetype check WebApp

Next (figure) fill in the project GroupId Artifactid version after next appears the following interface

Add project name after next finish

The first time you use it, you may need to download archetype WebApp plug-ins Sometimes it may take a long time for the network to be bad.

After you've created it, you'll need to wait a moment to load the configuration file, as shown in

The project is now MAVEN's WebApp project.

This time the IDE has a cache that needs to be refreshed in the right MAVEN project to load the configuration in the Pom

(after adding the jar dependency in the POM, click on the Refresh button of Maven project to swipe the cache)

This time the Maven WebApp project is completely created and does not need to be configured in project structure.

The following two graphs, which are configured by default, do not need to be modified:

3 Configuration instructions for MAVEN Web projects

Configuration of artifaces in Project structure

As shown, there are two wars in Aritifaces, one is war exploded, and you need to select the war when configuring the server exploded

It is important to note that these two wars should not be added by themselves, but rather based on the configuration generated by Maven itself.

In the absence of these two wars, I created them myself, often with the consequence that the project was missing a jar package after compilation and the dependent jar was not automatically copied

In fact, IntelliJ in the Mavan project configuration, are dependent on the configuration in the Pom, if the configuration in the Pom is correct, you do not need to modify the project's IDE configuration

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

    2. Next, Pom should have <build> <finalName>test</finalName> </build> This relates to the configuration in the output directory, Finalname as the project directory under target and the war package that will create the corresponding name (e.g. Test.war)

Configure Src/main/java

For example, if the Java directory is missing from the Src/main directory, we can right-click to create the directory Java and then configure the sources directory in the modules.

So the Src/main/java icon becomes blue, as the Java source code area.

Web front-end development artifact Intellij idea

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.