Support for provided configuration

I have a provided configuration defined in the master project build.gradle as below:

   subprojects{
     configurations {
            	provided 
           }
           sourceSets {
            	main { 
            		compileClasspath += configurations.provided 
            	}
           }
    }

I reference this in the subproject dependencies:

dependencies {
    provided fileTree(dir: "${wasPluginsDir}", include: '*.jar')
}

This works when building from the command line/Gradle tasks view but does not build correctly within eclipse as the dependencies aren’t found by eclipse.
Has anyone found a way to get something like this to work for both use cases?

1 Like

The part with sourceSets looks complicated. Why don’t you do the following?

configurations {
    provided
    compile.extendsFrom provided
}

Maybe that’s supported by the Eclipse plugin?

1 Like

Thanks Sebastien that works.

Thanks so much for this solution! It worked gorgeously for me.

Making compile extend provided is a valid solution for this specific case. The generic solution is to add the extra configuration to the Eclipse model:

eclipse.classpath.plusConfigurations << configurations.provided