Life and death can not solve the eclipse Maven project to create the ultimate method - (maven comes with installation tutorial)
Recently maven project I was head of the whole big, what it feels like, that is, before you think it is a soft, but slowly becomes your answer, for this is the one I love into a dead end, it must Sa (Country love recently seen a lot! haha)
Step.1 First we have to install maven, then, need to go to the official website to download the source files
maven official website paper airplane to go from ~
Then click on the left side of the interface will download to the download page
after download is a compressed package, unzip it
** We need to change a configuration file into a local repository is the path, there is the address of a remote warehouse, concrete local warehouse, the concept of the two, I posted part in this diagram,
FIG CSDN art from the calf ccc
**
configure this
then
<!-- 阿里云中央仓库 -->
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
Finally Ctrl + S (Be sure to save !!!!)
Step.2 configuration environment variable
Open My Computer ---- "---- Right Properties> Advanced System Settings ----> Environment Variables -" lower-right corner of New
Then determine the
then still need to configure an environment variable
open path
, double-click editing
and then determine
We went to cmd (windows + R shortcut and enter cmd) to see if the installation was successful
Dos window appears
enter mvn -v
emergence of this successful installation!
Step.3 configuration eclipse
Open eclipse
Then click finish
and then we continue to select the last item
Finally, click ApplyAndClose
Step.4 Maven project
New-----》Other
Click Next
Take some time to download the environment after the finish, this time after another error on a (which many students are being given)
For example: This error is essentially a network problem, how to solve, find the location of the widget
Delete this folder, then go right project project ----> maven Options ----> Project and Update
(if it is reported that this was wrong, it has been deleted, has been update, and he has been a never-ending struggle down)
, etc. After a while, the project is created, it is like this
standard Maven project format
this time Maven project you're done, we can write a helloworld
there is also need to pay attention to step
web.xml file contents
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>此处为你的项目ID</display-name>
</web-app>
Create a new html file in webapp, we can access it (start Tomcat)
So far, maven project and you're done ~ ~ ~
Add this: Some update after students have become a problem jdk 1.5, we can click on POM
, add the following xml file
attached below Source
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source> // 这里写你的jdk版本
<target>1.8</target> // 这里写你的jdk版本
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>