문제

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

도움이 되었습니까?

해결책

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
    }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top