Installation of Maven and its Eclipse plugin m2eclipse
Install
1. Download the Maven package and unzip it
2. Set jdk environment variables, Maven environment variables (PATH=%MavenHome%/bin)
3. To check whether the installation is successful, enter the .mvn command in cmd to see if there is a prompt
4. Eclipse installation http://m2eclipse.sonatype.org/sites/m2e
Create maven web project
1. new > maven project > create simple ....
2. Fill in groupid, artifactid
3. next > finish
4. Right-click properties , Project Facets on the project, and click the hyperlink Convert Faceted from
5. Select version 2.5 in the Dynamic Web Module of Project Facet below, and select 1.6 in java
6. Select the type of server runtime in runtime
7. View the release directory in Web Deployment Assembly, note: src/main/webapp > /
8. Map the maven library to WEB-INF/lib, add > java build path entries > Maven Dependencies
9. Publish to the server
See: http://www.blogjava.net/kevonz/archive/2012/07/08/382542.html
maven common commands
1. Create a Maven project mvn archetype:generate
choose a number : select by default
Define value for groupId : Enter the organization id, such as zhengdong.com
Define value for artifactId : Enter the project name, such as: hello
Define value for version : Enter the version number, the default is 1.0-SNAPSHOT
Define value for package : java package name, such as com.zhengdong
2. Project packaging: mvn package //The command needs to be executed under the project path
3. Compile the source program: mvn compile
4. Compile and test: mvn test
5. Empty the generated files: mvn clean
6. Convert the maven project to an eclipse project: mvn eclipse:eclipse
7. Clear the eclipse project configuration information: mvn -Dwtpversion=1.0 eclipse:clean
8. Combined use: mvn eclipse:clean clean
The above commands can be used in combination:
mvn clean package
mvn clean install