整理整合了我学习 Maven 搭建项目时,中常用的坐标依赖,现在分享给大家参考使用
零、常见环境搭建
0.0 Maven 镜像配置
代码语言:javascript复制 <localRepository>D:workspacejavamavenlocalRepository>
<mirror>
<id>alimavenid>
<name>aliyun mavenname>
<url>http://maven.aliyun.com/nexus/content/groups/public/url>
<mirrorOf>centralmirrorOf>
mirror>
<mirror>
<id>ukid>
<mirrorOf>centralmirrorOf>
<name>Human Readable Name for this Mirror.name>
<url>http://uk.maven.org/maven2/url>
mirror>
<mirror>
<id>CNid>
<name>OSChina Centralname>
<url>http://maven.oschina.net/content/groups/public/url>
<mirrorOf>centralmirrorOf>
mirror>
<mirror>
<id>nexusid>
<name>internal nexus repositoryname>
<url>http://repo.maven.apache.org/maven2url>
<mirrorOf>centralmirrorOf>
mirror>
0.1 SSH 搭建
常见环境搭建 SSH:Struct2 hibernate5 Spring5
0.2 SSM 搭建
常见环境搭建 SSM: Spring SpringMVC MyBatis
一、Java SE 阶段
1.1 单元测试坐标依赖
代码语言:javascript复制 <dependency>
<groupId>junitgroupId>
<artifactId>junitartifactId>
<version>4.10version>
dependency>
1.2 动态代理坐标依赖
代码语言:javascript复制 <dependency>
<groupId>cglibgroupId>
<artifactId>cglibartifactId>
<version>2.1_3version>
dependency>
二、Java EE 阶段
2.1 JSTL 1.2 standard
代码语言:javascript复制 <dependency>
<groupId>javax.servlet.jsp.jstlgroupId>
<artifactId>jstl-apiartifactId>
<version>1.2version>
dependency>
<dependency>
<groupId>taglibsgroupId>
<artifactId>standardartifactId>
<version>1.1.2version>
dependency>
2.2 servlet 中相关 API
代码语言:javascript复制 <dependency>
<groupId>javax.servletgroupId>
<artifactId>javax.servlet-apiartifactId>
<version>4.0.0version>
<scope>compilescope>
dependency>
<dependency>
<groupId>javax.elgroupId>
<artifactId>javax.el-apiartifactId>
<version>3.0.0version>
dependency>
2.3 JSP 相关 API
代码语言:javascript复制 <dependency>
<groupId>javax.servlet.jspgroupId>
<artifactId>jsp-apiartifactId>
<version>2.2version>
<scope>providedscope>
dependency>
三、数据库基础配置
3.1 MySQL 数据库
适用于 mysql 5.5
代码语言:javascript复制 <dependency>
<groupId>mysqlgroupId>
<artifactId>mysql-connector-javaartifactId>
<version>5.1.10version>
<scope>runtimescope>
dependency>
适用于 mysql 8.0
代码语言:javascript复制 <dependency>
<groupId>mysqlgroupId>
<artifactId>mysql-connector-javaartifactId>
<version>8.0.13version>
<scope>runtimescope>
dependency>
3.2 数据库连接池
3.2.1 阿里巴巴 Druiid 连接池
代码语言:javascript复制 <dependency>
<groupId>com.alibabagroupId>
<artifactId>druidartifactId>
<version>1.1.22version>
dependency>
3.2.2 c3p0 数据库连接池
代码语言:javascript复制 <dependency>
<groupId>c3p0groupId>
<artifactId>c3p0artifactId>
<version>0.9.1.2version>
dependency>
<dependency>
<groupId>com.mchangegroupId>
<artifactId>c3p0artifactId>
<version>0.9.5.2version>
dependency>
四、Spring SpringMVC 常用依赖
4.1 Spring 基础
代码语言:javascript复制 <dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-contextartifactId>
<version>5.2.3.RELEASEversion>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-testartifactId>
<version>${spring.version}version>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-txartifactId>
<version>5.2.3.RELEASEversion>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-ormartifactId>
<version>5.1.0.RELEASEversion>
dependency>
4.2 开启 Spring AOP
代码语言:javascript复制 <dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-aopartifactId>
<version>5.2.3.RELEASEversion>
dependency>
<dependency>
<groupId>org.aspectjgroupId>
<artifactId>aspectjweaverartifactId>
<version>1.8.7version>
dependency>
4.3 SpringMVC 相关
代码语言:javascript复制 <dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-webartifactId>
<version>5.2.3.RELEASEversion>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-webmvcartifactId>
<version>5.2.3.RELEASEversion>
dependency>
4.4 整合 JDBCTemplate
代码语言:javascript复制 <dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-jdbcartifactId>
<version>5.2.3.RELEASEversion>
dependency>
五、ORM 相关
5.1 MyBatis
代码语言:javascript复制 <dependency>
<groupId>org.mybatisgroupId>
<artifactId>mybatisartifactId>
<version>3.4.5version>
dependency>
<dependency>
<groupId>org.mybatisgroupId>
<artifactId>mybatis-springartifactId>
<version>1.3.3version>
dependency>
5.2 hibernate
代码语言:javascript复制 <dependency>
<groupId>org.hibernategroupId>
<artifactId>hibernate-coreartifactId>
<version>5.0.12.Finalversion>
dependency>
六、其它框架
6.1 mvc 框架 struct2
代码语言:javascript复制 <dependency>
<groupId>org.apache.strutsgroupId>
<artifactId>struts2-coreartifactId>
<version>2.5.10.1version>
dependency>
<dependency>
<groupId>org.apache.strutsgroupId>
<artifactId>struts2-json-pluginartifactId>
<version>2.5.22version>
dependency>
七、工具类
7.1 fastjson 之 JSON 数据封装
代码语言:javascript复制 <dependency>
<groupId>com.alibabagroupId>
<artifactId>fastjsonartifactId>
<version>1.2.68version>
dependency>
7.2 文件上传
代码语言:javascript复制 <dependency>
<groupId>commons-fileuploadgroupId>
<artifactId>commons-fileuploadartifactId>
<version>1.4version>
dependency>
<dependency>
<groupId>commons-iogroupId>
<artifactId>commons-ioartifactId>
<version>2.0version>
dependency>
7.3 日志打印
log4j 日志打印
代码语言:javascript复制 <dependency>
<groupId>org.apache.logging.log4jgroupId>
<artifactId>log4j-coreartifactId>
<version>2.9.1version>
dependency>
<dependency>
<groupId>org.apache.logging.log4jgroupId>
<artifactId>log4j-apiartifactId>
<version>2.9.1version>
dependency>
7.4 Excel 文件解析处理
使用 poi 完成 Excel 文档的解析
代码语言:javascript复制 <dependency>
<groupId>org.apache.poigroupId>
<artifactId>poiartifactId>
<version>3.15version>
dependency>
<dependency>
<groupId>org.apache.poigroupId>
<artifactId>poi-ooxmlartifactId>
<version>3.15version>
dependency>
<dependency>
<groupId>org.apache.poigroupId>
<artifactId>poi-ooxml-schemasartifactId>
<version>3.15version>
dependency>