$120 tested Claude codes · real before/after data · Full tier $15 one-timebuy --sheet=15 →
$Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. download --free →
clskills.sh — terminal v2.4 — 2,347 skills indexed● online
[CL]Skills_
JavabeginnerNew

Maven/Gradle

Share

Configure Maven or Gradle build system for Java projects

Works with OpenClaude

You are a Java build system configuration expert. The user wants to set up and configure Maven or Gradle for a Java project with proper dependency management and build profiles.

What to check first

  • Run java -version to confirm JDK is installed (Maven/Gradle require Java 8+)
  • Check if mvn -version or gradle --version returns output — if not, you need to install the build tool
  • Inspect the project root for existing pom.xml (Maven) or build.gradle (Gradle) files

Steps

  1. Choose your build system: Maven uses declarative XML (pom.xml), Gradle uses Groovy/Kotlin DSL (build.gradle or build.gradle.kts) — Gradle is faster for incremental builds
  2. Run mvn archetype:generate -DgroupId=com.example -DartifactId=myapp -DarchetypeArtifactId=maven-archetype-quickstart to scaffold a Maven project, or gradle init --type java-application for Gradle
  3. Define <groupId>, <artifactId>, and <version> in pom.xml (Maven) or group and version in build.gradle (Gradle) — these uniquely identify your artifact
  4. Add dependencies in the <dependencies> block (Maven) or dependencies {} block (Gradle) with exact versions pinned
  5. Configure source/target Java version using <maven.compiler.source> and <maven.compiler.target> tags (Maven) or java { sourceCompatibility = JavaVersion.VERSION_11 } (Gradle)
  6. Set up build profiles with <profiles> in pom.xml for dev/test/prod configurations, or use Gradle build types and flavors
  7. Run mvn clean compile (Maven) or gradle build (Gradle) to validate the configuration and download dependencies
  8. Configure plugins: add maven-surefire-plugin for tests in Maven, or test { useJUnitPlatform() } in Gradle for JUnit 5

Code

<!-- Maven: pom.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
         http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>my-java-app</artifactId>
    <version>1.0.0</version>
    <packaging>jar</packaging>

    <name>My Java

Note: this example was truncated in the source. See the GitHub repo for the latest full version.

Common Pitfalls

  • Treating this skill as a one-shot solution — most workflows need iteration and verification
  • Skipping the verification steps — you don't know it worked until you measure
  • Applying this skill without understanding the underlying problem — read the related docs first

When NOT to Use This Skill

  • When a simpler manual approach would take less than 10 minutes
  • On critical production systems without testing in staging first
  • When you don't have permission or authorization to make these changes

How to Verify It Worked

  • Run the verification steps documented above
  • Compare the output against your expected baseline
  • Check logs for any warnings or errors — silent failures are the worst kind

Production Considerations

  • Test in staging before deploying to production
  • Have a rollback plan — every change should be reversible
  • Monitor the affected systems for at least 24 hours after the change

Quick Info

CategoryJava
Difficultybeginner
Version1.0.0
AuthorClaude Skills Hub
javamavengradle

Install command:

curl -o ~/.claude/skills/maven-gradle.md https://claude-skills-hub.vercel.app/skills/java/maven-gradle.md

Related Java Skills

Other Claude Code skills in the same category — free to download.

Want a Java skill personalized to YOUR project?

This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.