Baidu a bit Maven get the following explanation:
MAVEN is a project management tool that contains a project object model, a set of standard collections, a Project life cycle (Project Lifecycle), a dependency management system (Dependency Management System), and the logic used to run the plug-in (plugin) target (goal) defined in the life cycle phase (phase). When you use MAVEN, you use a well-defined project object model to describe your project, and maven can apply crosscutting logic that comes from a set of shared (or custom) plug-ins.
Maven has a life cycle that is called when you run the MVN install. This command tells Maven to perform a series of sequential steps until it reaches the life cycle you specify. One of the implications of traversing the life cycle journey is that Maven runs many of the default plug-in targets, which complete tasks like compiling and creating a JAR file.
In addition, MAVEN can easily help you manage project reports, build sites, manage jar files, and more.
First you need to download maven, URL: http://maven.apache.org/
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/87/04/wKiom1fRJ4fwlLrLAAGI8VDgqVo562.png-wh_500x0-wm_3 -wmp_4-s_1458197302.png "title=" Bnp4e9tfya118]~oiyt%~vc.png "alt=" Wkiom1frj4fwllrlaagi8vdgqvo562.png-wh_50 "/>
After downloading it for a. zip file, unzip the file and get the following folder:
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/87/02/wKioL1fRJ_OhqIx9AAHFwdEQVDo106.png-wh_500x0-wm_3 -wmp_4-s_4050302946.png "title=" _e4qh~xsju%[xcq) 08]wx ' y.png "alt=" Wkiol1frj_ohqix9aahfwdeqvdo106.png-wh_50 "/>
Remote Warehouse Address: Http://repo.maven.apache.org/maven2
Configuring Java Environment variables
Variable name: java_home
Variable Value: C:\Program files\java\jdk1.7.0_71 (Use the path of your own machine)
Configuring MAVEN Environment variables
Variable name: m2_home
Variable Value: D:\apache-maven-3.3.9
Path add:%m2_home%\bin;%java_home%\bin; (Use the path of your own machine)
Edit D:\apache-maven-3.3.9\conf\settings.xml
Add <localRepository>F:\maven_space</localRepository> Local Warehouse
Next, Eclipse joins Maven
Open Eclipse->window->maven->installations
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/87/02/wKioL1fRKQqCQRhXAAD4UUZkP4s078.png-wh_500x0-wm_3 -wmp_4-s_2380438698.png "title=" 1.png "alt=" Wkiol1frkqqcqrhxaad4uuzkp4s078.png-wh_50 "/>
Click Add->directory
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/87/04/wKiom1fRKXKzqKhQAACjbH8nujg625.png-wh_500x0-wm_3 -wmp_4-s_3506235738.png "title=" 2.png "alt=" Wkiom1frkxkzqkhqaacjbh8nujg625.png-wh_50 "/>
Add a Maven path, then click Finish
Next Select User Settings and select Browse in user Settings.
Select D:\apache-maven-3.3.9\conf\settings.xml File
Above eclipse joins MAVEN to complete
Not yet, using MAVEN to build Helloword projects
Right-click new->order-> input to search maven Product
Next->use Default WorkSpace Location Select Workspace
Next->filter Input Search: Org.apache.maven
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/87/02/wKioL1fRLcGh3AQHAADmJBe6X8I557.png-wh_500x0-wm_3 -wmp_4-s_3638319060.png "title=" 3.png "alt=" Wkiol1frlcgh3aqhaadmjbe6x8i557.png-wh_50 "/>
Select Maven-archetype-quickstart and Next
Group Id: (Enter the path to the project) Com.test
Artifact Id: (enter project name) Helloword
and finish finishing.
Build the project to the end
-------------------------I'm a split line---------------------------
Here is the project package
Right-click Project, Run as->run configurations
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/87/04/wKiom1fRLwny7nvNAAKZpJDSL8M531.png-wh_500x0-wm_3 -wmp_4-s_2358922388.png "title=" 4.png "alt=" Wkiom1frlwny7nvnaakzpjdsl8m531.png-wh_50 "/>
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/87/02/wKioL1fRL6bwy2jXAAFp-ockLdc293.png-wh_500x0-wm_3 -wmp_4-s_607987760.png "title=" 5.png "alt=" Wkiol1frl6bwy2jxaafp-ockldc293.png-wh_50 "/>
Right-click Maven build or Double-tap maven Build
Name Input Testhello
Base directory: Select the item you want to package by selecting Browse workspace below
Goals: (Enter packaging type) package
Then click JRE to set up
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/87/04/wKiom1fRMOfgVsfAAAExA2ViS3Y145.png-wh_500x0-wm_3 -wmp_4-s_3395544266.png "title=" 6.png "alt=" Wkiom1frmofgvsfaaaexa2vis3y145.png-wh_50 "/>
Select JRE, click Edit
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/87/03/wKioL1fRMSWC7CPGAADRwqGfCJE499.png-wh_500x0-wm_3 -wmp_4-s_2657152812.png "title=" 8.png "alt=" Wkiol1frmswc7cpgaadrwqgfcje499.png-wh_50 "/>
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/87/03/wKioL1fRMVbSBwLrAAEyAJyBEoA329.png-wh_500x0-wm_3 -wmp_4-s_3624160931.png "title=" 10.png "alt=" Wkiol1frmvbsbwlraaeyajybeoa329.png-wh_50 "/>
JRE Home Select JDK, otherwise the editor does not know if you are using the JRE or the JDK will error
Default VM Arguments: (Enter the MAVEN environment variable previously configured)-dmaven.multimoduleprojectdirectory= $M 2_home
Finish->ok->run
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/87/03/wKioL1fRMg_T0xU4AACpwu5eMho255.png-wh_500x0-wm_3 -wmp_4-s_3367694329.png "title=" 15.png "alt=" Wkiol1frmg_t0xu4aacpwu5emho255.png-wh_50 "/>
Run successfully, pay special attention to the first run to wait for its download. Jar package, time depends on speed
The entire project encountered 2 errors:
1,-dmaven.multimoduleprojectdirectory system propery is not set. Check $M 2_home environment variable and MVN script match.
Solution: JRE inside Configuration: Default VM Arguments: (Enter the MAVEN environment variable previously configured)-dmaven.multimoduleprojectdirectory= $M 2_home resolved
2, roughly the compiler does not know whether to use the JRE or JDK
[INFO]------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (Default-compile) on project Myproject:compilation failure
[ERROR] No compiler is provided in this environment. Perhaps is running on a JRE rather than a JDK? [ERROR], [Help 1]
[ERROR] [ERROR] The full stack trace of the errors, re-run Maven with THE-E switch.
[ERROR] Re-run Maven using The-x switch to enable full debug logging. [ERROR]
[ERROR] For more information on the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Solution: In the Eclipse menu, go to Window > Preferences > Java > Installed jres > Execution environments, select javase-1.x, On the right, select the installation directory for the JDK (be careful not to select the JRE directory).
It's over here and I wish you all a happy life =.=
This article is from the "Green Years" blog, be sure to keep this source http://alex233.blog.51cto.com/8904951/1850824
Using Maven under Eclipse