【发布时间】:2019-11-11 17:14:51
【问题描述】:
我正在为该项目使用 Java 11。 Gradle 版本是 5.5。 IntelijIDEA 2019.1.3
所以,当我构建项目时,我得到了错误:
Cause: invalid type code: B3
Stacktrace 告诉我:
org.gradle.internal.exceptions.LocationAwareException: Build file 'D:\project\scripts\build.gradle' line: 21
A problem occurred evaluating project ':scripts'.
at org.gradle.initialization.exception.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:99)
at org.gradle.initialization.exception.DefaultExceptionAnalyser.collectFailures(DefaultExceptionAnalyser.java:55)
at org.gradle.initialization.exception.MultipleBuildFailuresExceptionAnalyser.transform(MultipleBuildFailuresExceptionAnalyser.java:47)
at org.gradle.initialization.exception.StackTraceSanitizingExceptionAnalyser.transform(StackTraceSanitizingExceptionAnalyser.java:29)
命令gradle task dev update 告诉我:
* What went wrong:
A problem occurred evaluating project ':scripts'.
> Could not find method leftShift() for arguments [build_44ncodnspa3jbc57fnmmpuh13$_run_closure1@4c5511e6] on task ':scripts:dev' of type org.gradle.api.DefaultTask.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED
在build.gradle 文件中给出错误的代码是:
task("dev") << {
println "executing dev"
liquibase {
activities {
main {
changeLogFile changeLog
classpath "$projectDir/src/main/resources/"
url 'jdbc:postgresql://localhost:5432/project'
username 'testName'
password 'testPassword'
liquibaseSchemaName 'liquibase'
}
}
}
}
我使用unticking the flag Settings -> Experimental -> Only sync the active variant 的解决方案。
但是我可以通过代码解决问题而不更改 IntelijIDEA 设置吗? 因为syncing the project 作为优化过程很重要。尤其是大型项目。
【问题讨论】:
标签: java gradle intellij-idea