gradle引用Java6,尽管我的java主页的目标是Java8
我跑了./gradlew干净利落的身材 我得到了这个错误:gradle引用Java6,尽管我的java主页的目标是Java8,java,build,gradle,java-8,Java,Build,Gradle,Java 8,我跑了./gradlew干净利落的身材 我得到了这个错误: warning: [options] bootstrap class path not set in conjunction with -source 1.6 /Users/eladb/WorkspaceQa/java/UsersServer/src/test/java/linqmap/users/jms/UsersServerAccessPropUserNameTest.java:163: error: diamond operat
warning: [options] bootstrap class path not set in conjunction with -source 1.6
/Users/eladb/WorkspaceQa/java/UsersServer/src/test/java/linqmap/users/jms/UsersServerAccessPropUserNameTest.java:163: error: diamond operator is not supported in -source 1.6
Map<String, String> properties = new HashMap<>();
^
(use -source 7 or higher to enable diamond operator)
1 error
1 warning
:compileTestJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileTestJava'.
> Compilation failed; see the compiler error output for details.
BUILD FAILED
我的gradle.build:
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'jacoco'
sourceCompatibility = 1.8
version = '1.0'
repositories {
mavenCentral()
jcenter()
}
dependencies {
//
// configurations.all*.exclude(group: 'com.sun.jersey', module: 'jersey-bundle')
// configurations.all*.exclude(group: 'com.fasterxml.jackson.core', module:'jackson-databind')
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
compile 'com.google.inject:guice:4.0-beta5'
compile 'com.sun.jersey:jersey-core:1.18.3'
compile 'com.sun.jersey:jersey-client:1.18.3'
看起来您已经显式地设置了源代码兼容性 尝试添加:
sourceCompatibility = 1.8
您已将编译任务配置为使用选项-source 1.6。您正在使用JDK8进行编译,并使用自Java7以来可用的语法。这就是gradle抱怨的原因。发布您的build.gradle.added。我的sourceCompatibility=1.8,compileTestJava的构建失败。您是否以某种方式配置了此任务?在非测试源文件中也使用菱形操作符吗?在我更新IntelliJJ之前,它一直都是有效的。这与IntelliJ有什么关系。Gradle不关心您的IntelliJ版本。我有sourceCompatibility=1.8检查答案。您是否在$Gradle\u HOME/bin/Gradle文件中显式导出/设置JAVA\u HOME=/…path…/到../jdk1.6.0xx?
sourceCompatibility = 1.8