Is there an ANT equivalent basedir property in gradle?
${basedir}
I am trying to get the name of the directory where the build script is located.
Thank you in advance!
rootDir. The root directory of this project. The root directory is the project directory of the root project. rootProject. The root project for the hierarchy that this project belongs to.
All enhanced objects in Gradle's domain model can hold extra user-defined properties. This includes, but is not limited to, projects, tasks, and source sets. Extra properties can be added, read and set via the owning object's ext property. Alternatively, an ext block can be used to add multiple properties at once.
Depending on your exact needs, you could use buildFile.parent
or projectDir
. (The build file path defaults to "$projectDir/build.gradle"
and can be reconfigured in settings.gradle
.) See the Gradle Build Language Reference for which properties and methods are available on Project
and other classes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With