1. <project xmlns="http://maven.apache.org/POM/4.0.0"
    2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    4. <modelVersion>4.0.0</modelVersion>
    5. <!--可以理解为就是项目包目录-->
    6. <groupId>com.spring.mvc.demo</groupId>
    7. <!--模块唯一标识-->
    8. <artifactId>springMvcDemo</artifactId>
    9. <!--聚合 : 在父类中明确指定子类-->
    10. <!--继承 : 在子类中明确指定父类-->
    11. <!--聚合模块为项目目录的最顶层,其他模块作为聚合模块子目录而存在。目的是为一次构建多个项目模块。-->
    12. <!--pom继承是为了抽出重复配置,通常配置在父模块中,为子模块提供使用,这样可以做到“一处声明,处处使用”。-->
    13. <!--聚合和继承可以同时存在,且packging都是pom-->
    14. <packaging>pom</packaging>
    15. <version>1.0-SNAPSHOT</version>
    16. <!--子模块-->
    17. <modules>
    18. <module>intf</module>
    19. <module>service</module>
    20. <module>web</module>
    21. <!--因为当前pom是project所以不用加进来,如果是module,也需要把自己加进来当parent-->
    22. </modules>
    23. <!-- 统一子模块配置构件的版本号 -->
    24. <properties>
    25. <!--防止maven build时出现编码问题的警告-->
    26. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    27. <!--spring版本号 -->
    28. <spring.version>4.3.8.RELEASE</spring.version>
    29. <!--spring data-jpa版本号-->
    30. <spring_data_jpa.version>1.11.3.RELEASE</spring_data_jpa.version>
    31. <!--mybatis版本号 -->
    32. <mybatis.version>3.4.4</mybatis.version>
    33. <!--mybatis spring版本号-->
    34. <mybatis_spring.version>1.3.1</mybatis_spring.version>
    35. <!--mybatis破解工具-->
    36. <javassist.version>3.17.1-GA</javassist.version>
    37. <!--jstl版本号-->
    38. <jstl.version>1.2</jstl.version>
    39. <mysql.version>6.0.6</mysql.version>
    40. <!--junit版本号-->
    41. <junit.version>3.8.1</junit.version>
    42. <!--servlet-->
    43. <servlet.version>3.1.0</servlet.version>
    44. <!-- log4j日志文件管理包版本 -->
    45. <slf4j.version>1.7.7</slf4j.version>
    46. <log4j.version>2.8.2</log4j.version>
    47. </properties>
    48. <!--多模块统一依赖管理-->
    49. <dependencies>
    50. <!--intf、service和controller层-->
    51. <!--子模块会自动依赖其它两个模块,避免出现循环依赖-->
    52. <!--<dependency>-->
    53. <!--<groupId>com.spring.mvc.demo</groupId>-->
    54. <!--<artifactId>intf</artifactId>-->
    55. <!--<version>${project.version}</version>-->
    56. <!--</dependency>-->
    57. <!--<dependency>-->
    58. <!--<groupId>com.spring.mvc.demo</groupId>-->
    59. <!--<artifactId>service</artifactId>-->
    60. <!--<version>${project.version}</version>-->
    61. <!--</dependency>-->
    62. <!--<dependency>-->
    63. <!--<groupId>com.spring.mvc.demo</groupId>-->
    64. <!--<artifactId>web</artifactId>-->
    65. <!--<version>1.0-SNAPSHOT</version>-->
    66. <!--</dependency>-->
    67. <!--springframe start-->
    68. <!--spring core-->
    69. <!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
    70. <dependency>
    71. <groupId>org.springframework</groupId>
    72. <artifactId>spring-core</artifactId>
    73. <version>${spring.version}</version>
    74. </dependency>
    75. <!--spring context-->
    76. <dependency>
    77. <groupId>org.springframework</groupId>
    78. <artifactId>spring-context</artifactId>
    79. <version>${spring.version}</version>
    80. </dependency>
    81. <!--sprint webmvc-->
    82. <dependency>
    83. <groupId>org.springframework</groupId>
    84. <artifactId>spring-webmvc</artifactId>
    85. <version>${spring.version}</version>
    86. </dependency>
    87. <!--spring data-jpa-->
    88. <!--java持久层api, Java Persistence API-->
    89. <!--Spring 框架对 JPA 提供的支持主要体现在如下几个方面:-->
    90. <!--首先,它使得 JPA 配置变得更加灵活。JPA 规范要求,配置文件必须命名为 persistence.xml,并存在于类路径下的 META-INF 目录中。该文件通常包含了初始化 JPA 引擎所需的全部信息。Spring 提供的 LocalContainerEntityManagerFactoryBean 提供了非常灵活的配置,persistence.xml 中的信息都可以在此以属性注入的方式提供。-->
    91. <!--其次,Spring 实现了部分在 EJB 容器环境下才具有的功能,比如对 @PersistenceContext、@PersistenceUnit 的容器注入支持。-->
    92. <!--第三,也是最具意义的,Spring 将 EntityManager 的创建与销毁、事务管理等代码抽取出来,并由其统一管理,开发者不需要关心这些,业务方法中只剩下操作领域对象的代码,事务管理和 EntityManager 创建、销毁的代码都不再需要开发者关心了。-->
    93. <dependency>
    94. <groupId>org.springframework.data</groupId>
    95. <artifactId>spring-data-jpa</artifactId>
    96. <version>${spring_data_jpa.version}</version>
    97. </dependency>
    98. <!--springframe end-->
    99. <!--mybatis start-->
    100. <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
    101. <dependency>
    102. <groupId>org.mybatis</groupId>
    103. <artifactId>mybatis</artifactId>
    104. <version>${mybatis.version}</version>
    105. </dependency>
    106. <!-- mybatis/spring包 -->
    107. <dependency>
    108. <groupId>org.mybatis</groupId>
    109. <artifactId>mybatis-spring</artifactId>
    110. <version>${mybatis_spring.version}</version>
    111. </dependency>
    112. <!-- https://mvnrepository.com/artifact/org.javassist/javassist -->
    113. <!--mybatis 插件破解-->
    114. <dependency>
    115. <groupId>org.javassist</groupId>
    116. <artifactId>javassist</artifactId>
    117. <version>${javassist.version}</version>
    118. </dependency>
    119. <!--jsp 标准标签库, JSP Standard Tag Library-->
    120. <!--https://mvnrepository.com/artifact/javax.servlet.jsp.jstl/jstl-->
    121. <dependency>
    122. <groupId>javax.servlet.jsp.jstl</groupId>
    123. <artifactId>jstl-api</artifactId>
    124. <version>${jstl.version}</version>
    125. </dependency>
    126. <!--mysql驱动-->
    127. <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
    128. <dependency>
    129. <groupId>mysql</groupId>
    130. <artifactId>mysql-connector-java</artifactId>
    131. <version>${mysql.version}</version>
    132. </dependency>
    133. <!--单元测试-->
    134. <dependency>
    135. <groupId>junit</groupId>
    136. <artifactId>junit</artifactId>
    137. <version>${junit.version}</version>
    138. <!-- 表示开发的时候引入,发布的时候不会加载此包 -->
    139. <scope>test</scope>
    140. </dependency>
    141. <!-- 日志文件管理包 -->
    142. <!-- log start -->
    143. <dependency>
    144. <groupId>org.apache.logging.log4j</groupId>
    145. <artifactId>log4j-api</artifactId>
    146. <version>${log4j.version}</version>
    147. </dependency>
    148. <dependency>
    149. <groupId>org.apache.logging.log4j</groupId>
    150. <artifactId> log4j-core </artifactId>
    151. <version>${log4j.version}</version>
    152. </dependency>
    153. <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
    154. <!--简单日志门面Simple Logging Facade for Java-->
    155. <!--按照官方的说法,SLF4J是一个用于日志系统的简单Facade,允许最终用户在部署其应用时使用其所希望的日志系统。-->
    156. <dependency>
    157. <groupId>org.slf4j</groupId>
    158. <artifactId>slf4j-api</artifactId>
    159. <version>${slf4j.version}</version>
    160. </dependency>
    161. <dependency>
    162. <groupId>org.slf4j</groupId>
    163. <artifactId>slf4j-log4j12</artifactId>
    164. <version>${slf4j.version}</version>
    165. </dependency>
    166. <!-- log end -->
    167. </dependencies>
    168. <build>
    169. <finalName>springMvcDemo</finalName>
    170. <plugins>
    171. <plugin>
    172. <groupId>org.apache.maven.plugins</groupId>
    173. <artifactId>maven-compiler-plugin</artifactId>
    174. <configuration>
    175. <source>1.8</source>
    176. <target>1.8</target>
    177. </configuration>
    178. </plugin>
    179. </plugins>
    180. </build>
    181. </project>