pom.xml 6.2 KB

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