Gradle compileJava task warning: [options] bootstrap class path not set in conjunction with -source 1.6

后端 未结 4 1445
轮回少年
轮回少年 2020-12-06 09:20

Below is the content of the build.gradle file:

apply plugin: \'java\'

archivesBaseName    = \'foo-bar\'
version             = \'1.0\'
sourc         


        
4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-06 09:41

    You can bootstrap class path using bootClasspath option:

    apply plugin: 'java'
    
    sourceCompatibility = 1.6
    targetCompatibility = 1.6
    
    compileJava.options.bootClasspath = "$JDK6_HOME/jre/lib/rt.jar"
    

    To set the bootClasspath option on all compile tasks in the project you can use the withType() method on the TaskContainer to find all tasks of type Compile:

    apply plugin: 'java'
    
    sourceCompatibility = 1.6
    targetCompatibility = 1.6
    
    tasks.withType(JavaCompile) {
        options.bootstrapClasspath = files("$JDK6_HOME/jre/lib/rt.jar")
    }
    

    gradle.properties:

    JDK6_HOME=C:/JAVA/jdk6
    

    See documentation for details.

提交回复
热议问题