[英]Unresolved reference: grgit in build.gradle.kts
Getting error like below, When I am compiling the code using using this command "bash./gradlew build"出现如下错误,当我使用此命令“bash./gradlew build”编译代码时
Unresolved reference: grgit未解决的参考:grgit
build.gradle.kts: 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()
getting error like below出现如下错误
Script compilation errors:脚本编译错误:
Line 69: val gitStatus = grgit.status() ^ Unresolved reference: grgit第 69 行:val gitStatus = grgit.status() ^ 未解决的参考:grgit
Line 71: val versionCommit = grgit.head().Id ^ Unresolved reference: grgit第 71 行:val versionCommit = grgit.head().Id ^ 未解决的参考:grgit
Line 72: var currentBranchName = grgit.branch.current().getName();第 72 行:var currentBranchName = grgit.branch.current().getName(); ^ Unresolved reference: grgit
^ 未解决的参考:grgit
Line 74: val usedRemoteBranch = grgit.branch.current() ^ Unresolved reference: grgit第 74 行:val usedRemoteBranch = grgit.branch.current() ^ 未解决的参考:grgit
in build.gradle.kts.在 build.gradle.kts 中。
Can you please help me to resolve this issue.你能帮我解决这个问题吗?
You have not declared your grgit
variable.你还没有声明你的
grgit
变量。
You can get a Grgit
instance by:您可以通过以下方式获取
Grgit
实例:
import org.ajoberstar.grgit.Grgit
...
val grgit = Grgit.open(mapOf("currentDir" to project.rootDir))
Reference: http://ajoberstar.org/grgit/index.html参考: http://ajoberstar.org/grgit/index.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.