home.


Tagged: gradle-eclipse


Gradle: Generate your .classpath with sources

One of the nice features of Gradle is that the eclipse plugin will generate your .classpath for you and will fetch the sources for all the dependencies that you have specified.

This comes by default by running ‘gradle eclipse’, but you can also run it separately, thereby not modifying any of your other eclipse project files:

    gradle eclipseClasspath

You obviously have to “apply plugin: ‘eclipse’” at the top of your build.gradle file.

gradle gradle-eclipse

Gradle: Using Eclipse

If you put

    apply plugin:'eclipse'

at the top of your build.gradle file you can run ‘gradle eclipse’ which will generate the Eclipse project files, including the .classpath.

If you want to change the source and target compatibility settings:

    eclipse {
      jdt {
        sourceCompatibility = 1.6
        targetCompatibility = 1.6
      }
    }
gradle gradle-eclipse

Page 1 of 1