【1】maven来管理我的SSM项目
新建个maven项目,第一步当然是配置好自己需要的jar包,maven使用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 http://maven.apache.org/maven-v4_0_0.xsd"> 3 <modelVersion>4.0.0</modelVersion> 4 <groupId>com.hub</groupId> 5 <artifactId>csc</artifactId> 6 <packaging>war</packaging> 7 <version>0.0.1-SNAPSHOT</version> 8 <name>csc Maven Webapp</name> 9 <url>http://maven.apache.org</url> 10 <!-- ============================================================================= --> 11 <!-- 设置版本号 --> 12 <!-- 配置完该属性,下面的以来配置就可以直接引用 --> 13 <properties> 14 <spring.version>4.0.2.RELEASE</spring.version> 15 <mybatis.version>3.2.8</mybatis.version> 16 <slf4j.version>1.7.12</slf4j.version> 17 <log4j.version>1.2.17</log4j.version> 18 </properties> 19 <!-- ============================================================================= --> 20 <!-- 依赖jar包 --> 21 <dependencies> 22 <!-- 单元测试 --> 23 <dependency> 24 <groupId>junit</groupId> 25 <artifactId>junit</artifactId> 26 <version>4.11</version> 27 <!-- test表示测试的时候引入,发布的时候不会引用此包 --> 28 <scope>test</scope> 29 </dependency> 30 <!-- 1.日志 --> 31 <!-- 实现slf4j接口并整合 --> 32 <dependency> 33 <groupId>ch.qos.logback</groupId> 34 <artifactId>logback-classic</artifactId> 35 <version>1.1.1</version> 36 </dependency> 37 <!-- ============================================================================= --> 38 <!-- spring框架包 start --> 39 <!-- Spring Core:Spring的核心工具包 --> 40 <dependency> 41 <groupId>org.springframework</groupId> 42 <artifactId>spring-core</artifactId> 43 <version>${spring.version}</version> 44 </dependency> 45 <!-- Spring test:对JUNIT等测试框架的简单封装 --> 46 <dependency> 47 <groupId>org.springframework</groupId> 48 <artifactId>spring-test</artifactId> 49 <version>${spring.version}</version> 50 </dependency> 51 <!-- Spring Beans:Spring IOC的基础实现,包含访问配置文件、创建和管理bean等。 --> 52 <dependency> 53 <groupId>org.springframework</groupId> 54 <artifactId>spring-beans</artifactId> 55 <version>4.0.2.RELEASE</version> 56 </dependency> 57 <!-- Spring oxm:Spring对于object/xml映射的支持,可以让JAVA与XML之间来回切换 --> 58 <dependency> 59 <groupId>org.springframework</groupId> 60 <artifactId>spring-oxm</artifactId> 61 <version>${spring.version}</version> 62 </dependency> 63 <!-- Spring tx:为JDBC、Hibernate、JDO、JPA等提供的一致的声明式和编程式事务管理。 --> 64 <dependency> 65 <groupId>org.springframework</groupId> 66 <artifactId>spring-tx</artifactId> 67 <version>${spring.version}</version> 68 </dependency> 69 <!-- Spring JDBC:对JDBC 的简单封装 --> 70 <dependency> 71 <groupId>org.springframework</groupId> 72 <artifactId>spring-jdbc</artifactId> 73 <version>${spring.version}</version> 74 </dependency> 75 <!-- Spring AOP:Spring的面向切面编程,提供AOP(面向切面编程)的实现 --> 76 <dependency> 77 <groupId>org.springframework</groupId> 78 <artifactId>spring-aop</artifactId> 79 <version>${spring.version}</version> 80 </dependency> 81 <!-- Spring Context:在基础IOC功能上提供扩展服务,此外还提供许多企业级服务的支持, 82 有邮件服务、任务调度、JNDI定位,EJB集成、远程访问、缓存以及多种视图层框架的支持。 --> 83 <dependency> 84 <groupId>org.springframework</groupId> 85 <artifactId>spring-context</artifactId> 86 <version>${spring.version}</version> 87 </dependency> 88 <!-- Spring Context Support:Spring context的扩展支持,用于MVC方面。 --> 89 <dependency> 90 <groupId>org.springframework</groupId> 91 <artifactId>spring-context-support</artifactId> 92 <version>${spring.version}</version> 93 </dependency> 94 <!-- Spring expression:Spring表达式语言 --> 95 <dependency> 96 <groupId>org.springframework</groupId> 97 <artifactId>spring-expression</artifactId> 98 <version>${spring.version}</version> 99 </dependency> 100 <!-- Spring orm:整合第三方的orm实现,如hibernate,ibatis,jdo以及spring 的jpa实现 --> 101 <dependency> 102 <groupId>org.springframework</groupId> 103 <artifactId>spring-orm</artifactId> 104 <version>${spring.version}</version> 105 </dependency> 106 <!-- Spring web:包含Web应用开发时,用到Spring框架时所需的核心类,包括自动载入WebApplicationContext 107 特性的类、Struts与JSF集成类、文件上传的支持类、Filter类和大量工具辅助类。 --> 108 <dependency> 109 <groupId>org.springframework</groupId> 110 <artifactId>spring-web</artifactId> 111 <version>${spring.version}</version> 112 </dependency> 113 <!-- Spring webmvc:包含SpringMVC框架相关的所有类。包含国际化、标签、Theme、视图展现的 114 FreeMarker、JasperReports、 Tiles、Velocity、XSLT相关类。当然, 115 如果你的应用使用了独立的MVC框架,则无需这个JAR文件里的任何类。 --> 116 <dependency> 117 <groupId>org.springframework</groupId> 118 <artifactId>spring-webmvc</artifactId> 119 <version>${spring.version}</version> 120 </dependency> 121 <!-- 后续需要使用(暂时未用):Spring websocket:提供 Socket通信, web端的推送功能 --> 122 <!-- spring框架包 end --> 123 <!-- ============================================================================= --> 124 <!-- mybatis框架包 start --> 125 <dependency> 126 <groupId>org.mybatis</groupId> 127 <artifactId>mybatis</artifactId> 128 <version>${mybatis.version}</version> 129 </dependency> 130 <dependency> 131 <groupId>org.mybatis</groupId> 132 <artifactId>mybatis-spring</artifactId> 133 <version>1.2.2</version> 134 </dependency> 135 <!-- mybatis框架包 end --> 136 <!-- ============================================================================= --> 137 <!-- 数据库驱动 --> 138 <!--mysql配置: 139 <dependency> 140 <groupId>mysql</groupId> 141 <artifactId>mysql-connector-java</artifactId> 142 <version>5.1.35</version> 143 </dependency> --> 144 <!-- sqlserver配置: --> 145 <dependency> 146 <groupId>com.microsoft.sqlserver</groupId> 147 <artifactId>sqljdbc4</artifactId> 148 <version>4.0</version> 149 </dependency> 150 151 <!-- 导入c3p0的jar包 --> 152 <dependency> 153 <groupId>c3p0</groupId> 154 <artifactId>c3p0</artifactId> 155 <version>0.9.1.2</version> 156 </dependency> 157 <!-- jstl标签类 --> 158 <dependency> 159 <groupId>jstl</groupId> 160 <artifactId>jstl</artifactId> 161 <version>1.2</version> 162 </dependency> 163 <dependency> 164 <groupId>taglibs</groupId> 165 <artifactId>standard</artifactId> 166 <version>1.1.2</version> 167 </dependency> 168 <!-- ============================================================================= --> 169 <!-- log start --> 170 <dependency> 171 <groupId>log4j</groupId> 172 <artifactId>log4j</artifactId> 173 <version>${log4j.version}</version> 174 </dependency> 175 <dependency> 176 <groupId>org.slf4j</groupId> 177 <artifactId>slf4j-api</artifactId> 178 <version>${slf4j.version}</version> 179 </dependency> 180 <dependency> 181 <groupId>org.slf4j</groupId> 182 <artifactId>slf4j-log4j12</artifactId> 183 <version>${slf4j.version}</version> 184 </dependency> 185 <!-- log END --> 186 <!-- ============================================================================= --> 187 <!-- Json --> 188 <!-- 格式化对象,方便输出日志 --> 189 <dependency> 190 <groupId>com.fasterxml.jackson.core</groupId> 191 <artifactId>jackson-databind</artifactId> 192 <version>2.5.4</version> 193 </dependency> 194 <dependency> 195 <groupId>javax.servlet</groupId> 196 <artifactId>javax.servlet-api</artifactId> 197 <version>3.1.0</version> 198 </dependency> 199 <!-- 上传组件包 start --> 200 <dependency> 201 <groupId>commons-fileupload</groupId> 202 <artifactId>commons-fileupload</artifactId> 203 <version>1.3.1</version> 204 </dependency> 205 <dependency> 206 <groupId>commons-io</groupId> 207 <artifactId>commons-io</artifactId> 208 <version>2.4</version> 209 </dependency> 210 <dependency> 211 <groupId>commons-codec</groupId> 212 <artifactId>commons-codec</artifactId> 213 <version>1.10</version> 214 </dependency> 215 216 </dependencies> 217 <build> 218 <finalName>mavendemo</finalName> 219 </build> 220 </project>