Cursor-rules-java 112-java-maven-plugins
Use when you need to add or configure Maven plugins in your pom.xml — including quality tools (enforcer, surefire, failsafe, jacoco, pitest, spotbugs, pmd), security scanning (OWASP), code formatting (Spotless), version management, container image build (Jib), build information tracking, and benchmarking (JMH) — through a consultative, modular step-by-step approach that only adds what you actually need. Part of the skills-for-java project
git clone https://github.com/jabrena/cursor-rules-java
T=$(mktemp -d) && git clone --depth=1 https://github.com/jabrena/cursor-rules-java "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/112-java-maven-plugins" ~/.claude/skills/jabrena-cursor-rules-java-112-java-maven-plugins && rm -rf "$T"
skills/112-java-maven-plugins/SKILL.mdMaven Plugins: pom.xml Configuration Best Practices
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
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 validate
before 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
When to use this skill
- Add Maven plugins in pom.xml
- Improve Maven plugins in pom.xml
Reference
For detailed guidance, examples, and constraints, see references/112-java-maven-plugins.md.