pom.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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. <groupId>org.leanwo.server.management</groupId>
  6. <artifactId>ServerManagement</artifactId>
  7. <version>0.0.1</version>
  8. <packaging>jar</packaging>
  9. <name>ServerManagement</name>
  10. <url>http://maven.apache.org</url>
  11. <!--指定父级依赖 -->
  12. <parent>
  13. <groupId>org.springframework.boot</groupId>
  14. <artifactId>spring-boot-starter-parent</artifactId>
  15. <version>2.2.4.RELEASE</version>
  16. </parent>
  17. <properties>
  18. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  19. <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  20. <java.version>1.8</java.version>
  21. <spring-cloud.version>Hoxton.RELEASE</spring-cloud.version>
  22. </properties>
  23. <dependencies>
  24. <dependency>
  25. <groupId>org.yaml</groupId>
  26. <artifactId>snakeyaml</artifactId>
  27. </dependency>
  28. <dependency>
  29. <groupId>org.springframework.boot</groupId>
  30. <artifactId>spring-boot-starter</artifactId>
  31. <exclusions>
  32. <exclusion>
  33. <groupId>org.springframework.boot</groupId>
  34. <artifactId>spring-boot-starter-logging</artifactId>
  35. </exclusion>
  36. </exclusions>
  37. </dependency>
  38. <dependency>
  39. <groupId>org.springframework.boot</groupId>
  40. <artifactId>spring-boot-starter-log4j2</artifactId>
  41. </dependency>
  42. <dependency>
  43. <groupId>org.springframework.cloud</groupId>
  44. <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
  45. </dependency>
  46. <!-- https://mvnrepository.com/artifact/org.dom4j/dom4j -->
  47. <dependency>
  48. <groupId>org.dom4j</groupId>
  49. <artifactId>dom4j</artifactId>
  50. <version>2.1.3</version>
  51. </dependency>
  52. <dependency>
  53. <groupId>org.springframework.boot</groupId>
  54. <artifactId>spring-boot-starter-test</artifactId>
  55. <scope>test</scope>
  56. </dependency>
  57. <dependency>
  58. <groupId>junit</groupId>
  59. <artifactId>junit</artifactId>
  60. <scope>test</scope>
  61. </dependency>
  62. </dependencies>
  63. <dependencyManagement>
  64. <dependencies>
  65. <dependency>
  66. <groupId>org.springframework.cloud</groupId>
  67. <artifactId>spring-cloud-dependencies</artifactId>
  68. <version>${spring-cloud.version}</version>
  69. <type>pom</type>
  70. <scope>import</scope>
  71. </dependency>
  72. </dependencies>
  73. </dependencyManagement>
  74. <build>
  75. <!-- jar包名 -->
  76. <finalName>ServerManagement</finalName>
  77. <!--默认源代码目录 -->
  78. <sourceDirectory>src/main/java </sourceDirectory>
  79. <!--默认测试源代码目录 -->
  80. <testSourceDirectory>src/test/java</testSourceDirectory>
  81. <!--默认资源目录 -->
  82. <resources>
  83. <resource>
  84. <directory>src/main/resources</directory>
  85. </resource>
  86. </resources>
  87. <plugins>
  88. <plugin>
  89. <groupId>org.apache.maven.plugins</groupId>
  90. <artifactId>maven-compiler-plugin</artifactId>
  91. <configuration>
  92. <source>1.8</source>
  93. <target>1.8</target>
  94. </configuration>
  95. </plugin>
  96. <plugin>
  97. <groupId>org.springframework.boot</groupId>
  98. <artifactId>spring-boot-maven-plugin</artifactId>
  99. </plugin>
  100. <!-- 忽略junit单元测试 -->
  101. <plugin>
  102. <groupId>org.apache.maven.plugins</groupId>
  103. <artifactId>maven-surefire-plugin</artifactId>
  104. <configuration>
  105. <skip>true</skip>
  106. </configuration>
  107. </plugin>
  108. <plugin>
  109. <groupId>org.apache.maven.plugins</groupId>
  110. <artifactId>maven-jar-plugin</artifactId>
  111. <version>3.1.1</version>
  112. <configuration>
  113. <!-- 指定打包的jar包输出路径 -->
  114. <outputDirectory>${project.build.directory}/${project.version}</outputDirectory>
  115. <!--注意这玩意从编译结果目录开始算目录结构-->
  116. <excludes>
  117. <exclude>**/*.yml</exclude>
  118. <exclude>**/*.xml</exclude>
  119. <exclude>**/*.bat</exclude>
  120. <exclude>**/*.properties</exclude>
  121. <exclude>**/*.sql</exclude>
  122. <exclude>**/*.txt</exclude>
  123. <exclude>**/*.jks</exclude>
  124. </excludes>
  125. <archive>
  126. <!-- 指定配置文件目录,这样jar运行时会去找到同目录下的resources文件夹下查找 -->
  127. <manifestEntries>
  128. <Class-Path>resources/</Class-Path>
  129. </manifestEntries>
  130. <manifest>
  131. <addClasspath>true</addClasspath>
  132. <classpathPrefix>lib/</classpathPrefix>
  133. <mainClass>com.leanwo.management.ServerManagementApp</mainClass>
  134. </manifest>
  135. </archive>
  136. </configuration>
  137. </plugin>
  138. <!-- 复制资源文件 -->
  139. <plugin>
  140. <artifactId>maven-resources-plugin</artifactId>
  141. <executions>
  142. <execution>
  143. <id>copy-dependencies</id>
  144. <phase>package</phase>
  145. <goals>
  146. <goal>copy-resources</goal>
  147. </goals>
  148. <configuration>
  149. <!-- 资源文件输出目录 -->
  150. <outputDirectory>${project.build.directory}/${project.version}/resources</outputDirectory>
  151. <resources>
  152. <resource>
  153. <directory>src/main/resources</directory>
  154. <excludes>
  155. <exclude>*.bat</exclude>
  156. </excludes>
  157. </resource>
  158. </resources>
  159. </configuration>
  160. </execution>
  161. <execution>
  162. <id>copy-dependencies-bat</id>
  163. <phase>package</phase>
  164. <goals>
  165. <goal>copy-resources</goal>
  166. </goals>
  167. <configuration>
  168. <!-- 资源文件输出目录 -->
  169. <outputDirectory>${project.build.directory}/${project.version}</outputDirectory>
  170. <resources>
  171. <resource>
  172. <directory>src/main/resources</directory>
  173. <includes>
  174. <include>*.bat</include>
  175. </includes>
  176. </resource>
  177. </resources>
  178. </configuration>
  179. </execution>
  180. </executions>
  181. </plugin>
  182. <!-- 分离lib -->
  183. <plugin>
  184. <groupId>org.apache.maven.plugins</groupId>
  185. <artifactId>maven-dependency-plugin</artifactId>
  186. <executions>
  187. <execution>
  188. <id>copy-dependencies</id>
  189. <phase>package</phase>
  190. <goals>
  191. <goal>copy-dependencies</goal>
  192. </goals>
  193. <configuration>
  194. <!-- 依赖包输出目录 -->
  195. <outputDirectory>${project.build.directory}/${project.version}/lib</outputDirectory>
  196. <excludeTransitive>false</excludeTransitive>
  197. <stripVersion>false</stripVersion>
  198. <!-- 依赖包的作用域 -->
  199. <includeScope>runtime</includeScope>
  200. </configuration>
  201. </execution>
  202. </executions>
  203. </plugin>
  204. </plugins>
  205. </build>
  206. </project>