pom.xml 13 KB

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