Simulate a 'provided' configuration for the ear-plugin

hi there,

all of our server-modules may have those libs on the compile-classpath - inherited via the :core project.

dependencies {
  providedServerLibs
'javax.ejb:ejb-api:3.0'
   providedServerLibs 'javax.mail:javax.mail-api:1.4.4'
  providedServerLibs 'org.jboss.ejb3:jboss-ejb3-ext-api:2.0.0-beta-2'
  providedServerLibs 'javax.servlet:servlet-api:2.5'
  providedServerLibs 'javax.persistence:persistence-api:1.0.2'
  providedServerLibs 'javax.jms:jms-api:1.1-rev-1'
                [...]

during ear-packaging we do NOT want those libs to end up in the ‘lib’ dir.

dependencies{
                // note: earlibs not earlib - so it is not automagically
used by the ear-plugin
  earlibs project(path: ':core', configuration: 'sharedServerCompile') // for server usage also has the providedServerLib conf as as a dep
                earlibs project(path: 'services', configuration: 'sharedServerCompile')
    deploy project(path: ':core', configuration: 'serverCompile') // the actual ejb-jar
                deploy project(path: 'services', configuration: 'serverCompile')
 }
 ear {
 [...]
   // during execution first of all include all libs from our 'earlibs' configuration which are not in the 'providedServerLibs' configuration
   // this will add all jars of all modules specified above to the ear/lib dir
   doFirst{
    lib{
     from configurations.earlibs.findAll{ !project(':core').configurations.providedServerLibs.contains(it) }
    }
   }
    }
 }

i followed the discussion

GRADLE-784

and here

http://gradle.1045684.n5.nabble.com/Provided-dependencies-td3327063.html but was not completely convinced. do you think, the ‘trick’ with the earlibs is a valid solution?