.classpath generation with the Gradle Eclipse plugin?

(Christopher Molozian) #1

I have a multi project build environment setup, in my root gradle build script I’ve created a ‘provided’ configuation because Gradle still does not supply a compile-only dependency configuration.

When I attempt to generate an Eclipse project and .classpath file using the Gradle Eclipse plugin the provided dependencies are not added to the .classpath.

The build scripts look as follows:

// root build.gradle
subprojects {
    apply plugin: 'eclipse'
      configurations {
      plugins.withType(JavaPlugin) {
        repositories {
          sourceSets {
            main { compileClasspath += configurations.provided }
          dependencies {
            provided group: 'org.projectlombok', name: 'lombok', version: '0.11.2'
          eclipse {
            classpath { plusConfigurations += configurations.provided }
// settings.gradle
include 'App'
include 'Api'
include 'Service'
// each child project
apply plugin: 'java'

I’m using Gradle 1.1 to test with at the moment.

(Michael Hoff) #2

Have you tried compile instead of provided?

e.g. :

dependencies {

compile group: ‘org.projectlombok’, name: ‘lombok’, version: ‘0.11.2’


eclipse {

classpath { plusConfigurations += configurations.compile }


And in the settings file you should list your sub projects folder names, not only the included plugins And don’f forget to refresh the workspace in Eclipse

(Christopher Molozian) #3

Hi Mike,

Thanks for the reply, the reason I’m using a provided configuration is because Project Lombok is a compile-time only dependency. It’s a Java project that hooks in to the internals of the Java compiler and rewrites the AST nodes to generate getters, setters, logging etc. It’s worth checking it out here: http://projectlombok.org/

I do not want the project to become a compile configuration dependency. Everything works perfectly when I run the build via Gradle.

The issue I’m having is that the eclipse classpath closure in my root gradle build script appears to be ignored by the Gradle Eclipse plugin when generating .classpath for child projects.