Help resolving classpath issues in buildscript dependencies

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 {



 dependencies {

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

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

classpath group: '', name: 'yuicompressor', version: '2.4.6'

 }  }  

What exactly do you mean by “bundled”?

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.

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.

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.