111-java-maven-dependencies
Scannednpx machina-cli add skill jabrena/cursor-rules-java/111-java-maven-dependencies --openclawAdd Maven dependencies for improved code quality
Add essential Maven dependencies that enhance code quality and safety through a consultative, question-driven approach.
Components: JSpecify (nullness annotations, provided scope), Error Prone + NullAway (enhanced static analysis with compile-time null checking), VAVR (functional programming with Try/Either and immutable collections), and ArchUnit (architecture rule enforcement, test scope).
Prerequisites: Run mvn validate before any changes. Ensure Maven Wrapper exists; if not, stop and prompt the user to install it—do not proceed until resolved.
Before asking questions: Read the reference to use the exact wording and options from the template. Ask questions one-by-one in strict order (JSpecify → Enhanced Compiler Analysis (conditional) → VAVR → ArchUnit) and add only what the user selects. Use consultative language, present trade-offs, and wait for user responses before implementing.
Reference
For detailed guidance, examples, and constraints, see references/111-java-maven-dependencies.md.
Source
git clone https://github.com/jabrena/cursor-rules-java/blob/main/skills/111-java-maven-dependencies/SKILL.mdView on GitHub Overview
This skill helps you add Maven dependencies that improve code quality and safety, including JSpecify for nullness, Error Prone + NullAway for static analysis, VAVR for functional programming, and ArchUnit for architecture checks. It uses a consultative, question-by-question approach to add only what you actually need.
How This Skill Works
You follow a strict, order-based questionnaire: JSpecify first, then Enhanced Compiler Analysis (conditional), then VAVR, and finally ArchUnit. Only the selected components are added to your pom.xml, after verifying prerequisites with mvn validate and ensuring a Maven Wrapper exists.
When to Use It
- You want to begin with nullness guarantees using JSpecify (provided scope).
- You need conditional static analysis via Error Prone + NullAway to catch nulls at compile time.
- You plan to adopt functional programming features with VAVR (Try/Either, immutable collections).
- You want to enforce architecture rules in tests using ArchUnit (test scope).
- You prefer a consultative, stepwise process that adds only what you actually need.
Quick Start
- Step 1: Run mvn validate and ensure a Maven Wrapper exists; halt if not present.
- Step 2: Answer the questions in order: JSpecify → Enhanced Compiler Analysis (optional) → VAVR → ArchUnit.
- Step 3: Apply the selected dependencies to pom.xml and run mvn test to verify improvements.
Best Practices
- Start with JSpecify in provided scope and assess its impact before proceeding.
- Run mvn validate to verify prerequisites and check for a Maven Wrapper; halt if missing.
- Add dependencies incrementally and test after each selection to gauge benefits.
- Weigh trade-offs like compile time and project scope when enabling enhanced analysis.
- Document decisions and keep the dependency list focused to avoid bloating pom.xml.
Example Use Cases
- A legacy Java project adds JSpecify annotations (provided scope) to gradually improve null-safety.
- A team enables Error Prone + NullAway to catch nullability issues during compilation.
- A service adopts VAVR for Try/Either-based error handling and immutable collections.
- An enterprise app uses ArchUnit to enforce architectural rules within its test suite.
- A developer uses the consultative, stepwise approach to avoid unnecessary dependencies.