Compilation cannot find classes in plugin.jar

Hi everyone

I’m using the JSObject class that comes with the Java. It is packed in a file called plugin.jar. When I compile the project from within IDEA everything works, but if I try to build it with gradle, gradle complains that it cannot find the class JSObject. If I specify my local plugin.jar file as a dependency it works again.

My question: Am I missing something here or is this a real problem? Putting the JAR to a Maven repository doesn’t look like a clean solution for me, I would rather expect gradle to recognize everything that comes standard with the JRE.

I’m using Mac OS X Lion and gradle 1.0 milestone 3 (cannot upgrade any further without rewriting someone else’s groovy script).

Thank you for your help!


‘javac’ doesn’t automatically put ‘plugin.jar’ on the compile class path. But you can do so yourself:

def javaHome = System.getProperty("java.home")
  dependencies {
    compile files("$javaHome/lib/plugin.jar")

Thank you for pointing this out. Your suggestion works.