Running a plugin built with 2.x, I get this error:
Caused by: java.lang.NoSuchMethodError: org.gradle.api.tasks.TaskInputs.files([Ljava/lang/Object;)Lorg/gradle/api/tasks/TaskInputs;
at com.linkedin.ligradle.internal.dev.quality.ForkedCheckstyle$_forkingTask_closure1.doCall(ForkedCheckstyle.groovy:28)
at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:70)
at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:160)
at org.gradle.util.ConfigureUtil.configureSelf(ConfigureUtil.java:136)
at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:519)
at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:123)
at com.linkedin.ligradle.internal.dev.quality.ForkedCheckstyle.forkingTask(ForkedCheckstyle.groovy:25)
at com.linkedin.ligradle.internal.dev.quality.ForkedCheckstyle$forkingTask.call(Unknown Source)
at com.linkedin.ligradle.quality.checkstyle.LiCheckstylePlugin$_applyTo_closure1_closure8.doCall(LiCheckstylePlugin.groovy:122)
at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:70)
at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:160)
it looks like its because the return type changed for files
.
Here is the relevant code for the issue:
static Task forkingTask(Project project, Checkstyle checkstyle, File checkstyleConfig, File outputXmlReport) {
def forked = project.tasks.create("forked${checkstyle.name.capitalize()}") { Task task ->
def javaSourceDataFile = new File(project.buildDir, "$task.name-input-files.txt")
task.inputs.files(checkstyle.source) //<--- line 28
task.inputs.dir(checkstyleConfig.parentFile) //so that all checkstyle configuration files are inputs
//outputs configured elsewhere (not very nice)
I’ve fixed the issue by converting the class from an inline one into a real task with defined inputs and outputs by annotation.