EclipseJdt

API 文档EclipseJdt

启用对 Eclipse 插件的 jdt 详情进行微调

plugins {
    id 'java'
    id 'eclipse'
}

eclipse {
  jdt {
    //if you want to alter the java versions (by default they are configured with gradle java plugin settings):
    sourceCompatibility = 1.6
    targetCompatibility = 1.5
    javaRuntimeName = "J2SE-1.5"

    file {
      //whenMerged closure is the highest voodoo
      //and probably should be used only to solve tricky edge cases.
      //the type passed to the closure is Jdt

      //closure executed after jdt file content is loaded from existing file
      //and after gradle build information is merged
      whenMerged { jdt
        //you can tinker with the Jdt here
      }

      //withProperties allows addition of properties not currently
      //modeled by Gradle
      withProperties { properties ->
          //you can tinker with the Properties here
      }
    }
  }
}

属性

属性描述
file

参见 EclipseJdt.file(org.gradle.api.Action)

sourceCompatibility

源代码的 Java 语言级别。

targetCompatibility

生成 .class 文件的目标 JVM。

方法

方法描述
file(action)

启用高级配置,例如影响现有 jdt 文件内容与 gradle 构建信息合并的方式

脚本块

描述
file

启用高级配置,例如影响现有 jdt 文件内容与 gradle 构建信息合并的方式

属性详情

JavaVersion sourceCompatibility

源代码的 Java 语言级别。

例如,参见 EclipseJdt 的文档

使用 eclipsejava 插件时的默认值
project.sourceCompatibility

JavaVersion targetCompatibility

生成 .class 文件的目标 JVM。

例如,参见 EclipseJdt 的文档

使用 eclipsejava 插件时的默认值
project.targetCompatibility

方法详情

void file(Action<? super PropertiesFileContentMerger> action)

启用高级配置,例如影响现有 jdt 文件内容与 gradle 构建信息合并的方式

传递给 whenMerged{} 和 beforeMerged{} 动作的对象类型是 Jdt

传递给 withProperties{} 动作的对象类型是 Properties

例如,参见 EclipseJdt 的文档

脚本块详情

file { }

启用高级配置,例如影响现有 jdt 文件内容与 gradle 构建信息合并的方式

传递给 whenMerged{} 和 beforeMerged{} closure 的对象类型是 Jdt

传递给 withProperties{} closure 的对象类型是 Properties

例如,参见 EclipseJdt 的文档