Support for provided configuration


(Mark Stamp) #1

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

     configurations {
           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?

(Sebastian Stein) #2

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

configurations {
    compile.extendsFrom provided

Maybe that’s supported by the Eclipse plugin?

(Mark Stamp) #3

Thanks Sebastien that works.

(Drew Wills) #4

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

(Stefan Oehme) #5

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