pom.xml 6.7 KB

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