1、第一步下载maven,这个就不细说了。
2、配置maven仓库等,如果不想自己搭建仓库,可以使用开源中国的maven库,参考
http://maven.oschina.net/help.html
<?xml version="1.0"?>
<!-- ======================================================================== -->
<!-- settings.xml for maven users -->
<!-- Version: 3 -->
<!-- Auhtor: jingshun shi -->
<!-- $Id: settings.xml 43697 2012-06-26 09:47:57Z jingshun.shijs $ -->
<!-- ======================================================================== -->
<settings>
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ~/.m2/repository
-->
<localRepository>D:/.m2/Repository</localRepository>
<mirrors>
<mirror>
<id>nexus-osc</id>
<mirrorOf>*</mirrorOf>
<name>Nexus osc</name>
<url>http://maven.oschina.net/content/groups/public/</url>
</mirror>
<mirror>
<id>nexus-osc-thirdparty</id>
<mirrorOf>thirdparty</mirrorOf>
<name>Nexus osc thirdparty</name>
<url>http://maven.oschina.net/content/repositories/thirdparty/</url>
</mirror>
</mirrors>
<!-- ======================================================================== -->
<!-- Accounts for SCM ONLY -->
<!-- ======================================================================== -->
<!-- ======================================================================== -->
<!-- Profiles -->
<!-- ======================================================================== -->
<profiles>
<profile>
<id>jdk-1.4</id>
<activation>
<jdk>1.4</jdk>
</activation>
<repositories>
<repository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://maven.oschina.net/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://maven.oschina.net/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
3、创建应用,命令:
mvn archetype:create -DgroupId=net.applepaihs -DartifactId=simple -DpackageName=net.applepaihs.simple -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false