pom.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  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>bnt</artifactId>
  7. <groupId>cn.reghao.bnt</groupId>
  8. <version>1.0.0</version>
  9. </parent>
  10. <modelVersion>4.0.0</modelVersion>
  11. <artifactId>web</artifactId>
  12. <version>1.0.0</version>
  13. <packaging>jar</packaging>
  14. <properties>
  15. <project.build.outputDir>${project.parent.basedir}/bin/mgr</project.build.outputDir>
  16. <springboot.version>3.2.1</springboot.version>
  17. </properties>
  18. <dependencyManagement>
  19. <dependencies>
  20. <dependency>
  21. <groupId>org.springframework.boot</groupId>
  22. <artifactId>spring-boot-dependencies</artifactId>
  23. <version>${springboot.version}</version>
  24. <type>pom</type>
  25. <scope>import</scope>
  26. </dependency>
  27. </dependencies>
  28. </dependencyManagement>
  29. <dependencies>
  30. <dependency>
  31. <groupId>cn.reghao.bnt</groupId>
  32. <artifactId>common</artifactId>
  33. <version>1.0.0-SNAPSHOT</version>
  34. </dependency>
  35. <dependency>
  36. <groupId>cn.reghao.jutil</groupId>
  37. <artifactId>web</artifactId>
  38. <version>jdk17-SNAPSHOT</version>
  39. </dependency>
  40. <dependency>
  41. <groupId>org.springframework.boot</groupId>
  42. <artifactId>spring-boot-starter-web</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. <dependency>
  50. <groupId>org.springframework.boot</groupId>
  51. <artifactId>spring-boot-starter-websocket</artifactId>
  52. </dependency>
  53. <dependency>
  54. <groupId>org.springframework.boot</groupId>
  55. <artifactId>spring-boot-starter-security</artifactId>
  56. </dependency>
  57. <dependency>
  58. <groupId>org.springframework.session</groupId>
  59. <artifactId>spring-session-jdbc</artifactId>
  60. </dependency>
  61. <dependency>
  62. <groupId>org.springframework.boot</groupId>
  63. <artifactId>spring-boot-starter-cache</artifactId>
  64. </dependency>
  65. <dependency>
  66. <groupId>com.github.ben-manes.caffeine</groupId>
  67. <artifactId>caffeine</artifactId>
  68. </dependency>
  69. <dependency>
  70. <groupId>com.mysql</groupId>
  71. <artifactId>mysql-connector-j</artifactId>
  72. <version>8.0.31</version>
  73. </dependency>
  74. <dependency>
  75. <groupId>com.zaxxer</groupId>
  76. <artifactId>HikariCP</artifactId>
  77. <version>3.3.1</version>
  78. </dependency>
  79. <dependency>
  80. <groupId>org.springframework.boot</groupId>
  81. <artifactId>spring-boot-starter-data-jpa</artifactId>
  82. </dependency>
  83. <dependency>
  84. <groupId>jakarta.validation</groupId>
  85. <artifactId>jakarta.validation-api</artifactId>
  86. <version>3.0.2</version>
  87. </dependency>
  88. <dependency>
  89. <groupId>jakarta.annotation</groupId>
  90. <artifactId>jakarta.annotation-api</artifactId>
  91. <version>2.1.1</version>
  92. </dependency>
  93. <dependency>
  94. <groupId>org.hibernate.validator</groupId>
  95. <artifactId>hibernate-validator</artifactId>
  96. <version>8.0.1.Final</version>
  97. </dependency>
  98. <dependency>
  99. <groupId>org.springframework.boot</groupId>
  100. <artifactId>spring-boot-starter-freemarker</artifactId>
  101. </dependency>
  102. <dependency>
  103. <groupId>org.freemarker</groupId>
  104. <artifactId>freemarker</artifactId>
  105. <version>2.3.34</version>
  106. </dependency>
  107. <dependency>
  108. <groupId>org.springdoc</groupId>
  109. <artifactId>springdoc-openapi-ui</artifactId>
  110. <version>1.7.0</version>
  111. </dependency>
  112. <!--########################################################################################################-->
  113. <!-- 监控报警依赖 -->
  114. <dependency>
  115. <groupId>org.springframework.boot</groupId>
  116. <artifactId>spring-boot-starter-actuator</artifactId>
  117. </dependency>
  118. <dependency>
  119. <groupId>io.micrometer</groupId>
  120. <artifactId>micrometer-core</artifactId>
  121. </dependency>
  122. <dependency>
  123. <groupId>io.micrometer</groupId>
  124. <artifactId>micrometer-registry-prometheus</artifactId>
  125. </dependency>
  126. <!--########################################################################################################-->
  127. <!-- devops 模块依赖 -->
  128. <dependency>
  129. <groupId>org.eclipse.jgit</groupId>
  130. <artifactId>org.eclipse.jgit</artifactId>
  131. <version>6.4.0.202211300538-r</version>
  132. </dependency>
  133. <dependency>
  134. <groupId>org.eclipse.jgit</groupId>
  135. <artifactId>org.eclipse.jgit.ssh.apache</artifactId>
  136. <version>6.4.0.202211300538-r</version>
  137. </dependency>
  138. <dependency>
  139. <groupId>org.apache.maven</groupId>
  140. <artifactId>maven-model</artifactId>
  141. <version>3.6.0</version>
  142. </dependency>
  143. <dependency>
  144. <groupId>org.apache.maven.shared</groupId>
  145. <artifactId>maven-invoker</artifactId>
  146. <version>3.0.1</version>
  147. </dependency>
  148. <dependency>
  149. <groupId>com.github.mwiede</groupId>
  150. <artifactId>jsch</artifactId>
  151. <version>2.27.5</version>
  152. </dependency>
  153. <dependency>
  154. <groupId>commons-io</groupId>
  155. <artifactId>commons-io</artifactId>
  156. <version>2.6</version>
  157. </dependency>
  158. <!-- 阿里云 sdk 依赖 -->
  159. <dependency>
  160. <groupId>com.aliyun.oss</groupId>
  161. <artifactId>aliyun-sdk-oss</artifactId>
  162. <version>3.8.0</version>
  163. </dependency>
  164. <dependency>
  165. <groupId>com.aliyun</groupId>
  166. <artifactId>cdn20180510</artifactId>
  167. <version>3.2.0</version>
  168. </dependency>
  169. <dependency>
  170. <groupId>com.aliyun</groupId>
  171. <artifactId>sts20150401</artifactId>
  172. <version>1.1.4</version>
  173. </dependency>
  174. </dependencies>
  175. <profiles>
  176. <profile>
  177. <id>dev</id>
  178. <properties>
  179. <profile.active>dev</profile.active>
  180. </properties>
  181. <activation>
  182. <activeByDefault>true</activeByDefault>
  183. </activation>
  184. </profile>
  185. <profile>
  186. <id>test</id>
  187. <properties>
  188. <profile.active>test</profile.active>
  189. </properties>
  190. </profile>
  191. <profile>
  192. <id>prod</id>
  193. <properties>
  194. <profile.active>prod</profile.active>
  195. </properties>
  196. </profile>
  197. </profiles>
  198. <build>
  199. <finalName>bnt${project.artifactId}</finalName>
  200. <resources>
  201. <resource>
  202. <directory>src/main/resources</directory>
  203. <filtering>true</filtering>
  204. <includes>
  205. <include>banner.txt</include>
  206. <include>application.yml</include>
  207. <include>application-${profile.active}.yml</include>
  208. <include>logback-spring.xml</include>
  209. <include>git.properties</include>
  210. <!-- 前端静态资源 -->
  211. <include>static/**</include>
  212. <include>templates/**</include>
  213. </includes>
  214. </resource>
  215. </resources>
  216. <plugins>
  217. <plugin>
  218. <groupId>org.apache.maven.plugins</groupId>
  219. <artifactId>maven-compiler-plugin</artifactId>
  220. <version>3.11.0</version>
  221. <configuration>
  222. <compilerArgs>
  223. <arg>-parameters</arg>
  224. </compilerArgs>
  225. </configuration>
  226. </plugin>
  227. <plugin>
  228. <groupId>org.apache.maven.plugins</groupId>
  229. <artifactId>maven-resources-plugin</artifactId>
  230. <version>2.4.3</version>
  231. <configuration>
  232. <!-- 让 maven 不处理字体 -->
  233. <nonFilteredFileExtensions>
  234. <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
  235. <nonFilteredFileExtension>woff</nonFilteredFileExtension>
  236. <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
  237. <nonFilteredFileExtension>fbx</nonFilteredFileExtension>
  238. </nonFilteredFileExtensions>
  239. </configuration>
  240. </plugin>
  241. <plugin>
  242. <groupId>org.springframework.boot</groupId>
  243. <artifactId>spring-boot-maven-plugin</artifactId>
  244. <version>${springboot.version}</version>
  245. <executions>
  246. <execution>
  247. <goals>
  248. <goal>repackage</goal>
  249. </goals>
  250. </execution>
  251. </executions>
  252. <configuration>
  253. <!-- 生成的 jar 包输出到指定目录 -->
  254. <outputDirectory>${project.build.outputDir}</outputDirectory>
  255. </configuration>
  256. </plugin>
  257. <!--git-commit-id-plugin 插件,用于实现打包带git版本信息-->
  258. <plugin>
  259. <groupId>pl.project13.maven</groupId>
  260. <artifactId>git-commit-id-plugin</artifactId>
  261. <version>2.1.5</version>
  262. <executions>
  263. <execution>
  264. <goals>
  265. <goal>revision</goal>
  266. </goals>
  267. </execution>
  268. </executions>
  269. <configuration>
  270. <!--日期格式;默认值:dd.MM.yyyy '@' HH:mm:ss z;-->
  271. <dateFormat>yyyy-MM-dd HH:mm:ss</dateFormat>
  272. <!--,构建过程中,是否打印详细信息;默认值:false;-->
  273. <verbose>true</verbose>
  274. <!-- ".git"文件路径;默认值:${project.basedir}/.git;
  275. 注意: 如果是多模块(多模块)项目,则需要修改到.git文件夹的目录-->
  276. <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
  277. <!--若项目打包类型为pom,是否取消构建;默认值:true;-->
  278. <skipPoms>false</skipPoms>
  279. <!--是否生成"git.properties"文件;默认值:false;-->
  280. <generateGitPropertiesFile>true</generateGitPropertiesFile>
  281. <!--指定"git.properties"文件的存放路径(相对于${project.basedir}的一个路径);
  282. 注意:该地址决定接口代码是否可以读取到git版本信息,请自行修改-->
  283. <generateGitPropertiesFilename>src/main/resources/git.properties</generateGitPropertiesFilename>
  284. <!--".git"文件夹未找到时,构建是否失败;若设置true,则构建失败;若设置false,则跳过执行该目标;默认值:true;-->
  285. <failOnNoGitDirectory>true</failOnNoGitDirectory>
  286. <!--git描述配置,可选;由JGit提供实现;-->
  287. <gitDescribe>
  288. <!--是否生成描述属性-->
  289. <skip>false</skip>
  290. <!--提交操作未发现tag时,仅打印提交操作ID,-->
  291. <always>false</always>
  292. <!--提交操作ID显式字符长度,最大值为:40;默认值:7;
  293. 0代表特殊意义;后面有解释;
  294. -->
  295. <abbrev>8</abbrev>
  296. <!--构建触发时,代码有修改时(即"dirty state"),添加指定后缀;默认值:"";-->
  297. <dirty>-dirty</dirty>
  298. <!--always print using the "tag-commits_from_tag-g_commit_id-maybe_dirty" format, even if "on" a tag.
  299. The distance will always be 0 if you're "on" the tag.
  300. -->
  301. <forceLongFormat>false</forceLongFormat>
  302. </gitDescribe>
  303. </configuration>
  304. </plugin>
  305. <!--apache maven插件,用于执行ant脚本函数-->
  306. <plugin>
  307. <groupId>org.apache.maven.plugins</groupId>
  308. <artifactId>maven-antrun-plugin</artifactId>
  309. <version>1.8</version>
  310. <executions>
  311. <execution>
  312. <!--maven 插件生命周期,我试过用compile 发现打包以后没有git.properties,因为打包的时候,还没有生成
  313. 注意,这里改成 initialize 的话, 上面 git-commit-id-plugin 插件对应也该添加 phase 配置,并设置为 initialize
  314. 否则你生成的文件,写入的就不会对应的值,而是变量名-->
  315. <phase>initialize</phase>
  316. <goals>
  317. <goal>run</goal>
  318. </goals>
  319. <configuration>
  320. <tasks>
  321. <echo message="写入 git 版本信息"/>
  322. <!-- concat 常用于把一些信息写入文件,我这里用于把 git-commit-id-plugin 生成的git环境变量写入文件 -->
  323. <concat destfile="src/main/resources/git.properties">
  324. repo=${git.remote.origin.url}
  325. branch=${git.branch}
  326. commitId=${git.commit.id.abbrev}
  327. commitTime=${git.commit.time}
  328. buildTime=${git.build.time}
  329. </concat>
  330. </tasks>
  331. </configuration>
  332. </execution>
  333. </executions>
  334. </plugin>
  335. </plugins>
  336. </build>
  337. </project>