1、新建maven porject
2、勾选 create a simple porject
3、Group ID ,Artifact ID 可以自己定义
4、packaging 选择war
5、complier Level 选1.6以上,name为项目名称,点击fineshed
6、选中项目,右键-properties-myeclipse-project facets 进行项目转换
7、右侧选择 Dynamic Web Moudel 进行转换
8、转移webroot下两个文件夹到src/main/webapp下,并且创建web.xml
9、pom.xml中增加spring配置:
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.0.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.0.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.7.1</version>
</dependency>
</dependencies>
10、 同时在pom.xml中增加字符集编码格式:
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
致此,maven项目创建完成
本文转自tianjian_0913 51CTO博客,原文链接:http://blog.51cto.com/tianjian/1672826,如需转载请自行联系原作者