When compiling a groovy project, gradle creates files in $projectRoot/build/
. Is there a way to configure this to e.g. an absolute path?
Yes, there is. You can put the following line in your build script:
buildDir = 'your_directory'
Or in gradle.properties
file (no quotes around your_directory
in that case).
gradle properties
You can set project.buildDir
in your build.gradle
, or buildDir = PATH
in gradle.properties
.
And from environment variable like this:
export GRADLE_OPTS=-Dorg.gradle.project.buildDir=/tmp/gradle-build
See Build Environment section of the documentation here: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_environment_variables
And Writing Build Scripts here (for buildDir property): https://docs.gradle.org/current/userguide/writing_build_scripts.html
(Current version of gradle when writing this: 4.5)
You can add project.buildDir = 'your/directory' to the file build.gradle you can place it anywhere in separate line