# 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. This should trigger for requests such as Review pom.xml to improve it; Apply Maven best practices…

- **Type:** Skill
- **Install:** `agentstack add skill-jabrena-cursor-rules-java-110-java-maven-best-practices`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [jabrena](https://agentstack.voostack.com/s/jabrena)
- **Installs:** 0
- **Category:** [Developer Tools](https://agentstack.voostack.com/c/developer-tools)
- **Latest version:** 0.1.0
- **License:** Apache-2.0
- **Upstream author:** [jabrena](https://github.com/jabrena)
- **Source:** https://github.com/jabrena/cursor-rules-java/tree/main/skills/110-java-maven-best-practices
- **Website:** https://jabrena.github.io/cursor-rules-java/

## Install

```sh
agentstack add skill-jabrena-cursor-rules-java-110-java-maven-best-practices
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Maven Best Practices

Improve Maven POM configuration using industry-standard best practices.

**What is covered in this Skill?**

- Dependency management via `` 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 `` section. If present, read **every** child module's `pom.xml` before making any recommendations.
- Check each child for hardcoded versions that duplicate parent ``, redundant `` 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 `` 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 `` in the parent, plugin configurations that duplicate ``, 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

## Workflow

1. **Validate project before recommendations**

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

2. **Read reference and analyze root POM**

Read `references/110-java-maven-best-practices.md`, then inspect root `pom.xml` structure, dependency management, plugin management, properties, and profiles.

3. **Expand to full module tree when present**

If root has a `` section, read every child `pom.xml` and evaluate cross-module duplication, centralization opportunities, and version drift.

4. **Provide prioritized best-practice recommendations**

Propose concrete, safe improvements aligned with Maven best practices and full-module findings.

## Reference

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

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [jabrena](https://github.com/jabrena)
- **Source:** [jabrena/cursor-rules-java](https://github.com/jabrena/cursor-rules-java)
- **License:** Apache-2.0
- **Homepage:** https://jabrena.github.io/cursor-rules-java/

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-jabrena-cursor-rules-java-110-java-maven-best-practices
- Seller: https://agentstack.voostack.com/s/jabrena
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
