pom.xml 6.6 KB

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