This message was deleted.
# configuration-cache
s
This message was deleted.
m
We're working on improving this use case right now, by having a better guidance in the docs, better error reporting, and supporting more cases where possible. Currently, it isn't possible to call methods defined in the build script, you can work around this by making them static methods of some class. For example, this won't work:
Copy code
def printFoo() {
    println "foo"
}

task check {
    doLast {
        printFoo()
    }
}
But this would:
Copy code
class Foo {
    static def printFoo() {
        println "foo"
    }
}

task check {
    doLast {
        Foo.printFoo()
    }
}
The relevant issue is https://github.com/gradle/gradle/issues/20126 Of course, if
printFoo
invokes methods of
Project
, it won't work properly, for the same reasons
Task.getProject
is disallowed at the execution time when configuration caching is enabled
👍 1
e
Thank you a lot. Let me try if I can do more with it