There are two ways to configure MAVEN environment configuration, I recommend the use of the second, that is, using the local MAVEN installation files, personal feeling this can be convenient to manage the storage location of the download jar, error message output, can be clearly seen in the DOS window, although the more troublesome, Each time a DOS command is struck, but a batch file can be written to resolve it.
Mode one: Do not use the local MAVEN installation file environment configuration (that is, the default configuration of the M2eclipse plugin is used)
Settings.xml settings Localrepository as shown in the following code:(addresses can be customized)
<localrepository>d:/development/m2/repository</localrepository>
Indicates that if you do not set Localrepository,maven, the local warehouse will be built into the/.m2/repository folder by default. The setting above indicates that the local repository is established under the D:/development/m2/repository folder.
Personal suggestions do not use the default warehouse address, because if a lot of projects, then the local warehouse occupies more disk space, so specify the warehouse address to other drive letter, more convenient management.
Mode two: using the local maven Environment
Before installing Maven, you need to make sure that your JDK is installed and configured. MAVEN is a project under Apache, and now my new version is 3.0.4, and that's what I'm using.
1. First go to the official website to download maven:http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-3.0.4-bin.tar.gz
2. Configure the MAVEN environment variable:
System variable: maven_home = D:\Development\apache-maven-3.0.4
System variable: PATH =%maven_home%\bin
I believe that we all have to match the environment variables, the detailed steps will not say, to the attribute name and attribute values to match the OK.
Open cmd, knock inside: mvn-version
If you can print the information above, it means that the MAVEN3 has been installed on your PC.
MVN is a maven instruction, mvn-version is to view the version information, my operating system is 32-bit WIN7, the installation of MAVEN is 3.0.4
If you can print the information above, it means that the MAVEN3 has been installed on your PC.
3.eclipse Configuration maven:
(1) Click the Add button to select the path value of your native Maven installation .
(2) in Preferences-->maven-->user Settings, click Update Settings to load the changes we made to settings.xml just now.
4. Modify the MAVEN local repository storage location:
Find the Settings.xml configuration file under apache-maven-3.0.4 under Conf, mine is in D:\Development\apache-maven-3.0.4\conf\settings.xml
The apache-maven-3.0.4 warehouse is placed under the local user's temporary folder by default under the. M2 folder under Repository, mine is under the C:\Users\Administrator\.m2\repository directory,
Now let's modify to assign it to our own path, I'm now going to assign the repository to the D:/development/m2/repository directory, just open the local repository that was logged off.
Then write the corresponding path value in it:
attached: Maven Common Instructions
1. Create a simple MAVEN Web project mvn archetype:create Example: mvn archetype:create -dgroupid=com.demo.app-dartifactid= Demo-app -darchetypeartifactid=maven-archetype-webapp2. Build and Purge Eclipse Project structure: MVN eclipse:eclipse Turning the MAVEN project into Eclipse is actually building in the project. Project and. Classpath two files mvn eclipse:clean Cleanup (delete target directory compiled content) mvn Clean Package Release
Maven Learning (i) Build MAVEN environment