pom.xml 6.4 KB

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