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{} 閉包的物件類型為 Jdt

傳遞給 withProperties{} 閉包的物件類型為 Properties

例如,請參閱 EclipseJdt 的文件