0
다음과 같은 gradle 작업이 있습니다. 빌드를 시작하기 전에 GOPATH 설정하기. 두 번째 작업을 실행하면 runUnitTest와 GOPATH가 해당 블록 내에 설정되지 않고 "$ GOPATH not set"오류가 표시됩니다.Gradle의 전역 변수 선언
task goBuild(type:Exec) {
environment 'GOPATH', projectDir.toString().split("/src")[0]
commandLine "go", "build", "main.go"
}
task runUnitTest(type:Exec) {
dependsOn goBuild
commandLine "go", "get", "github.com/AlekSi/gocov-xml"
commandLine "go", "test", "-v"
}
물론 두 번째 작업 내에서 GOPATH를 다시 설정할 수 있습니다. 그러나 전 세계적으로 gradle을 설정하는 방법에 대해 궁금합니다.
작품 .. 감사합니다. –