pom.xml是maven项目中的一个很重要的文件,很多依赖都在这个文件中配置。
pom.xml依赖的配置主要分为:
两大依赖:1.模块依赖;2.框架依赖
三个部分:1.对于项目本身模块的依赖;2:对于自己公司的封装包的依赖;3:对于第三方包的依赖。
(一)、Dao层的典型依赖—–和数据相关的依赖
1. spring-jdbc
1 <dependency> 2 <groupId>org.springframework</groupId> 3 <artifactId>spring-jdbc</artifactId> 4 </dependency>
2. spring-data-commons(分页…)
1 <dependency> 2 <groupId>org.springframework.data</groupId> 3 <artifactId>spring-data-commons</artifactId> 4 </dependency>
3.mybatis( 公司包)
1 <dependency> 2 <groupId>com.xxxx.framework</groupId> 3 <artifactId>xxxx-mybatis</artifactId> 4 </dependency>
4.redis(公司包)
1 <dependency> 2 <groupId>com.vivo.framework</groupId> 3 <artifactId>vivo-redis</artifactId> 4 </dependency>
(二)、Service层的典型依赖:
Apache:
1. common-lang3—-各种工具类(StringUtils…)
1 <dependency> 2 <groupId>org.apache.commons</groupId> 3 <artifactId>commons-lang3</artifactId> 4 </dependency>
https://zhidao.baidu.com/question/587200456967870805.html
2.common-collections(集合工具类)
1 <dependency> 2 <groupId>commons-collections</groupId> 3 <artifactId>commons-collections</artifactId> 4 </dependency>
3. common-io(IO工具类)
1 <dependency> 2 <groupId>commons-io</groupId> 3 <artifactId>commons-io</artifactId> 4 </dependency>
4. Json
4.1 json 三大组件:
1 <dependency> 2 <groupId>com.fasterxml.jackson.core</groupId> 3 <artifactId>jackson-core</artifactId> 4 </dependency> 5 <dependency> 6 <groupId>com.fasterxml.jackson.core</groupId> 7 <artifactId>jackson-databind</artifactId> 8 </dependency> 9 <dependency> 10 <groupId>com.fasterxml.jackson.core</groupId> 11 <artifactId>jackson-annotations</artifactId> 12 </dependency>
4.2 其他的json三方包—alibaba
1 <dependency> 2 <groupId>com.alibaba</groupId> 3 <artifactId>fastjson</artifactId> 4 </dependency>
5. 日志
1 <!--log--> 2 <dependency> 3 <groupId>org.slf4j</groupId> 4 <artifactId>slf4j-api</artifactId> 5 </dependency> 6 <dependency> 7 <groupId>log4j</groupId> 8 <artifactId>log4j</artifactId> 9 </dependency> 10 <dependency> 11 <groupId>org.slf4j</groupId> 12 <artifactId>slf4j-log4j12</artifactId> 13 </dependency> 14 15 <!-- common-logging --> 16 <dependency> 17 <groupId>org.slf4j</groupId> 18 <artifactId>jcl-over-slf4j</artifactId> 19 </dependency> 20 21 <!-- java.util.logging --> 22 <dependency> 23 <groupId>org.slf4j</groupId> 24 <artifactId>jul-to-slf4j</artifactId> 25 </dependency>
6.Spring(7大组件)
1 <!--spring start --> 2 <dependency> 3 <groupId>org.springframework</groupId> 4 <artifactId>spring-core</artifactId> 5 </dependency> 6 <dependency> 7 <groupId>org.springframework</groupId> 8 <artifactId>spring-beans</artifactId> 9 </dependency> 10 <dependency> 11 <groupId>org.springframework</groupId> 12 <artifactId>spring-context</artifactId> 13 </dependency> 14 <dependency> 15 <groupId>org.springframework</groupId> 16 <artifactId>spring-context-support</artifactId> 17 </dependency> 18 <dependency> 19 <groupId>org.springframework</groupId> 20 <artifactId>spring-aop</artifactId> 21 </dependency> 22 <dependency> 23 <groupId>org.springframework</groupId> 24 <artifactId>spring-aspects</artifactId> 25 </dependency> 26 <dependency> 27 <groupId>org.springframework</groupId> 28 <artifactId>spring-expression</artifactId> 29 </dependency> 30 <!--spring end -->
7. xxxx-commons(公司框架–读写分离、多库多表….)
1 <dependency> 2 <groupId>com.xxxx.framework</groupId> 3 <artifactId>xxxx-commons</artifactId> 4 </dependency>
8.commons-validator (通用验证系统)
1 <dependency> 2 <groupId>commons-validator</groupId> 3 <artifactId>commons-validator</artifactId> 4 </dependency>
9.dubbo(阿里巴巴的分布式框架)
1 <dependency> 2 <groupId>com.alibaba</groupId> 3 <artifactId>dubbo</artifactId> 4 <exclusions> 5 <exclusion> 6 <artifactId>curator-client</artifactId> 7 <groupId>org.apache.curator</groupId> 8 </exclusion> 9 </exclusions> 10 </dependency>
10.curator-framework(Zookeeper客户端)
1 <dependency> 2 <groupId>org.apache.curator</groupId> 3 <artifactId>curator-framework</artifactId> 4 </dependency>
11.Dao层的依赖(spring-jdbc/spring-data-commons/mybatis/redis)
1 <dependency> 2 <groupId>org.springframework</groupId> 3 <artifactId>spring-jdbc</artifactId> 4 </dependency> 5 6 <dependency> 7 <groupId>org.springframework.data</groupId> 8 <artifactId>spring-data-commons</artifactId> 9 </dependency> 10 11 <dependency> 12 <groupId>com.vivo.framework</groupId> 13 <artifactId>vivo-mybatis</artifactId> 14 </dependency>
1 <dependency> 2 <groupId>com.vivo.framework</groupId> 3 <artifactId>vivo-redis</artifactId> 4 </dependency>
(三)、Web层的典型依赖:
1. 模块依赖对Service层的依赖
2.框架依赖
2.1 spring-web
1 <dependency> 2 <groupId>org.springframework</groupId> 3 <artifactId>spring-web</artifactId> 4 </dependency>
2.2 spring-webmvc
1 <dependency> 2 <groupId>org.springframework</groupId> 3 <artifactId>spring-webmvc</artifactId> 4 </dependency>
2.3 servlet-api(前端控制器DispacherServlet就是一个servlet)
1 <dependency> 2 <groupId>javax.servlet</groupId> 3 <artifactId>servlet-api</artifactId> 4 <scope>provided</scope>//如果不配置scope,会把jar包发布,会跟容器里的jar包冲突 5 </dependency>
JSTL使用需要的两个包
2.4 jstl(java script tag language)
1 <dependency> 2 <groupId>jstl</groupId> 3 <artifactId>jstl</artifactId> 4 </dependency>
2.5 taglibs(标签库)
1 <dependency> 2 <groupId>taglibs</groupId> 3 <artifactId>standard</artifactId> 4 </dependency>
至此,Dao、Service、Web三个层的常用的依赖包就基本罗列完成,下面详细分析每个包.
今天的文章pom.xml中的常用依赖包总结分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/55380.html