Life and death can not solve the eclipse Maven project to create the ultimate method - (maven comes with installation tutorial)

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 ~

maven official website
Then click on the left side of the interface will download to the download page
Here Insert Picture Description
Here Insert Picture Description
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

**
Here Insert Picture Description
Here Insert Picture Description
configure this
Here Insert Picture Description
then
Here Insert Picture Description

<!-- 阿里云中央仓库 -->
<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

Here Insert Picture Description
Then determine the
Here Insert Picture Description
then still need to configure an environment variable
open path


, double-click editing
Here Insert Picture Description
and then determine

We went to cmd (windows + R shortcut and enter cmd) to see if the installation was successful


Dos window appears
Here Insert Picture Description
enter mvn -v
Here Insert Picture Description
emergence of this successful installation!

Step.3 configuration eclipse

Open eclipse

Here Insert Picture Description
Here Insert Picture Description
Then click finish
Here Insert Picture Description
and then we continue to select the last item
Here Insert Picture Description

Finally, click ApplyAndClose

Step.4 Maven project

Here Insert Picture Description

New-----》Other
Here Insert Picture Description

Click Next

Here Insert Picture Description
Here Insert Picture Description

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

Here Insert Picture Description
Here Insert Picture Description
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
Here Insert Picture Description
this time Maven project you're done, we can write a helloworld
there is also need to pay attention to step
Here Insert Picture Description
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>

Here Insert Picture Description
Create a new html file in webapp, we can access it (start Tomcat)

Here Insert Picture Description

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

Here Insert Picture Description
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>

perfect! Of course this is my kind of approach, if there is an easier way everybody comment to me, let me know ha ~ ~ ~

Published 16 original articles · won praise 7 · views 655

Guess you like

Origin blog.csdn.net/lovemore2/article/details/104548047