# Java Gradle

> Master Gradle - Kotlin DSL, task configuration, build optimization, caching

- **Type:** Skill
- **Install:** `agentstack add skill-linlannet-agent-skills-java-gradle`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [linlannet](https://agentstack.voostack.com/s/linlannet)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** Apache-2.0
- **Upstream author:** [linlannet](https://github.com/linlannet)
- **Source:** https://github.com/linlannet/agent-skills/tree/main/skills/java-gradle

## Install

```sh
agentstack add skill-linlannet-agent-skills-java-gradle
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Java Gradle 技能

掌握使用Kotlin DSL的Gradle构建工具，用于Java项目。

## 概述

此技能涵盖使用Kotlin DSL的Gradle配置，包括任务配置、使用目录管理依赖、构建缓存优化和CI/CD集成。

## 何时使用此技能

当您需要：
- 配置Gradle构建（Kotlin DSL）
- 使用目录管理依赖
- 优化构建性能
- 设置构建缓存
- 创建自定义任务

## 快速参考

```kotlin
// build.gradle.kts
plugins {
    java
    id("org.springframework.boot") version "3.2.1"
    id("io.spring.dependency-management") version "1.1.4"
}

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(21)
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation("org.springframework.boot:spring-boot-starter-web")
    testImplementation("org.springframework.boot:spring-boot-starter-test")
}

tasks.withType {
    options.compilerArgs.addAll(listOf("-parameters", "-Xlint:all"))
    options.isFork = true
    options.isIncremental = true
}

tasks.test {
    useJUnitPlatform()
    maxParallelForks = Runtime.getRuntime().availableProcessors() / 2
}
```

## 版本目录

```toml
# gradle/libs.versions.toml
[versions]
spring-boot = "3.2.1"

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

[plugins]
spring-boot = { id = "org.springframework.boot", version.ref = "spring-boot" }
```

## 有用的命令

```bash
gradle dependencies              # 查看依赖
gradle dependencyInsight --dependency log4j  # 分析依赖
gradle build --scan              # 构建扫描
gradle build --build-cache       # 使用缓存
gradle wrapper --gradle-version 8.5  # 更新包装器
```

## 构建优化

```kotlin
// settings.gradle.kts
enableFeaturePreview("STABLE_CONFIGURATION_CACHE")

// 启用并行和缓存
org.gradle.parallel=true
org.gradle.caching=true
```

## 故障排除

| 问题 | 解决方案 |
|------|----------|
| 构建缓慢 | 启用 --build-cache |
| 版本冲突 | 使用 platform() 或 constraints |
| 缓存问题 | gradle --refresh-dependencies |

## 使用

```
Skill("java-gradle")
```

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [linlannet](https://github.com/linlannet)
- **Source:** [linlannet/agent-skills](https://github.com/linlannet/agent-skills)
- **License:** Apache-2.0

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** yes
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-linlannet-agent-skills-java-gradle
- Seller: https://agentstack.voostack.com/s/linlannet
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
