con un clic
maven-gradle
Maven and Gradle build tools, dependency management, multi-module projects
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Maven and Gradle build tools, dependency management, multi-module projects
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional SOC
Core Java patterns, modern Java features (JDK 17+), best practices
JUnit 5 testing patterns with Mockito and AssertJ
Spring Boot 3 patterns for controllers, services, configuration, and validation
Spring Data JPA and Hibernate patterns for entities, repositories, and query performance
Spring Security 6 patterns for authentication, authorization, and OAuth2
Spring Boot testing with @SpringBootTest, MockMvc, and Testcontainers
| name | maven-gradle |
| description | Maven and Gradle build tools, dependency management, multi-module projects |
| keywords | ["maven","gradle","pom","build","dependency","plugin","multi-module","profile","artifact","repository"] |
| filePatterns | ["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties"] |
| frameworks | ["maven","gradle"] |
| tokenCount | 1200 |
| version | 1.0.0 |
Build tool patterns for Java/Kotlin projects. Choose based on project needs, not popularity.
| Criteria | Maven | Gradle |
|---|---|---|
| Convention over config | ✅ Strong | ⚠️ Flexible |
| Build speed | ⚠️ Slower | ✅ Incremental |
| Learning curve | ✅ Lower | ⚠️ Higher |
| Multi-module | ✅ Good | ✅ Excellent |
| Kotlin DSL | ❌ XML only | ✅ Native |
| IDE support | ✅ Excellent | ✅ Excellent |
Rule of thumb:
| File | Description | When to Read |
|---|---|---|
maven-basics.md | POM structure, lifecycle | Maven projects |
gradle-basics.md | Build scripts, tasks | Gradle projects |
multi-module.md | Parent POMs, subprojects | Monorepo setup |
dependencies.md | Dependency management, BOMs | Dependency issues |
plugins.md | Common plugins configuration | Build customization |
<?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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.1</version>
<relativePath/>
</parent>
<groupId>com.example</groupId>
<artifactId>my-app</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<java.version>21</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Dependency versions -->
<mapstruct.version>1.5.5.Final</mapstruct.version>
<testcontainers.version>1.19.3</testcontainers.version>
</properties>
<dependencies>
<!-- Spring Boot Starters -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!-- Runtime -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<!-- Compile-time only -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${mapstruct.version}</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
<!-- Annotation processors -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-mapstruct-binding</artifactId>
<version>0.2.0</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>dev</id>
<properties>
<spring.profiles.active>dev</spring.profiles.active>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<spring.profiles.active>prod</spring.profiles.active>
</properties>
</profile>
</profiles>
</project>
<!-- Parent pom.xml -->
<project>
<groupId>com.example</groupId>
<artifactId>my-project</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>common</module>
<module>api</module>
<module>service</module>
</modules>
<dependencyManagement>
<dependencies>
<!-- Internal modules -->
<dependency>
<groupId>com.example</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
<!-- External BOMs -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>3.2.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
plugins {
java
id("org.springframework.boot") version "3.2.1"
id("io.spring.dependency-management") version "1.1.4"
}
group = "com.example"
version = "1.0.0-SNAPSHOT"
java {
sourceCompatibility = JavaVersion.VERSION_21
}
configurations {
compileOnly {
extendsFrom(configurations.annotationProcessor.get())
}
}
repositories {
mavenCentral()
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-validation")
runtimeOnly("org.postgresql:postgresql")
compileOnly("org.projectlombok:lombok")
annotationProcessor("org.projectlombok:lombok")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.testcontainers:postgresql")
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.bootJar {
archiveFileName.set("app.jar")
}
// settings.gradle.kts
rootProject.name = "my-project"
include("common", "api", "service")
// Root build.gradle.kts
plugins {
java
id("org.springframework.boot") version "3.2.1" apply false
id("io.spring.dependency-management") version "1.1.4"
}
allprojects {
group = "com.example"
version = "1.0.0-SNAPSHOT"
repositories {
mavenCentral()
}
}
subprojects {
apply(plugin = "java")
apply(plugin = "io.spring.dependency-management")
java {
sourceCompatibility = JavaVersion.VERSION_21
}
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter")
}
tasks.test {
useJUnitPlatform()
}
}
// service/build.gradle.kts
plugins {
id("org.springframework.boot")
}
dependencies {
implementation(project(":common"))
implementation(project(":api"))
implementation("org.springframework.boot:spring-boot-starter-web")
}
Before configuring build:
| Anti-Pattern | Why Bad | Better Approach |
|---|---|---|
| Hardcoded versions everywhere | Update nightmare | Properties/BOMs |
| compile scope (deprecated) | Gradle 7+ | implementation/api |
| Runtime deps in compile | Bloated classpath | Correct scopes |
| No dependency management | Version conflicts | BOM imports |
| Fat JAR with unused deps | Large artifacts | Exclude unnecessary |
| Need | Skill |
|---|---|
| Java | @[skills/java-expert] |
| Unit testing | @[skills/testing-junit] |