Gradle 1.3 regression GStringImpl cannot be cast to java.lang.String in Patterns


(bplies) #1

Gradle 1.2 allowed me to define a task’s inputs like this:

inputs.files fileTree(dir: 'templates/js', includes:
['*.js', "${siteName}site/**/*.js"]).
// Gradle 1.3 will throw an Exception
java.lang.ClassCastException: org.codehaus.groovy.runtime.GStringImpl cannot be cast to java.lang.String
        at org.gradle.api.tasks.util.PatternSet.getAsSpec(PatternSet.java:124)
        at org.gradle.api.internal.file.collections.DirectoryFileTree.visit(DirectoryFileTree.java:114)
        at org.gradle.api.internal.file.collections.FileTreeAdapter.visit(FileTreeAdapter.java:96)
        at org.gradle.api.internal.file.AbstractFileTree.getFiles(AbstractFileTree.java:37)
        at org.gradle.api.internal.file.CompositeFileCollection.getFiles(CompositeFileCollection.java:39)
        at org.gradle.api.internal.file.AbstractFileCollection.iterator(AbstractFileCollection.java:60)

Changing the line to:

inputs.files fileTree(dir: 'templates/js', includes:
['*.js', "${siteName}site/**/*.js".toString()]).

works but feels so un-Groovy.


#2

There’s an existing issue for this: GRADLE-2566