1 Preface
In creating a project, idea provides a very wide range of project templates, such as the Spring MVC template, that can create a maven-based spring MVC demo directly, with all configurations set up and ready to be used for direct compiler deployment.
When you first create a MAVEN Web project yourself, either create a SPRINGMVC project to make changes, or create a MAVEN project (not a Web project), join the. WebApp folder? Configure the Web. xml file and join? 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 the IntelliJ 13.1 version number is adjusted, but the detailed steps are almost identical. The version number 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 below the interface
Next join? Project name Finish
First time use, may need to download archetype WebApp plug-ins Sometimes the network is bad may need a very long time just after the good
Once created, you need to wait a bit, load the corresponding configuration file, and then, for example, as seen in the
The project is now MAVEN's WebApp project.
This time the IDE has a cache that needs to be refreshed in the right side of MAVEN project and loaded into 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 no more configuration is required in project structure
For example, the following two graphs are configured by default and do not need to be changed
3 Configuration instructions for MAVEN Web projects
Configuration of artifaces in Project structure
As you can see, there are two wars in Aritifaces, one is war exploded, and you need to select War when configuring server exploded
It is important to note that these two wars should not be added by themselves, but based on the configuration of Maven.
In the absence of these two wars, I have created them myself, often with the consequence that the project is missing a jar package after compilation, and the dependent jar does not have its own active copy
In fact, the Mavan project configuration in IntelliJ is dependent on the configuration in the Pom, assuming that the configuration in the Pom is correct, there is no need to change the IDE configuration of the project
first Pom to have <packaging>war</ Packaging>, assuming that the POM is configured with this, aritifaces There will be two wars
Li style= "padding:0px; margin:0px ">
next Pom to have <build> <finalName>test</finalName> </build> This relates to the configuration in the output directory, finalname as the project folder under Target , and a war package that will create the corresponding name (for example, Test.war)
Configure Src/main/java
For example, if the Java folder is missing from the Src/main folder, we can right-create the folder Java and then configure it as Sources folder in modules
So the Src/main/java icon becomes blue, as a Java source area.
Thank you @ Wu Junshen, in the MAVEN settings, you can check this option, when changing the POM, you actively join?
(always thought that was self-motivated to import MAVEN project)
Finally, thank you. @ Codlin finishing a good IntelliJ tutorial on using http://www.oschina.net/question/7728_150494
My favorite friend can learn a little bit.
Intellij idea creating a MAVEN Web project