112 java maven plugins

From jabrena/cursor-rules-java · View interactive version

112 java maven plugins is an AI agent skill from the GitHub repository jabrena/cursor-rules-java. 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 benchma

How to use this skill

Skill file

Maven 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 profiles:

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.

When to use this skill

Workflow

  1. Validate project before plugin changes

Run ./mvnw validate or mvn validate and stop if validation fails.

  1. Analyze current plugin and profile configuration

Before making any changes to pom.xml:

  1. Scan existing plugins in <build><plugins>, <build><pluginManagement>, and <reporting><plugins>.
  2. Scan existing properties in <properties>.
  3. Scan existing profiles in <profiles>.
  4. Identify conflicts between existing configuration and possible additions.
  5. Preserve all existing plugins, properties, and profiles.
  6. Ask the user before enhancing any existing plugin, property, reporting entry, support file, or profile.
  7. Skip duplicate additions unless the user explicitly requests an enhancement.
  1. Check Maven Wrapper before plugin changes

Check for Maven Wrapper files in the project root:

If Maven Wrapper is not present, stop and ask:

"I notice this project doesn't have Maven Wrapper configured. The Maven Wrapper ensures everyone uses the same Maven version, improving build consistency across different environments. Would you like me to install it? (y/n)"

Wait for the user's response before asking any other question. If the user says "y", install it:

mvn wrapper:wrapper
  1. Ask Maven plugin assessment questions before reading references

Run this XML-included question flow before reading any plugin/profile implementation reference. Ask one question at a time, wait for the user's answer, and record selected plugins, profiles, and conditional values before continuing.

Question 1: What type of Java project is this?

Options:


Question 2: Which Java version does your project target?

Options:


Question 3: What build and quality aspects are important for your project?

Options:

Note: When "Cyclomatic Complexity" is selected, Step 20 will create a PMD ruleset file and profile. The ruleset location depends on project structure: src/main/pmd/pmd-cyclomatic-complexity.xml (mono-module) or pmd/pmd-cyclomatic-complexity.xml (multi-module).


Question 3.1 (conditional): What is your target container image for Jib?

Note: This question is only asked if "Container image build (Jib)" was selected in question 3.


Question 4: What is your target coverage threshold?

Options:

Note: This question is only asked if "Code coverage reporting (JaCoCo)" was selected in question 3.


Question 5: Do you want to configure Sonar/SonarCloud integration?** (y/n)

Note: This question is only asked if "Static code analysis (SpotBugs, Sonar)" was selected in question 3.

If yes, please provide the following information:


Question 5.1: What is your Sonar organization identifier?


Question 5.2: What is your Sonar project key?


Question 5.3: What is your Sonar project display name?


Question 5.4: Which Sonar service are you using? (conditional)

Note: This question is only asked if Sonar configuration was enabled in question 5.

Options:

If SonarQube Server: Please provide your SonarQube server URL (e.g., https://sonar.mycompany.com)


After all applicable questions are answered, confirm the selections and map them to references:

  1. Read selected references and add only selected configuration

Add selected plugins and profiles without removing existing ones, preserving project structure and compatibility. Add only the Maven properties, plugin configuration, profile configuration, reporting plugins, and support files required by the selected references.

  1. Summarize applied plugin setup

Report added plugins/profiles, rationale, and recommended follow-up commands or checks.

Reference

For detailed guidance, examples, and constraints, see:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.