112-java-maven-plugins
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMaven Plugins: pom.xml Configuration Best Practices
Maven插件:pom.xml配置最佳实践
Configure Maven plugins and profiles in pom.xml using a structured, question-driven process that preserves existing configuration. This is an interactive SKILL.
What is covered in this Skill?
Maven plugins:
- Maven Compiler
- Maven Enforcer
- Maven Surefire
- Maven Failsafe
- HTML test reports (Surefire Report, JXR)
- Maven Spotless
- Maven Flatten
- Maven Versions
- Maven Git Commit ID
- Maven Jib
Maven profiles:
- JaCoCo (code coverage)
- PiTest (mutation testing)
- Security (OWASP dependency check)
- Static analysis (SpotBugs, PMD)
- SonarQube/SonarCloud
- JMH (Java Microbenchmark Harness)
- Cyclomatic complexity
通过结构化的、以问题为导向的流程配置pom.xml中的Maven插件和配置文件,同时保留现有配置。这是一个交互式SKILL。
本Skill涵盖哪些内容?
Maven插件:
- Maven Compiler
- Maven Enforcer
- Maven Surefire
- Maven Failsafe
- HTML测试报告(Surefire Report、JXR)
- Maven Spotless
- Maven Flatten
- Maven Versions
- Maven Git Commit ID
- Maven Jib
Maven配置文件:
- JaCoCo(代码覆盖率)
- PiTest(变异测试)
- 安全(OWASP依赖检查)
- 静态分析(SpotBugs、PMD)
- SonarQube/SonarCloud
- JMH(Java Microbenchmark Harness)
- 圈复杂度
Constraints
约束条件
Before applying plugin recommendations, ensure the project is in a valid state. Use a structured, question-driven process that preserves existing configuration and adds only what the user selects.
- MANDATORY: Run or
./mvnw validatebefore applying any plugin recommendationsmvn validate - SAFETY: If validation fails, stop and ask the user to fix issues—do not proceed until resolved
- SCOPE: Begin with Step 1 (existing configuration analysis) before any changes. Never remove or replace existing plugins; only add new ones that do not conflict
- BEFORE APPLYING: Read the reference for detailed plugin configurations, XML templates, and constraints for each step
应用插件建议之前,请确保项目处于有效状态。使用结构化的、以问题为导向的流程,保留现有配置,仅添加用户选择的内容。
- 强制要求:在应用任何插件建议之前,先运行或
./mvnw validatemvn validate - 安全要求:如果验证失败,请停止操作并要求用户修复问题——在问题解决前不要继续
- 范围限制:在进行任何更改之前,先从步骤1(现有配置分析)开始。切勿移除或替换现有插件;仅添加无冲突的新插件
- 应用前准备:阅读参考文档,了解每个步骤的详细插件配置、XML模板和约束条件
When to use this skill
何时使用本Skill
- Add Maven plugins in pom.xml
- Improve Maven plugins in pom.xml
- 在pom.xml中添加Maven插件
- 优化pom.xml中的Maven插件
Workflow
工作流程
- Validate project before plugin changes
Run or and stop if validation fails.
./mvnw validatemvn validate- Analyze current plugin and profile configuration
Start with existing configuration analysis to identify what is already declared and avoid conflicts or replacement.
- Read plugin reference and collect selections
Read , then use a question-driven flow to select only needed plugins/profiles.
references/112-java-maven-plugins.md- Add non-conflicting plugin configuration
Add selected plugins and profiles without removing existing ones, preserving project structure and compatibility.
- Summarize applied plugin setup
Report added plugins/profiles, rationale, and recommended follow-up commands or checks.
- 插件更改前验证项目
运行或,如果验证失败则停止操作。
./mvnw validatemvn validate- 分析当前插件和配置文件配置
从分析现有配置开始,确定已声明的内容,避免冲突或替换。
- 阅读插件参考文档并收集选择
阅读,然后通过以问题为导向的流程选择所需的插件/配置文件。
references/112-java-maven-plugins.md- 添加无冲突的插件配置
添加选定的插件和配置文件,不要移除现有内容,保留项目结构和兼容性。
- 总结已应用的插件设置
报告已添加的插件/配置文件、理由,以及推荐的后续命令或检查项。
Reference
参考文档
For detailed guidance, examples, and constraints, see references/112-java-maven-plugins.md.
如需详细指南、示例和约束条件,请查看references/112-java-maven-plugins.md。