I have multiproject build in the buildSrc dir.
buildSrc
---build
--- subProject1
----build (2)
--- subProject2
----build (3)
--- subProject3
----build (4)
--- subProject4
----build (5)
config
gradle
src
build (1)
When I am in the root dir of my project I write:
gradle clean
but only build dir of the root project was deleted(marked with 1). How to trigger Gradle to delete all build directories prom buildSrc without to go manually to buildSrc and to write gradle clean
.(marked with 2,3,4,5)
Stop using Gradle buildSrc. Use composite builds instead You are invalidating the whole project for any change within buildSrc, usually without there being a valid reason. We can keep the sweetness of Kotlin whilst avoiding this. buildSrc is a directory at the Gradle project root, which can contain our build logic.
The default is the .gradle directory in the user’s home directory. Specifies the start directory for Gradle. Defaults to current directory. Specifies the project-specific cache directory. Default value is .gradle in the root project directory. Sets a system property of the JVM, for example -Dmyprop=myvalue. See System Properties.
Use composite builds instead | by Josef Raska | ProAndroidDev Stop using Gradle buildSrc. Use composite builds instead You are invalidating the whole project for any change within buildSrc, usually without there being a valid reason. We can keep the sweetness of Kotlin whilst avoiding this.
You can also run a task for all subprojects by again using a task selector that consists of the task name only. For example, this will run the "test" task for all subprojects when invoked from the root project directory: When invoking Gradle from within a subproject, the project name should be omitted:
Since buildSrc
is just a gradle project, you can start gradle in buildSrc
folder with clean
task specified using -p
gradle option:
./gradlew -p buildSrc clean
Unfortunately it still requires another gradle invocation before your main build.
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