> For the complete documentation index, see [llms.txt](https://leawinds-organization.gitbook.io/yetanotherconfiglib-jian-ti-zhong-wen-fei-guan-fang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://leawinds-organization.gitbook.io/yetanotherconfiglib-jian-ti-zhong-wen-fei-guan-fang/shi-yong-gradle-jin-xing-she-zhi.md).

# 使用 Gradle 进行设置

了解如何导入 YACL 到你的开发环境。

{% hint style="danger" %}
这不是官方文档！官方文档位于 [https://docs.isxander.dev](https://docs.isxander.dev/yet-another-config-lib/)
{% endhint %}

{% hint style="warning" %}
目前本 wiki 正在编写中，还没有完成！
{% endhint %}

首先，你需要添加托管 YACL 的 maven 仓库。

{% tabs %}
{% tab title="Kotlin DSL (build.gradle.kts)" %}

```kotlin
repositories {
    maven("https://maven.isxander.dev/releases") {
        name = "Xander Maven"
    }
}
```

{% endtab %}

{% tab title="Groovy DSL (build.gradle)" %}

```groovy
repositories {
    maven {
        name 'Xander Maven'
        url 'https://maven.isxander.dev/releases'
    }
}
```

{% endtab %}
{% endtabs %}

接下来，你需要将依赖添加到 classpath。

{% hint style="warning" %}
强烈不建议 将 YACL 依赖含进  jar，因为它很可能已经在用户的mod文件夹中，并且会显着增加你的 jar 的大小。
{% endhint %}

{% tabs %}
{% tab title="Kotlin DSL (build.gradle.kts)" %}

```kotlin
dependencies {
    // For Fabric:
    modImplementation("dev.isxander.yacl:yet-another-config-lib-fabric:(latest)")
    // For Forge
    modImplementation("dev.isxander.yacl:yet-another-config-lib-forge:(latest)")
}
```

{% hint style="info" %}
将 (latest) 替换为目标 Minecraft 版本下可用的最新版本 YACL。你可以在 [Modrinth](https://modrinth.com/mod/yacl/versions) 找到。
{% endhint %}
{% endtab %}

{% tab title="Groovy DSL (build.gradle)" %}

```groovy
dependencies {
    // For Fabric:
    modImplementation 'dev.isxander.yacl:yet-another-config-lib-fabric:(latest)'
    // For Forge:
    modImplementation 'dev.isxander.yacl:yet-another-config-lib-forge:(latest)'
}
```

{% hint style="info" %}
将 (latest) 替换为目标 Minecraft 版本下可用的最新版本 YACL。你可以在 [Modrinth](https://modrinth.com/mod/yacl/versions) 找到。
{% endhint %}
{% endtab %}
{% endtabs %}

最后，你应该在`fabric.mod.json`中添加依赖，这样 Fabric 就可以优美地崩溃，给用户一个清晰的描述，告诉用户他们需要做什么。

{% tabs %}
{% tab title="Fabric Dependency" %}
{% code title="fabric.mod.json" %}

```json
"dependencies": {
  "yet_another_config_lib_v3": "*"
}
```

{% endcode %}
{% endtab %}

{% tab title="Forge Dependency" %}
{% code title="mods.toml" %}

```toml
[[dependencies.modid]]
modId = "yet_another_config_lib_v3"
mandatory = true
versionRange = "[,)"
ordering = "NONE"
side = "CLIENT"
```

{% endcode %}
{% endtab %}
{% endtabs %}
