Use when you have a written implementation plan to execute in a separate session with review checkpoints
npx skills add adityamparikh/maven-to-gradle
Or install specific skill: npx add-skill https://github.com/adityamparikh/maven-to-gradle
# Description
Migrate Maven projects to Gradle Kotlin DSL (KTS) with version catalogs (libs.versions.toml). Handles single-module and multi-module projects, Spring Boot parent POM conversion, Maven profile equivalents, and plugin mapping. Use when the user wants to convert a Maven project (pom.xml) to Gradle, migrate from Maven to Gradle, generate build.gradle.kts from pom.xml, set up version catalogs, or convert Maven multi-module projects to Gradle conventions. Also triggered by requests to "switch to Gradle", "convert my build", or "modernize my build system". Supports dual-build overlay mode where Gradle is added alongside Maven without removing it — triggered by "add Gradle to my Maven project", "run both Maven and Gradle", "dual build", or "keep both build systems".
# SKILL.md
name: maven-to-gradle
description: Migrate Maven projects to Gradle Kotlin DSL (KTS) with version catalogs (libs.versions.toml). Handles single-module and multi-module projects, Spring Boot parent POM conversion, Maven profile equivalents, and plugin mapping. Use when the user wants to convert a Maven project (pom.xml) to Gradle, migrate from Maven to Gradle, generate build.gradle.kts from pom.xml, set up version catalogs, or convert Maven multi-module projects to Gradle conventions. Also triggered by requests to "switch to Gradle", "convert my build", or "modernize my build system". Supports dual-build overlay mode where Gradle is added alongside Maven without removing it — triggered by "add Gradle to my Maven project", "run both Maven and Gradle", "dual build", or "keep both build systems".
Maven to Gradle KTS Migration
Migrate Maven projects to Gradle Kotlin DSL with version catalogs, following Gradle conventions.
Migration Workflow
- Analyze the Maven project structure (single vs multi-module, Spring Boot, Kotlin)
- Run the migration script to generate baseline Gradle files
- Review and refine the generated output
- Handle profiles and custom plugin configurations manually
- Verify the build compiles and tests pass
Step 1: Analyze the Project
Before running the script, examine the Maven project:
- Read the root
pom.xmlto identify: packaging type (jar/pom/war), parent POM, modules, profiles - For multi-module projects, check each child
pom.xmlfor inter-module dependencies - Identify special plugins that need manual conversion (see references/plugin-mappings.md)
Step 2: Run the Migration Script
Two modes are available:
Full migration (default) — generates Gradle files, suggests removing Maven after verification:
python3 scripts/migrate.py <path-to-maven-project> --dry-run
Overlay / dual-build — adds Gradle alongside Maven so both build systems work:
python3 scripts/migrate.py <path-to-maven-project> --mode overlay --dry-run
Overlay mode also appends Gradle entries to .gitignore and preserves all pom.xml files.
The script generates:
- gradle/libs.versions.toml — version catalog with all dependencies, BOMs, and plugins
- settings.gradle.kts — project name and module includes
- build.gradle.kts — root build file (and per-module for multi-module projects)
- gradle.properties — daemon, parallel, caching settings
Review --dry-run output first, then run without the flag to write files.
The script handles:
- Spring Boot starter-parent → spring-boot + dependency-management plugins
- Maven scope → Gradle configuration mapping (compile→implementation, provided→compileOnly, etc.)
- BOM imports → platform() dependencies
- Annotation processors (Lombok, MapStruct, etc.) → annotationProcessor configuration
- Dependency exclusions
- Java toolchain from compiler plugin or properties
- Kotlin detection and plugin setup
Step 3: Review and Refine
The generated files are a starting point. Always review and adjust:
Version catalog (libs.versions.toml):
- Consolidate duplicate version refs (script deduplicates where possible)
- Add [bundles] for commonly grouped dependencies
- Verify BOM entries have correct versions
Build files (build.gradle.kts):
- Add inter-module project(":module-name") dependencies (script cannot infer these)
- Configure developmentOnly for Spring Boot DevTools
- Set up publishing if needed
- Wire annotation processors for Kotlin projects (kapt/ksp)
For multi-module projects:
- Decide between allprojects/subprojects blocks vs convention plugins (buildSrc)
- See references/multi-module.md for patterns — prefer convention plugins for 5+ modules
- Ensure spring-boot plugin only applies to bootable module(s)
- Apply io.spring.dependency-management to all modules that need Spring BOM resolution
Step 4: Handle Profiles
Maven profiles require manual conversion. The script adds comments identifying each profile.
See references/profiles.md for complete patterns:
- Property-activated → project.hasProperty("name") checks
- Default-active → gradle.properties defaults
- JDK-activated → JavaVersion.current() checks
- Environment profiles → Spring Boot's own profile mechanism preferred
Step 5: Verify
gradle wrapper --gradle-version=8.12
./gradlew build
./gradlew dependencies # compare with: mvn dependency:tree
See references/gotchas.md section 9 for the full verification checklist.
Reference Files
- plugin-mappings.md — Maven plugin → Gradle plugin/task mapping with code examples
- multi-module.md — Convention plugins, buildSrc patterns, inter-module dependencies, Spring Boot multi-module
- profiles.md — Maven profile → Gradle equivalent for every activation type
- gotchas.md — Scope mapping, resource filtering, test config, Kotlin issues, performance tips, verification checklist
- dual-build.md — Running Maven and Gradle side by side: sync strategies, CI setup, gradual migration path
# README.md
Maven to Gradle KTS Migration — Claude Code Skill
A Claude Code skill that migrates Maven projects to Gradle Kotlin DSL (KTS) with version catalogs (libs.versions.toml).
What It Does
- Parses
pom.xmlfiles (single-module and multi-module) - Generates
build.gradle.kts,settings.gradle.kts,gradle/libs.versions.toml, andgradle.properties - Handles Spring Boot starter-parent conversion, scope mapping, BOM imports, annotation processors, Kotlin detection, and plugin mapping
- Supports full migration or dual-build overlay mode (Gradle alongside Maven)
- Provides reference guides for profiles, multi-module patterns, plugin mappings, and common gotchas
Installation
Add this skill to your Claude Code configuration:
claude skill add --url https://github.com/adityamparikh/maven-to-gradle
Or clone and install locally:
git clone https://github.com/adityamparikh/maven-to-gradle.git ~/.claude/skills/maven-to-gradle
Usage
In a Claude Code session, the skill is triggered automatically when you ask to:
- "Migrate this Maven project to Gradle"
- "Convert my pom.xml to build.gradle.kts"
- "Switch to Gradle"
- "Add Gradle to my Maven project" (dual-build mode)
The skill guides Claude through a 5-step workflow:
- Analyze the Maven project structure
- Run the migration script to generate Gradle files
- Review and refine the generated output
- Handle profiles and custom plugin configurations
- Verify the build compiles and tests pass
Standalone Script Usage
The migration script can also be run independently:
# Full migration (dry-run first)
python3 scripts/migrate.py /path/to/maven-project --dry-run
# Full migration (write files)
python3 scripts/migrate.py /path/to/maven-project
# Dual-build overlay (keeps Maven, adds Gradle alongside)
python3 scripts/migrate.py /path/to/maven-project --mode overlay
Repository Structure
.
├── SKILL.md # Skill definition (workflow + instructions)
├── scripts/
│ └── migrate.py # Migration script (pom.xml → Gradle files)
└── references/
├── plugin-mappings.md # Maven plugin → Gradle plugin mapping
├── multi-module.md # Convention plugins, buildSrc, inter-module deps
├── profiles.md # Maven profile → Gradle equivalent patterns
├── gotchas.md # Scope mapping, resource filtering, test config, etc.
└── dual-build.md # Running Maven + Gradle side by side
Reference Guides
| Guide | Description |
|---|---|
| Plugin Mappings | Maven plugin → Gradle plugin/task mapping with code examples |
| Multi-Module | Convention plugins, buildSrc patterns, inter-module dependencies |
| Profiles | Maven profile → Gradle equivalent for every activation type |
| Gotchas | Scope mapping, resource filtering, test config, Kotlin issues |
| Dual Build | Running Maven and Gradle side by side: sync strategies, CI setup |
Requirements
- Python 3.9+ (for the migration script — uses only stdlib)
- Gradle 8.x (for the generated build files)
License
Apache License 2.0
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.