pom.xml 14 KB

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