Agent skill

110-java-maven-best-practices

Use when you need to review, improve, or troubleshoot a Maven pom.xml file — including dependency management with BOMs, plugin configuration, version centralization, multi-module project structure, build profiles, or any situation where you want to align your Maven setup with industry best practices. Part of the skills-for-java project

Stars 350
Forks 63

Install this agent skill to your Project

npx add-skill https://github.com/jabrena/cursor-rules-java/tree/main/skills/110-java-maven-best-practices

Metadata

Additional technical details for this skill

author
Juan Antonio Breña Moral
version
0.14.0

SKILL.md

Maven Best Practices

Improve Maven POM configuration using industry-standard best practices.

What is covered in this Skill?

  • Dependency management via <dependencyManagement> and BOMs
  • Standard directory layout (src/main/java, src/test/java)
  • Centralized plugin management
  • Build profiles for environment-specific settings
  • Readable POM structure with version properties
  • Explicit repository declaration
  • Version centralization
  • Multi-module project structure with proper inheritance
  • Cross-module version consistency
  • Multi-module scope: After reading the root pom.xml, check for a <modules> section. If present, read every child module's pom.xml before making any recommendations.
  • Check each child for hardcoded versions that duplicate parent <dependencyManagement>, redundant <pluginManagement> blocks, properties that should be centralized, and version drift across sibling modules.

Constraints

Before applying Maven best practices recommendations, ensure the project is in a valid state by running Maven validation. This helps identify any existing configuration issues that need to be resolved first. For multi-module projects, scope analysis must cover every child module POM — not just the root.

  • MANDATORY: Run ./mvnw validate or mvn validate before applying any Maven best practices recommendations
  • VERIFY: Ensure all validation errors are resolved before proceeding with POM modifications
  • SAFETY: If validation fails, do not continue and ask the user to fix the issues before continuing
  • MULTI-MODULE DISCOVERY: After reading the root pom.xml, check whether it contains a <modules> section. If it does, read every child module's pom.xml before making any recommendations — analysis scope is the full module tree, not only the root
  • CROSS-MODULE SCOPE: When child modules exist, check each one for: hardcoded dependency versions that duplicate <dependencyManagement> in the parent, plugin configurations that duplicate <pluginManagement>, properties that should be centralized in the parent, and version drift (same artifact declared at different versions across sibling modules)
  • BEFORE APPLYING: Read the reference for detailed examples, good/bad patterns, and constraints

When to use this skill

  • Review pom.xml to improve it
  • Apply Maven best practices to pom.xml
  • Improve Maven POM configuration

Reference

For detailed guidance, examples, and constraints, see references/110-java-maven-best-practices.md.

Expand your agent's capabilities with these related and highly-rated skills.

jabrena/cursor-rules-java

513-frameworks-micronaut-db-migrations-flyway

Use when you need to add or review Flyway database migrations in a Micronaut application — micronaut-flyway, db/migration scripts, flyway.datasources.* configuration, and alignment with JDBC or Micronaut Data. Part of the skills-for-java project

350 63
Explore
jabrena/cursor-rules-java

014-agile-user-story

Guides the creation of agile user stories and Gherkin feature files. Use when the user wants to create a user story, write acceptance criteria, define Gherkin scenarios, or author BDD feature files. Part of the skills-for-java project

350 63
Explore
jabrena/cursor-rules-java

502-frameworks-micronaut-rest

Use when you need to design, review, or improve REST APIs with Micronaut — including @Controller routes, HTTP status codes, DTOs, Bean Validation, exception handlers, pagination, idempotency, ETag/If-Match, caching headers, versioning, contract-first OpenAPI (OpenAPI Generator), optional runtime OpenAPI via micronaut-openapi, and security annotations. Part of the skills-for-java project

350 63
Explore
jabrena/cursor-rules-java

114-java-maven-search

Covers Maven Central search (Search API, maven-metadata.xml, artifact URLs) and project-local update reports via versions-maven-plugin (display-property-updates, display-dependency-updates, display-plugin-updates). Use when finding or verifying coordinates, browsing Central, or checking what newer versions apply to the user’s pom.xml. Part of the skills-for-java project

350 63
Explore
jabrena/cursor-rules-java

323-frameworks-spring-boot-testing-acceptance-tests

Use when you need to implement acceptance tests from a Gherkin .feature file for Spring Boot applications — including finding scenarios tagged @acceptance, implementing happy path tests with TestRestTemplate, @SpringBootTest, Testcontainers with @ServiceConnection for DB/Kafka, and WireMock for external REST stubs. Requires .feature file in context. Part of the skills-for-java project

350 63
Explore
jabrena/cursor-rules-java

200-agents-md

Use when you need to generate an AGENTS.md file for a Java repository — covering project conventions, tech stack, file structure, commands, Git workflow, and contributor boundaries — through a modular, step-based interactive process that adapts to your specific project needs. Part of the skills-for-java project

350 63
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results