这是我的world server land插件,我对gradle和kotlin了解不多(了解一些前端,但每一行都像一座山)
我在编译时遇到了一个问题。似乎我缺少一种叫做grgit的东西。如何解决这个问题?
或者,您可以尝试编译此project。如果你成功了,别忘了告诉我你的方法。非常感谢!
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
)
}
}项目地址:https://github.com/IntellectualSites/PlotSquared
再次感谢!
发布于 2021-10-27 15:45:07
首先,你需要在使用grgit变量之前声明它,这就是为什么你会得到这个错误。
在plugins{}块中添加grgit插件:
id("org.ajoberstar.grgit") version "4.0.2"像这样导入Grgit:
import org.ajoberstar.grgit.Grgit然后,像这样声明变量grgit:
val grgit = Grgit.open(mapOf("currentDir" to project.rootDir))https://stackoverflow.com/questions/69741461
复制相似问题