Help resolving classpath issues in buildscript dependencies


(InverseBit) #1

I have a buildscript dependency ‘lesscss4j’ that requires a specific version of the rhino javascript library, the problem is that another buildscript dependency ‘yuicompressor’ has a bundled version of rhino which conflicts. Changing the order only changes which task fails.

Any suggestion about how to resolve this? I considered separating out the ‘yuicompressor’ task to a plugin but as far as I can tell from the docs it’s not possible to declare a separate classpath for a plugin… maybe I’m wrong here?

  buildscript {

 repositories {



mavenCentral()

 }

 dependencies {



classpath group: 'rhino', name: 'js', version: '1.7R2'



classpath group: 'com.googlecode.lesscss4j', name: 'lesscss4j', version: '1.2.0'



classpath group: 'com.yahoo.platform.yui', name: 'yuicompressor', version: '2.4.6'

 }  }  

(Peter Niederwieser) #2

What exactly do you mean by “bundled”?


(InverseBit) #3

Yes that wasn’t very clear - YUI Compressor overrides some of the Rhino classes with customisations, using the same package name. It also has a dependency on Rhino 1.6R7, whilst lesscss4j requires 1.7R2.


(Peter Niederwieser) #4

That’s some ugliness there, and to my knowledge Gradle doesn’t solve it out-of-the-box. You might have to code your own solution, e.g. declare two configurations, create a class loader for each of them, etc.


(InverseBit) #5

Ok thanks, it is pretty nasty and I think I’ll just save myself some grief and switch to Closure Compiler instead of YUI Compressor.