スキル一覧に戻る
bitsoex

gradle-standards

by bitsoex

Bitso Java API Wrapper

34🍴 30📅 2026年1月24日
GitHubで見るManusで実行

SKILL.md


name: gradle-standards description: > Gradle build configuration standards for Java projects. Covers version catalogs, dependency bundles, multi-module setup, BOM management, and common troubleshooting. Use when configuring Gradle builds or reviewing dependency management. compatibility: Java projects using Gradle 8.x or 9.x metadata: version: "1.1.0" technology: java category: build tags: - gradle - java - dependencies - build

Gradle Standards

Standards for Gradle configuration in Java projects, including version catalogs, dependency bundles, and multi-module setup.

When to use this skill

  • Setting up a new Gradle project
  • Adding or updating dependencies
  • Configuring multi-module builds
  • Troubleshooting dependency conflicts
  • Migrating to version catalogs
  • Cleaning up unused dependencies
  • Optimizing build performance

Skill Contents

Sections

Available Resources

📚 references/ - Detailed documentation


Quick Start

1. Version Centralization (Required)

All versions MUST be centralized in gradle/libs.versions.toml:

[versions]
spring-boot = "3.5.9"
grpc = "1.78.0"

[libraries]
spring-boot-starter-web = { module = "org.springframework.boot:spring-boot-starter-web", version.ref = "spring-boot" }
spring-boot-starter-actuator = { module = "org.springframework.boot:spring-boot-starter-actuator", version.ref = "spring-boot" }

2. Use in build.gradle

dependencies {
    // ✅ CORRECT: Use version catalog with explicit dependencies
    implementation libs.spring.boot.starter.web
    implementation libs.spring.boot.starter.actuator

    // ❌ NEVER: Hardcode versions
    // implementation "org.springframework.boot:spring-boot-starter-web:3.5.9"
}

Key Principles

PrincipleDescription
Centralize VersionsAll versions in libs.versions.toml, never inline
Explicit DependenciesDeclare each dependency explicitly for clarity
Use Align RulesNebula align rules ensure version consistency across module groups
Never DowngradeDon't replace existing versions with older ones
Trust BOMsSpring Boot BOM manages transitive dependencies
Platform Over EnforceUse platform(), never enforcedPlatform()
Use Nebula for ResolutionUse resolution rules + lock files, not force/constraints
Lock DependenciesGenerate gradle.lockfile for ALL submodules (use build --write-locks)

Version Alignment

Use Nebula align rules to ensure all modules in a library group use the same version. This is preferred over bundles because:

  • Subprojects can declare exactly what they need
  • Dependencies are explicit and visible in build files
  • Version consistency is enforced at resolution time
// gradle/resolution-rules.json
{
  "align": [
    {
      "name": "jackson-alignment",
      "group": "com\\.fasterxml\\.jackson\\.core",
      "reason": "Jackson modules must use same version"
    },
    {
      "name": "grpc-alignment",
      "group": "io\\.grpc",
      "reason": "gRPC modules must align for binary compatibility"
    }
  ]
}

See Nebula resolution rules documentation for complete align rule reference.

References

ReferenceDescription
references/version-catalogs.mdComplete version catalog guide
references/multi-module.mdMulti-module project setup
references/native-dependency-locking.mdGradle native locking (Gradle 9+ recommended)
references/cleanup-workflow.mdDependency cleanup process
references/unused-detection.mdFinding unused dependencies
references/optimization.mdBuild optimization techniques
references/troubleshooting.mdCommon issues and solutions
  • .cursor/rules/java-gradle-best-practices.mdc - Full Gradle configuration reference
  • .cursor/rules/java-versions-and-dependencies.mdc - Version management policies

Dependency Resolution Stack

┌─────────────────────────────────────────────────────────────────────┐
│  1. VERSION CATALOG (libs.versions.toml)                            │
│     Single source of truth for declared versions                    │
├─────────────────────────────────────────────────────────────────────┤
│  2. RESOLUTION RULES (optional: resolution-rules.json)              │
│     Policies: substitute, align, deny, exclude                      │
│     Use substitute for security fixes, align for module groups      │
├─────────────────────────────────────────────────────────────────────┤
│  3. LOCK FILE (captures EXACT resolved versions)                    │
│     Option A: gradle.lockfile (native - Gradle 9+ recommended)      │
│     Option B: dependencies.lock (Nebula plugin)                     │
│                                                                     │
│  ⚠️  CRITICAL: Multi-module projects need lockfiles for ALL modules │
│     Use: ./gradlew build --write-locks -x test                      │
│     NOT: ./gradlew dependencies --write-locks (root only!)          │
└─────────────────────────────────────────────────────────────────────┘

Lock File Options:

Multi-Module Lockfile Generation:

# ✅ CORRECT: Generates lockfiles for ALL submodules
./gradlew build --write-locks -x test

# ❌ WRONG: Only generates for ROOT project
./gradlew dependencies --write-locks

# Verify coverage (lockfiles should ≈ build.gradle files)
find . -name "gradle.lockfile" | wc -l
find . -name "build.gradle" | wc -l
SkillPurpose
dependency-managementVersion catalogs and BOMs
dependabot-securitySecurity vulnerability fixes
java-coverageJaCoCo configuration in Gradle
java-testingTest configuration with Spock

スコア

総合スコア

65/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

+5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です