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