1.百度下载 maven 和 tomcat 安装 配置环境变量
2.使用最新版eclipse 集成maven
maven conf文件夹下的settings.xml文件配置存放maven仓库的位置,D:\hongzhimei\repository 为存放路径
3.新建工程
项目原型选择webapp项目
在buildPath中选择Edit更改为工作空间默认的jdk,项目目录会变成这样
在程序部署中把test删除,程序就不会编译test的代码
在pom.xml文件中添加依赖,然后等待jar包下载.
1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 2 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 "> 3 <modelVersion>4.0.0</modelVersion> 4 <groupId>com.maven.ssm</groupId> 5 <artifactId>weiyi</artifactId> 6 <packaging>war</packaging> 7 <version>0.0.1-SNAPSHOT</version> 8 <name>weiyi Maven Webapp</name> 9 <url></url> 10 <properties> 11 <!-- spring版本号 --> 12 <spring.version>4.0.2.RELEASE</spring.version> 13 </properties> 14 <dependencies> 15 <!-- spring核心包 --> 16 <dependency> 17 <groupId>org.springframework</groupId> 18 <artifactId>spring-core</artifactId> 19 <version>${spring.version}</version> 20 </dependency> 21 22 <dependency> 23 <groupId>org.springframework</groupId> 24 <artifactId>spring-web</artifactId> 25 <version>${spring.version}</version> 26 </dependency> 27 <dependency> 28 <groupId>org.springframework</groupId> 29 <artifactId>spring-oxm</artifactId> 30 <version>${spring.version}</version> 31 </dependency> 32 <dependency> 33 <groupId>org.springframework</groupId> 34 <artifactId>spring-tx</artifactId> 35 <version>${spring.version}</version> 36 </dependency> 37 38 <dependency> 39 <groupId>org.springframework</groupId> 40 <artifactId>spring-jdbc</artifactId> 41 <version>${spring.version}</version> 42 </dependency> 43 44 <dependency> 45 <groupId>org.springframework</groupId> 46 <artifactId>spring-webmvc</artifactId> 47 <version>${spring.version}</version> 48 </dependency> 49 <dependency> 50 <groupId>org.springframework</groupId> 51 <artifactId>spring-aop</artifactId> 52 <version>${spring.version}</version> 53 </dependency> 54 55 <dependency> 56 <groupId>org.springframework</groupId> 57 <artifactId>spring-context-support</artifactId> 58 <version>${spring.version}</version> 59 </dependency> 60 61 <dependency> 62 <groupId>org.springframework</groupId> 63 <artifactId>spring-test</artifactId> 64 <version>${spring.version}</version> 65 </dependency> 66 <!-- 添加MyBatis依赖 --> 67 <dependency> 68 <groupId>org.mybatis</groupId> 69 <artifactId>mybatis</artifactId> 70 <version>3.3.0</version> 71 </dependency> 72 <dependency> 73 <groupId>mysql</groupId> 74 <artifactId>mysql-connector-java</artifactId> 75 <version>5.1.25</version> 76 </dependency> 77 <!-- 阿里巴巴的数据库连接池 --> 78 <dependency> 79 <groupId>com.alibaba</groupId> 80 <artifactId>druid</artifactId> 81 <version>1.0.16</version> 82 </dependency> 83 <!-- spring结成mybatis --> 84 <dependency> 85 <groupId>org.mybatis</groupId> 86 <artifactId>mybatis-spring</artifactId> 87 <version>1.2.3</version> 88 </dependency> 89 <!-- jsp标准标签库 --> 90 <dependency> 91 <groupId>javax.servlet</groupId> 92 <artifactId>jstl</artifactId> 93 <version>1.2</version> 94 </dependency> 95 <dependency> 96 <groupId>log4j</groupId> 97 <artifactId>log4j</artifactId> 98 <version>1.2.16</version> 99 </dependency> 100 <dependency> 101 <groupId>org.slf4j</groupId> 102 <artifactId>slf4j-api</artifactId> 103 <version>1.6.1</version> 104 </dependency> 105 <dependency> 106 <groupId>org.slf4j</groupId> 107 <artifactId>slf4j-nop</artifactId> 108 <version>1.6.4</version> 109 </dependency> 110 <dependency> 111 <groupId>junit</groupId> 112 <artifactId>junit</artifactId> 113 <version>4.7</version> 114 <scope>test</scope> 115 </dependency> 116 </dependencies> 117 <build> 118 <plugins> 119 <plugin> 120 <groupId>org.apache.tomcat.maven</groupId> 121 <artifactId>tomcat6-maven-plugin</artifactId> 122 <version>2.1</version> 123 <configuration> 124 <url>:8090/manager</url> 125 <server>Tomcat6</server> 126 <port>8090</port> 127 <path>/</path> 128 </configuration> 129 </plugin> 130 </plugins> 131 <finalName>weiyi</finalName> 132 </build> 133 </project>