pom.xml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5. <parent>
  6. <artifactId>springboot-parent</artifactId>
  7. <groupId>com.alvin.springboot</groupId>
  8. <version>1.0-SNAPSHOT</version>
  9. </parent>
  10. <modelVersion>4.0.0</modelVersion>
  11. <artifactId>springboot-main</artifactId>
  12. <build>
  13. <plugins>
  14. <!-- 分离lib -->
  15. <plugin>
  16. <!--这个插件就是把依赖的jar包复制出来放到编译后的target/lib目录,并且在打包时候排除内部依赖-->
  17. <groupId>org.apache.maven.plugins</groupId>
  18. <artifactId>maven-dependency-plugin</artifactId>
  19. <executions>
  20. <execution>
  21. <id>copy-dependencies</id>
  22. <phase>prepare-package</phase>
  23. <goals>
  24. <goal>copy-dependencies</goal>
  25. </goals>
  26. <configuration>
  27. <outputDirectory>${project.build.directory}/lib</outputDirectory>
  28. <overWriteReleases>false</overWriteReleases>
  29. <overWriteSnapshots>false</overWriteSnapshots>
  30. <overWriteIfNewer>true</overWriteIfNewer>
  31. </configuration>
  32. </execution>
  33. </executions>
  34. </plugin>
  35. <!-- 分离资源文件 -->
  36. <plugin>
  37. <artifactId>maven-resources-plugin</artifactId>
  38. <executions>
  39. <execution>
  40. <id>copy-resources</id>
  41. <phase>package</phase>
  42. <goals>
  43. <goal>copy-resources</goal>
  44. </goals>
  45. <configuration>
  46. <resources>
  47. <resource>
  48. <directory>src/main/resources</directory>
  49. </resource>
  50. </resources>
  51. <outputDirectory>${project.build.directory}/resources</outputDirectory>
  52. </configuration>
  53. </execution>
  54. </executions>
  55. </plugin>
  56. <!--打包jar-->
  57. <plugin>
  58. <groupId>org.apache.maven.plugins</groupId>
  59. <artifactId>maven-jar-plugin</artifactId>
  60. <configuration>
  61. <archive>
  62. <!-- 指定资源文件目录,与打包的jar文件同级目录 -->
  63. <manifestEntries>
  64. <Class-Path>resources/</Class-Path>
  65. </manifestEntries>
  66. <manifest>
  67. <addClasspath>true</addClasspath>
  68. <classpathPrefix>lib/</classpathPrefix>
  69. <mainClass>com.alvin.Application</mainClass>
  70. </manifest>
  71. </archive>
  72. <!-- 打包时忽略的文件(也就是不打进jar包里的文件),本例将resources下的.yml、.xml、.db文件全部排除 -->
  73. <excludes>
  74. <exclude>**/*.yml</exclude>
  75. <exclude>**/*.xml</exclude>
  76. <exclude>**/*.db</exclude>
  77. </excludes>
  78. </configuration>
  79. </plugin>
  80. <!-- spring boot repackage -->
  81. <plugin>
  82. <groupId>org.springframework.boot</groupId>
  83. <artifactId>spring-boot-maven-plugin</artifactId>
  84. <configuration>
  85. <layout>ZIP</layout>
  86. <includes>
  87. <include>
  88. <groupId>non-exists</groupId>
  89. <artifactId>non-exists</artifactId>
  90. </include>
  91. </includes>
  92. </configuration>
  93. <executions>
  94. <execution>
  95. <goals>
  96. <goal>repackage</goal>
  97. </goals>
  98. </execution>
  99. </executions>
  100. </plugin>
  101. </plugins>
  102. </build>
  103. <dependencies>
  104. <dependency>
  105. <groupId>org.springframework.boot</groupId>
  106. <artifactId>spring-boot-starter-web</artifactId>
  107. <exclusions>
  108. <!--排除logback-->
  109. <exclusion>
  110. <groupId>org.springframework.boot</groupId>
  111. <artifactId>spring-boot-starter-logging</artifactId>
  112. </exclusion>
  113. </exclusions>
  114. </dependency>
  115. <dependency>
  116. <groupId>org.springframework.boot</groupId>
  117. <artifactId>spring-boot-starter-test</artifactId>
  118. <scope>test</scope>
  119. </dependency>
  120. <dependency>
  121. <groupId>org.springframework.boot</groupId>
  122. <artifactId>spring-boot-devtools</artifactId>
  123. <scope>runtime</scope>
  124. <optional>true</optional>
  125. </dependency>
  126. <dependency>
  127. <groupId>org.springframework.boot</groupId>
  128. <artifactId>spring-boot-starter-aop</artifactId>
  129. </dependency>
  130. <!--log4j2 依赖-->
  131. <dependency>
  132. <groupId>org.springframework.boot</groupId>
  133. <artifactId>spring-boot-starter-log4j2</artifactId>
  134. </dependency>
  135. <!--异步日志依赖-->
  136. <dependency>
  137. <groupId>com.lmax</groupId>
  138. <artifactId>disruptor</artifactId>
  139. <version>3.3.7</version>
  140. </dependency>
  141. <!--dao层mybatis-->
  142. <dependency>
  143. <groupId>com.alvin.springboot</groupId>
  144. <artifactId>springboot-dao</artifactId>
  145. <version>1.0-SNAPSHOT</version>
  146. </dependency>
  147. </dependencies>
  148. </project>