First, download the Maven,maven download address.
The first step, configuring the MAVEN environment, is that the Java environment has been configured and is skipped here.
First, create an environment variable named M2_home, the value of the variable is the root of Maven, that is, to the upper layer of the bin, my value is D:\document\resource\maven\apache-maven-3.3.3-bin\ apache-maven-3.3.3, with Path:%m2_home%\bin. Open cmd and enter mvn-v to see if the MAVEN configuration was successful. I have a problem in this step, the execution of the command is reported exception in thread "main" java.lang.unsupportedclassversionerror:org/apache/maven/cli/mavencli : Unsupported Major.minor version 51.0. Figure below
This problem is because my local JDK version is 1.6, but now maven version of the latest version of the JDK is 1.7, the version of the JDK compiled with the higher versions of the JDK run on the lower version of the code will be reported this error, 51 is 1.7 compiled class version number, want to fully understand the students can find Java virtual To understand the book of the Machine. My solution here is to download a 1.6 supported maven. or the above download address, click on the download, click the bottom of the archives, here are all the MAVEN3 version, I am under the 3.1.1, decompression after re-configuration m2_home, run the command line mvn-v successfully.
Second step, modify the warehouse location
The default location of the system is ${user.home}/.m2/repository, which is a new. M2/repository to store under the user's home directory.
To modify the words open Apache-maven-3.1.1\conf\settings.xml, modify the <localRepository> you want to store the address </localrepository> This paragraph is commented out by default, you need to remove the comment.
Step three, create a MAVEN project
Execute command MVN archetype:create-dgroupid=org.sonatype.mavenbook.ch03-dartifactid=simple-dpackagename= Org.sonatype.mavenbook.
Here again error, error message is:
[INFO]
Scanning for projects ... [INFO] Building Maven Stub Project (No POM) 1 [INFO]---maven-archetype-plugin:2.3:create (default-cli) @ standalone-pom---[in FO] BUILD FAILURE [INFO] Total time:2.728 s [info] finished at:2015-04-14t13:36:35+08:00 [INFO] Final memory:14m/108m [ INFO]------------------------------------------------------------------------[ERROR] Failed to execute goal Org.apache.maven.plugins:maven-archetype-plugin:2.3:create (DEFAULT-CLI) on project Standalone-pom:unable to parse Configuration of Mojo Org.apache.maven.plugins:maven-archetype-plugin:2.3:create for Paramete R #: Cannot create Instanc E of interface Org.apache.maven.artifact.repository.Ar tifactrepository, [Help 1] [ERROR] [ERROR]-See the full STA CK trace of the errors, re-run maven with THE-E Swit ch. [ERROR] re-run maven using The-x switch to enable full debug lo
Gging.
[ERROR] [ERROR] For more information on the errors and possible solutions, please rea d the following articles: [ERROR] [Help 1] Http://cwiki.apache.org/confluence/display/MAVEN/PluginConfigur ationexception
The problem is that MAVEN supports the Create command starting from 3.0, changing the Create to generate, running the command again, and executing successfully.
After successful execution, the project stores the directory as simple as the user's home directory.
Fourth step, import eclipse
First, configure Eclipse, choose Preferences-maven, choose Installations, add our Maven path just now,
Then select user Settings and select our Settings.xml file.
Then, import the MAVEN project that we just created, and this time the project is not going to import eclipse, you need to use the command line
Go to the directory where the project is located, Mine is C:\Users\DELL\simple, then execute the command mvn eclipse:eclipse, after execution
You can import eclipse, choose MAVEN Projects when importing, otherwise, it will not be the MAVEN project after importing.
Fifth step, create a MAVEN project with eclipse
Step does not say, the creation of the time encountered an error, information as follows: An internal error occurred during: "Retrieving Archetypes:".
GC Overhead limit exceeded
This error is caused by the low memory of the Java Virtual machine, entering Eclipse.ini, modifying-xmx, re-establishing the project, and succeeding.
I built the SPRINGMVC project, and in the second step of new Maven project, I chose Co.ntier spring-mvc-archetype 1.0.2 (group ID artfact ID version)
Then right-click on the project, click on Run As-maven build, and error message as follows:
E:\localRepository\org\springframework\spring-beans\3.1.0.RELEASE\spring-beans-3.1.0.RELEASE.jar error; Invalid CEN Header (bad signature)
This is caused by a failure to download from the MAVEN central repository to a local error, and the workaround is to delete the folder and build again. I deleted this side of the download a few times and finally resolved.
After build, a MAVEN SPRINGMVC project is built.