pom.xml 13 KB

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