Foreword
Once installed and configured Maven, we will learn how to create the first version of Java Maven project and Web project in Esclipse in. (Maven installation and configuration may refer to related content: https://blog.csdn.net/TheWindOfSon/article/details/104066060 )
1. Prior to the new project, to be relevant settings in Eclipse Maven
(1) on the menu bar Windows-> Preferences-> Maven-> Installations-> Add ... (choose your own Maven installation directory)
(2) or Maven-> User Settings as follows in the same list
2. after the completion of the configuration to be a new version of Java Maven project of
(1) Click the right mouse button New -> Maven Project
Tips: If you can not find the right New time this option can proceed as follows:
Tips: Run in the above manner Maven files are no problem, but some small partners want to use when your JRE, how to configure it?
Here are two ways to make changes, one is configured in Eclipse, but this needs to be configured once for each project;
another is related to the configuration of the conf directory in Maven / settings.xml file, this after all the items are able to use both its own version of the JRE.
1) The first way: perform configuration in Eclipse
, right-click the project Properties-> Java Build Path
Right-click the project Properties-> the Java Compiler
2) (recommended) The second way: to find profiles Maven label under the conf directory under / settings.xml, and do the following configuration (JDK version uses its own version number)
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
The final renderings:
3. Create a new Web version of Maven Engineering
(1) Right-click New -> Maven Project
if done the above steps, you think everything will be fine, it would be wrong. The back is the key
We will find a "X" on the project, how do we solve it?
Steps: Right Project Properties-> Maven-> Project Facets
between √ have it point out, the click Apply, and then step on the √, so there will be something to let you configure the
completion of the above steps, the project × disappeared, but also generates the web.xml file.
Although the project is not being given, but we are still being given new jsp page, because we lack the runtime environment Server Runntime, then we can be configured via the pom.xml file can also be set directly solve the runtime environment.
(1) Here we introduce directly the runtime environment to solve
to sum up
Here is a new version of Maven Java Web engineering and process engineering of all the. It is more complicated, so most of my screenshot to show, if there is an error, please bigwigs promptly corrected.