Groovy classes and $rootDir

Hello,

Can I use $rootDir macro in a class ? Where can I find the proper documentation regarding Gradle macros like $rootDir (eventually $version ) and so on?

If I try to use $rootDir inside of a Groovy class I get this error:
No such property: rootDir for class: Version

Could you please give me some hints or where I can find the proper documentation ?

Thank you very much,

You’re referencing a property on a Project instance. You can find a list of Project properties here: DSL Reference - Project.

These properties on Project are automatically available to you in your build.gradle file. However, in Groovy, you will want to access them via a Project instance.

Thank you very much!