无法使用Java 11生成gradle项目:无效类型代码:B3
我在项目中使用Java11。Gradle版本是5.5。2019.1.3 因此,当我构建项目时,我得到了错误:无法使用Java 11生成gradle项目:无效类型代码:B3,java,gradle,intellij-idea,Java,Gradle,Intellij Idea,我在项目中使用Java11。Gradle版本是5.5。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 ':s
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'
}
}
}
}
任务(“开发”)实验->仅同步活动变量
但是,我可以通过代码解决问题,而不改变IntelIdea设置吗?
因为优化的过程很重要。特别是,如果是大型项目。经过分析和查找,我稍微改为:
task("dev") {
doLast {
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'
}
}
}
}
}
最终,更新的代码帮助我解决了这个问题,而不使用IntelijIDEA的设置
并且,
gradle任务开发人员更新
成功运行。在分析和查找之后,我将其稍作更改为:
task("dev") {
doLast {
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'
}
}
}
}
}
最终,更新的代码帮助我解决了这个问题,而不使用IntelijIDEA的设置
并且gradle任务开发人员更新
工作成功