JettyRun baseResource resourcecollection problem


(Bart Quintens) #1

Currently i’m using version 0.92 of gradle. I’ve tried serveral times to upgrade to a newer version but each version causes the same problem for me.

With the following code I get a cannot cast object exception in every release higer then 0.92.

jettyRun.doFirst {
      jettyRun.webAppConfig = new JettyPluginWebAppContext()
      jettyRun.webAppConfig.baseResource = new org.mortbay.resource.ResourceCollection(["build/framework", "src/main/webapp"] as String[]);
      jettyRun.contextPath = '/'
      jettyRun.httpPort = config.jettyPort
}

The exception I get is :

Execution failed for task ‘:jettyRun’. Cause: Cannot cast object ‘file:/project/build/framework/;file:/project/src/main/webapp/;’ with class ‘org.mortbay.resource.ResourceCollection’ to class ‘org.mortbay.resource.Resource’

In de javadocs from ResourceCollection I see it extends from the abstract class Resource so I don’t really get why it throws a classcastexception.


(Marcus Better) #2

This is a class loader issue. Your build script and the plugin classes appear to be using different class loaders, but I don’t know how to work around it.