首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未解析的引用: grgit

未解析的引用: grgit
EN

Stack Overflow用户
提问于 2021-10-27 15:29:40
回答 1查看 150关注 0票数 0

这是我的world server land插件,我对gradle和kotlin了解不多(了解一些前端,但每一行都像一座山)

我在编译时遇到了一个问题。似乎我缺少一种叫做grgit的东西。如何解决这个问题?

或者,您可以尝试编译此project。如果你成功了,别忘了告诉我你的方法。非常感谢!

代码语言:javascript
复制
import java.time.format.DateTimeFormatter

dependencies {
    // Expected everywhere.
    compileOnlyApi(libs.checkerqual)

    // Minecraft expectations
    compileOnlyApi(libs.guava)
    compileOnlyApi(libs.gson)

    // Platform expectations
    compileOnlyApi(libs.snakeyaml)

    // Adventure
    api(libs.adventure)
    api(libs.minimessage)

    // Guice
    api(libs.guice) {
        exclude(group = "com.google.guava")
    }
    api(libs.guiceassistedinject) {
        exclude("com.google.inject", "guice")
    }
    compileOnlyApi(libs.findbugs)

    // Plugins
    compileOnlyApi(libs.worldeditCore) {
        exclude(group = "bukkit-classloader-check")
        exclude(group = "mockito-core")
        exclude(group = "dummypermscompat")
    }
    testImplementation(libs.worldeditCore)
    compileOnlyApi(libs.fastasyncworldeditCore) { isTransitive = false }
    testImplementation(libs.fastasyncworldeditCore) { isTransitive = false }

    // Logging
    compileOnlyApi(libs.log4j)

    // Other libraries
    api(libs.prtree)
    api(libs.aopalliance)
    api(libs.pipeline) {
        exclude(group = "com.google.guava")
    }
    api(libs.arkitektonika)
    api(libs.paster)
}

tasks.processResources {
    filesMatching("plugin.properties") {
        expand(
            "version" to project.version.toString(),
            "commit" to rootProject.grgit.head().abbreviatedId, // The error points here
            "date" to rootProject.grgit.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd")) // The error points here
        )
    }
}

Problems arising

项目地址:https://github.com/IntellectualSites/PlotSquared

再次感谢!

EN

回答 1

Stack Overflow用户

发布于 2021-10-27 15:45:07

首先,你需要在使用grgit变量之前声明它,这就是为什么你会得到这个错误。

plugins{}块中添加grgit插件:

代码语言:javascript
复制
 id("org.ajoberstar.grgit") version "4.0.2"

像这样导入Grgit:

代码语言:javascript
复制
import org.ajoberstar.grgit.Grgit

然后,像这样声明变量grgit:

代码语言:javascript
复制
val grgit = Grgit.open(mapOf("currentDir" to project.rootDir))
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69741461

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档