Maven2 is much better than the 1 generation, and the main emphasis is that it's not just a dependency pack manager!
Start by recommending a Maven2 ebook for you, which is very useful for Maven learning: Better builds with maven
The following is a special introduction to the WebApp management and debugging support for the MAVEN2.
1. Create a project
MVN archetype:create-dgroupid=com.mycompany.app-dartifactid=my-webapp-darchetypeartifactid= Maven-archetype-webapp
Also refer to Here
Create a directory structure that is careful to follow Maven, with particular attention to the source file being placed under Main/java:
2. pom file configuration
Pay special attention to the configuration of the resource section, because my spring and web-related XML is placed in the Web-inf directory, so that it can be used at unit test, adding references to these profiles. It's equivalent to adding a classpath.
There is also an episode: I do not know why there is no JTA bag in the MAVEN2, automatic download will be prompted to teach you how to manually through the order to join, very simple.
Jetty's plugin is for the back to use it for debugging.
DWR is also currently a hot option for web development.
In addition, in order to use the JAVA5 generation to compile, joined the Maven-compiler-plugin section.
< project xmlns = "http://maven.apache.org/POM/4.0.0" xmlns:xsi = "Http://www.w3.org/2001/XMLSchema-instance"
Xsi:schemalocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" >
< modelversion > 4.0.0 </modelversion >
< groupId > Com.exchangebit.nms </groupId >
< Artifactid > Ebnms </artifactid >
< packaging > War </Packaging >
< version > 1.0-snapshot </version >
< name > Ebnms Maven Webapp </name >
< URL > http://maven.apache.org </URL >
< build >
< Finalname > Ebnms </finalname >
< resources >
< Resource >
< directory > Src/main/java </directory >
< includes >
< include > **/*.xml </include >
</includes >
</Resource >
< Resource >
< directory > Src/main/webapp/web-inf </directory >
< includes >
< include > **/*.xml </include >
< include > **/log4j.properties </include >
</includes >
</Resource >
</Resources >
< plugins >
< plugin >
< groupId > Org.apache.maven.plugins </groupId >
< Artifactid > Maven-compiler-plugin </artifactid >
< configuration >
< source > 1.5 </Source >
< target > 1.5 </target >
</configuration >
</plugin >
< plugin >
< groupId > Org.mortbay.jetty </groupId >
< Artifactid > Maven-jetty-plugin </artifactid >
</plugin >
</Plugins >
</Build >
< dependencies >
< dependency >
< groupId > JUnit </groupId >
< Artifactid > JUnit </artifactid >
< version > 3.8.1 </version >
< scope > Test </scope >
</dependency >
< dependency >
< groupId > org.hibernate </groupId >
< Artifactid > Hibernate </