Pregunta

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

¿Fue útil?

Solución

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
    }
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top