pom.xml 7.0 KB

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