pom.xml 6.7 KB

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