1.下载Maven插件。
http://m2eclipse.sonatype.org/sites/m2e
2.新建文件settings.xml
<settings>
<proxies>
<proxy>
<id>https-proxy</id>
<active>true</active>
<protocol>https</protocol>
<host>172.19.200.101</host>
<port>10002</port>
<nonProxyHosts>localhost|172.*</nonProxyHosts>
</proxy>
</proxies>
<profiles>
<profile>
<id>yanfeng</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<pluginRepositories>
<pluginRepository>
<id>mavencentral</id>
<url>http://172.19.200.101/archiva/repository/internal</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
<pluginRepository>
<id>snapcentral</id>
<url>http://172.19.200.101/archiva/repository/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>localrelease</id>
<name>localrelease</name>
<url>http://172.19.200.101/archiva/repository/internal</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>localsnapshot</id>
<name>localsnapshot</name>
<url>http://172.19.200.101/archiva/repository/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<id>jnolen-devnet-profile</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<repositories>
<repository>
<id>atlassian-public</id>
<url>https://maven.atlassian.com/repository/public</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>atlassian-m1-repository</id>
<url>https://maven.atlassian.com/maven1</url>
<layout>legacy</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>atlassian-public</id>
<url>https://maven.atlassian.com/repository/public</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<properties>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<!--
Uncomment this and specify the location on your file system where your
clover license is located.
<clover.licenseLocation>/path/to/clover/license</clover.licenseLocation>
-->
<atlassian.pdk.server.url>http://localhost:1990/confluence/</atlassian.pdk.server.url>
<atlassian.pdk.server.username>admin</atlassian.pdk.server.username>
<atlassian.pdk.server.password>admin</atlassian.pdk.server.password>
</properties>
</profile>
</profiles>
</settings>
将文件拷贝至目录C:\Documents and Settings\Administrator\.m2下
2.重新启动Eclipse,Window-->Maven-->User Settings-->选择settings.xml,Update Settings-->Apply-->OK
3.New Project-->Maven Project-->Next-->Next-->在Filter中输入webapp,选择webapp-jee5-->Next-->输入Group Id和Artifact Id-->Finish
4.打开pom.xml,选择Dependencies视图,添加需要的jar包。
5.关闭pom.xml,重新打开pom.xml(我安装的时候有这个Bug,添加插件无响应),选择Plugins视图,Add插件,输入tomcat,选择1.0版本,Ok。
6.配置tomcat插件的端口,选择pom.xml视图,更改:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<port>8088</port>
</configuration>
</plugin>
7.配置运行环境
src-->main-->webapp-->index.jsp右击-->run as-->run Configurations-->输入Name:选择Browse workspace,在Goals:中输入tomcat:run,点击run。
8.验证:浏览器中输入http://localhost:8088/training,查看结果!