[英]Unresolved reference: grgit in build.gradle.kts
出現如下錯誤,當我使用此命令“bash./gradlew build”編譯代碼時
未解決的參考:grgit
build.gradle.kts:
import org.apache.tools.ant.filters.FixCrLfFilter
import org.apache.tools.ant.filters.ReplaceTokens
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.text.SimpleDateFormat
import java.util.Date
plugins {
java
kotlin("jvm") version "1.3.60"
`maven-publish`
id("com.github.xxxxx") version "5.2.0"
id("org.ajoberstar.grgit") version "4.0.2"
}
val vertx = "3.8.5"
dependencies {
implementation("org.apache.logging.log4j:log4j-api:2.13.0")
implementation("org.apache.logging.log4j:log4j-core:2.13.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2")
implementation(kotlin("stdlib-jdk8"))
implementation("io.vertx:vertx-core:${vertx}")
implementation("io.vertx:vertx-rx-java2:${vertx}")
implementation("io.vertx:vertx-web:${vertx}")
implementation("io.reactiverse:elasticsearch-client-rxjava2:0.8.2-ec7.6.2")
implementation("org.yaml:snakeyaml:1.25")
implementation("io.vertx:vertx-mysql-client:${vertx}")
implementation("io.vertx:vertx-shell:${vertx}")
testImplementation("junit", "junit", "4.12")
testImplementation("io.vertx", "vertx-unit", vertx)
runtimeOnly("io.vertx:vertx-hazelcast:${vertx}")
}
val gitStatus = grgit.status()
val versionTimestamp = SimpleDateFormat("yyyyMMddHHmm").format(Date())
val versionCommit = grgit.head().Id
var currentBranchName = grgit.branch.current().getName();
if (currentBranchName.equals("HEAD", true)) { /* happens on jenkins */
val usedRemoteBranch = grgit.branch.current()
出現如下錯誤
腳本編譯錯誤:
第 69 行:val gitStatus = grgit.status() ^ 未解決的參考:grgit
第 71 行:val versionCommit = grgit.head().Id ^ 未解決的參考:grgit
第 72 行:var currentBranchName = grgit.branch.current().getName(); ^ 未解決的參考:grgit
第 74 行:val usedRemoteBranch = grgit.branch.current() ^ 未解決的參考:grgit
在 build.gradle.kts 中。
你能幫我解決這個問題嗎?
你還沒有聲明你的grgit
變量。
您可以通過以下方式獲取Grgit
實例:
import org.ajoberstar.grgit.Grgit
...
val grgit = Grgit.open(mapOf("currentDir" to project.rootDir))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.