WorkerConfiguration.setParams java.lang.NoSuchMethodError


(Matt Garner) #1

I’ve developed a plugin against Gradle 3.5.1 and it works fine when used in a project that uses 3.5.1

However, when I update the project that uses the plugin to 4.6 I’m getting a

Caused by: java.lang.NoSuchMethodError: org.gradle.workers.WorkerConfiguration.setParams([Ljava/io/Serializable;)V

If I update the plugin to build against 4.6 it’ll work fine. However, if a project using the plugin is still on 3.5.1 it gets

Caused by: java.lang.NoSuchMethodError: org.gradle.workers.WorkerConfiguration.setParams([Ljava/lang/Object;)V

Ideally, I’d like the plugin to work against 3.5.1 and 4.x. Is there anyway around this issue?

The failing code looks like this:

    @TaskAction
public void taskAction() {
    for (Wsdl wsdl : wsdls) {
        getWorkerExecutor().submit(WsImportRunnable.class, workerConfiguration -> {
            workerConfiguration.setDisplayName("Importing WSDL");
            workerConfiguration.setParams(new WsImportConfiguration(wsdlSourceRoot,
                                                                    generatedSourceRoot,
                                                                    generatedClassesRoot,
                                                                    keep,
                                                                    extension,
                                                                    verbose,
                                                                    quiet,
                                                                    debug,
                                                                    xnocompile,
                                                                    xadditionalHeaders,
                                                                    xnoAddressingDatabinding,
                                                                    xdebug,
                                                                    target,
                                                                    wsdl));
            workerConfiguration.classpath(jaxwsToolsConfiguration.getFiles());
        });
    }
}