Vra

I'm using a gradle task which executes the command-line inside a file collection loop:

...
collection.each { file ->
        exec {
            workingDir = file(props['WORKING_DIR']).getAbsolutePath()
            commandLine "java", "-jar", file(props['SIGN_TOOL']).getAbsoluteFile(), file
        }
    }
...

Unfortunately, the gradle task ends up with this error:

Execution failed for task ':signFiles'.

No signature of method: java.io.File.call() is applicable for argument types: (java.lang.String) values: Possible solutions: wait(), any(), wait(long), each(groovy.lang.Closure), any(groovy.lang.Closure), list()

How can i fix this issue?

Thx MVM

Was dit nuttig?

Oplossing

You've called your loop var file and then it's trying to use that for the call to file()...

Try renaming your closure variable:

collection.each { aFile ->
    exec {
        workingDir = file(props['WORKING_DIR']).getAbsolutePath()
        commandLine "java", "-jar", file(props['SIGN_TOOL']).getAbsoluteFile(), aFile
    }
}
Gelisensieer onder: CC-BY-SA met toeskrywing
Nie verbonde aan StackOverflow
scroll top