介绍
默认框架集成了以下插件:
名称 | 版本 | 用途 | 描述 |
---|---|---|---|
spotless-maven-plugin | 2.43.0 | 使用 | 代码格式化工具 |
maven-compiler-plugin | 3.12.1 | 使用 | 注解处理包括mapstruct-plus-processor,spring-boot-configuration-processor,lombok-mapstruct-binding |
maven-enforcer-plugin | 3.4.1 | 使用 | 强制规则检查 |
dependency-check-maven | 9.0.9 | 声明 | 库安全检查 下载jsrepository.json并将该文件放到maven私仓地址\org\owasp\dependency-check-data\版本号目录下执行完毕后, 会在target目录下产生dependency-check-report.html文件 |
jib-maven-plugin | 3.4.2 | 声明 | 无 docker 环境下构建镜像 |
sonar-maven-plugin | 3.11.0.3922 | 声明 | sonarqube 9版本 |
git-changelog-maven-plugin | 2.1.0 | 声明 | 生成md格式的changelog文件 |
spotless-maven-plugin 代码格式化工具
默认配置此插件,在编译时会执行代码格式化
maven-enforcer-plugin 强制规则检查
默认配置此插件,在编译时会执行依赖冲突等相关检测
dependency-check-maven 漏洞检查
使用的是CVE漏洞数据,执行红色箭头标识的命令,结果会存放到target目录dependency-check-report.html
jib-maven-plugin docker镜像构建
此插件可以直接构建 docker 镜像并推送到镜像服务器上,也可以构建 tar 文件, load 到主机。 引入插件
xml
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<configuration>
<container>
<mainClass>com.feiniaojin.gracefuresponse.example.ExampleApplication</mainClass>
</container>
<from>
<image>openjdk:11.0.16</image>
</from>
<to>
<image>命名空间/yyour-image-name:1.0.0</image>
</to>
</configuration>
</plugin>
- mainClass 为入口类。
- from 下的 image 为基础镜像。
- to 下的 image 为构建的镜像名称。
具体使用参数参见相关文档。
sonar-maven-plugin 插件
此插件需要配合 sonarqube-9 版本使用,用来做代码质量管理。 pom 配置
xml
<properties>
<sonar.host.url>http://localhost:9000</sonar.host.url>
<sonar.login>admin</sonar.login>
<sonar.password>123456</sonar.password>
</properties>
具体使用参数参见相关文档
git-changelog-maven-plugin 插件
git-changelog-maven-plugin 是一款用于生成项目变更日志的 Maven 插件,其核心功能是通过解析Git仓库的提交历史其提交信息要遵循Conventional Commits规范,自动生成标准化的 CHANGELOG 文件。
插件网址为 https://github.com/tomasbjerre/git-changelog-maven-plugin
使用方式为在项目根目录下建立 changelog.json 和 changelog_template.mustache 文件,提供以下示例,具体可以根据实际情况和官网文档进行修改
changelog.json
json
{
"fromRepo": ".",
"toRef": "HEAD",
"ignoreCommitsIfMessageMatches": "^\\[maven-release-plugin\\].*|^\\[Gradle Release Plugin\\].*|^Merge.*",
"readableTagName": "-([^-]+?)$",
"dateFormat": "YYYY-MM-dd HH:mm:ss",
"timeZone": "UTC",
"removeIssueFromMessage": "true"
}
changelog_template.mustache
txt
# 🚀 Changelog
{{#tags}}
{{#ifReleaseTag .}}
## [{{name}}] ({{tagDate .}})
{{/ifReleaseTag}}
{{/tags}}
{{#ifContainsType commits type='feat'}}
### 🆕 新增
{{#commits}}
{{#ifCommitType . type='feat'}}
- {{#eachCommitScope .}} **{{.}}** {{/eachCommitScope}} {{{commitDescription .}}} ([{{hash}}](https://gitservice/commit/{{hashFull}}))
{{/ifCommitType}}
{{/commits}}
{{/ifContainsType}}
{{#ifContainsType commits type='fix'}}
### 🐞 修复
{{#commits}}
{{#ifCommitType . type='fix'}}
- {{#eachCommitScope .}} **{{.}}** {{/eachCommitScope}} {{{commitDescription .}}} ([{{hash}}](https://gitservice/commit/{{hashFull}}))
{{/ifCommitType}}
{{/commits}}
{{/ifContainsType}}
{{#ifContainsType commits type='refactor'}}
### 🛠 优化
{{#commits}}
{{#ifCommitType . type='refactor'}}
- {{#eachCommitScope .}} **{{.}}** {{/eachCommitScope}} {{{commitDescription .}}} ([{{hash}}](https://gitservice/commit/{{hashFull}}))
{{/ifCommitType}}
{{/commits}}
{{/ifContainsType}}
执行图片标红操作
生成以下变更文件