[关闭]
@liruiyi962464 2025-05-15T03:39:57.000000Z 字数 4986 阅读 24

依赖jar包&配置文件 脱离部署jar包(徐哥研究的)

代码


108行开始是重点

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5. <parent>
  6. <artifactId>jeecg-module-system</artifactId>
  7. <groupId>org.jeecgframework.boot</groupId>
  8. <version>3.7.0</version>
  9. </parent>
  10. <modelVersion>4.0.0</modelVersion>
  11. <artifactId>jeecg-system-start</artifactId>
  12. <repositories>
  13. <repository>
  14. <releases>
  15. <enabled>false</enabled>
  16. </releases>
  17. <snapshots>
  18. <enabled>true</enabled>
  19. </snapshots>
  20. <id>ias-snapshots</id>
  21. <name>Infinite Automation Snapshot Repository</name>
  22. <url>https://maven.mangoautomation.net/repository/ias-snapshot/</url>
  23. </repository>
  24. <repository>
  25. <releases>
  26. <enabled>true</enabled>
  27. </releases>
  28. <snapshots>
  29. <enabled>false</enabled>
  30. </snapshots>
  31. <id>ias-releases</id>
  32. <name>Infinite Automation Release Repository</name>
  33. <url>https://maven.mangoautomation.net/repository/ias-release/</url>
  34. </repository>
  35. </repositories>
  36. <dependencies>
  37. <!-- SYSTEM 系统管理模块 -->
  38. <dependency>
  39. <groupId>org.jeecgframework.boot</groupId>
  40. <artifactId>jeecg-system-biz</artifactId>
  41. <version>${jeecgboot.version}</version>
  42. </dependency>
  43. <!-- DEMO 示例模块 -->
  44. <dependency>
  45. <groupId>org.jeecgframework.boot</groupId>
  46. <artifactId>jeecg-module-demo</artifactId>
  47. <version>${jeecgboot.version}</version>
  48. </dependency>
  49. <!-- flyway 数据库自动升级 -->
  50. <dependency>
  51. <groupId>org.flywaydb</groupId>
  52. <artifactId>flyway-core</artifactId>
  53. </dependency>
  54. <dependency>
  55. <groupId>com.sun.jna</groupId>
  56. <artifactId>darwin</artifactId>
  57. <version>1.0</version>
  58. </dependency>
  59. <dependency>
  60. <groupId>com.sun.jna</groupId>
  61. <artifactId>examples</artifactId>
  62. <version>1.0</version>
  63. </dependency>
  64. <dependency>
  65. <groupId>org.json</groupId>
  66. <artifactId>haikang</artifactId>
  67. <version>1.0</version>
  68. </dependency>
  69. <!-- Rs485 modbus协议引入依赖 对接声光报警器-->
  70. <dependency>
  71. <groupId>com.infiniteautomation</groupId>
  72. <artifactId>modbus4j</artifactId>
  73. <version>3.0.3</version>
  74. </dependency>
  75. <!-- 串口依赖包 2024-8-14 muzi -->
  76. <dependency>
  77. <groupId>org.rxtx</groupId>
  78. <artifactId>rxtx</artifactId>
  79. <version>2.1.7</version>
  80. </dependency>
  81. <!-- modbus对接测试用 2024-8-14 muzi-->
  82. <dependency>
  83. <groupId>com.fazecast</groupId>
  84. <artifactId>jSerialComm</artifactId>
  85. <version>2.9.2</version>
  86. </dependency>
  87. <dependency>
  88. <groupId>com.sgcc.uds.cloud</groupId>
  89. <artifactId>uds-sdk-java</artifactId>
  90. <version>2.1.1</version>
  91. </dependency>
  92. <dependency>
  93. <groupId>com.sgcc.uds.cloud</groupId>
  94. <artifactId>uds-ms-metadata-rpc-dto</artifactId>
  95. <version>2.1.1</version>
  96. </dependency>
  97. </dependencies>
  98. <build>
  99. <finalName>nei-yunwei-1.0.0</finalName>
  100. <plugins>
  101. <!--
  102. <plugin>
  103. <groupId>org.springframework.boot</groupId>
  104. <artifactId>spring-boot-maven-plugin</artifactId>
  105. <version>2.6.13</version>
  106. </plugin>
  107. -->
  108. <!-- 分离lib -->
  109. <plugin>
  110. <!-- 把依赖的jar包复制出来放到编译后的target/lib目录,并且在打包时候排除内部依赖 -->
  111. <groupId>org.apache.maven.plugins</groupId>
  112. <artifactId>maven-dependency-plugin</artifactId>
  113. <executions>
  114. <execution>
  115. <id>copy-dependencies</id>
  116. <phase>prepare-package</phase>
  117. <goals>
  118. <goal>copy-dependencies</goal>
  119. </goals>
  120. <configuration>
  121. <outputDirectory>${project.build.directory}/lib</outputDirectory>
  122. <overWriteReleases>false</overWriteReleases>
  123. <overWriteSnapshots>false</overWriteSnapshots>
  124. <overWriteIfNewer>true</overWriteIfNewer>
  125. </configuration>
  126. </execution>
  127. </executions>
  128. </plugin>
  129. <!-- 分离资源文件 -->
  130. <plugin>
  131. <artifactId>maven-resources-plugin</artifactId>
  132. <executions>
  133. <execution>
  134. <id>copy-resources</id>
  135. <phase>package</phase>
  136. <goals>
  137. <goal>copy-resources</goal>
  138. </goals>
  139. <configuration>
  140. <resources>
  141. <resource>
  142. <directory>src/main/resources</directory>
  143. </resource>
  144. </resources>
  145. <outputDirectory>${project.build.directory}/resources</outputDirectory>
  146. </configuration>
  147. </execution>
  148. </executions>
  149. </plugin>
  150. <!-- 打包jar -->
  151. <plugin>
  152. <groupId>org.apache.maven.plugins</groupId>
  153. <artifactId>maven-jar-plugin</artifactId>
  154. <configuration>
  155. <archive>
  156. <!-- 指定资源文件目录,与打包的jar文件同级目录 -->
  157. <manifestEntries>
  158. <Class-Path>resources/</Class-Path>
  159. </manifestEntries>
  160. <manifest>
  161. <addClasspath>true</addClasspath>
  162. <classpathPrefix>lib/</classpathPrefix>
  163. <mainClass>org.jeecg.JeecgSystemApplication</mainClass>
  164. </manifest>
  165. </archive>
  166. <!-- 打包时忽略的文件(也就是不打进jar包里的文件),本例将resources下的.yml、.properties文件全部排除 -->
  167. <excludes>
  168. <exclude>**/*.yml</exclude>
  169. <exclude>**/resources/*.xml</exclude>
  170. <exclude>**/*.properties</exclude>
  171. </excludes>
  172. </configuration>
  173. </plugin>
  174. <plugin>
  175. <groupId>org.springframework.boot</groupId>
  176. <artifactId>spring-boot-maven-plugin</artifactId>
  177. <!-- <version>2.6.13</version>-->
  178. <configuration>
  179. <includeSystemScope>true</includeSystemScope>
  180. <layout>ZIP</layout>
  181. <includes>
  182. <include>
  183. <groupId>non-exists</groupId>
  184. <artifactId>non-exists</artifactId>
  185. </include>
  186. </includes>
  187. </configuration>
  188. <executions>
  189. <execution>
  190. <goals>
  191. <goal>repackage</goal>
  192. </goals>
  193. </execution>
  194. </executions>
  195. </plugin>
  196. </plugins>
  197. </build>
  198. <!-- <build>-->
  199. <!-- <plugins>-->
  200. <!-- <plugin>-->
  201. <!-- <groupId>org.springframework.boot</groupId>-->
  202. <!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
  203. <!-- <configuration>-->
  204. <!-- <includeSystemScope>true</includeSystemScope>-->
  205. <!-- </configuration>-->
  206. <!-- </plugin>-->
  207. <!-- </plugins>-->
  208. <!-- </build>-->
  209. </project>
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注