TestKit and Classpath

plugins

(Stewart Bryson) #1

I’m working with the TestKit for a custom plugin, and I’m receiving an error, and I want to see if it’s related to classpath injection. I’m reading this, and if I understand it correctly, it tells me that the Java Gradle Plugin only injects classes coming from sourceSets.main and sourceSets.test. I’m reading that correctly, right?

Does that mean that a JDBC driver loaded as part of a configuration as discussed here would not get injected, even if I had the following code in my custom plugin:

     URLClassLoader loader = GroovyObject.class.classLoader

     project.configurations.jdbc.each { File file ->
        loader.addURL(file.toURI().toURL())
        DriverManager.registerDriver(loader.loadClass(masterDriver).newInstance())
     }