'Cannot convert the provided notation to a File or URI when using println

... ...

ext {
    wsdlDir = file("${projectDir}/src/main/resources/wsdl")
    outputDir = file("$buildDir/generated-sources")
    sourceWsdls = [
            "$wsdlDir/MyWsdlFile1.wsdl",
            "$wsdlDir/MyWsdlFile2.wsdl",
            "$wsdlDir/MyWsdlFile3.wsdl",
            "$wsdlDir/MyWsdlFile4.wsdl"
    ]
}
task generateJavaClassesAllWsdlFiles {
    doLast{
        // Find all wsdl files in directory defined in ext
        fileTree(wsdlDir).matching {
            include "*.wsdl"
        }.each {
            wsdlFile ->
                println "Generating " + wsdlFile
        }

Just taking it step by step - println fails

  • What went wrong: Execution of the task: generateJavaClassesAllWsdlFiles Cannot convert the provided notation to a File or URI: [src/main/java, src]. The following types/formats are supported:
    • A String or CharSequence path, e.g 'src/main/java' or '/usr/include'
    • A String or CharSequence URI, e.g 'file:/usr/include'
    • A File instance.
    • A URI or URL instance. }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source