i want to create a build.gradle file which will load another into it.
The second file just should have the "defaulttasks" which means that they should execute when the task doens't exist in the first one.
File one:
apply from ("..otherfile.gradle")
task "hello"(overwrite: true) {
doFirst{
println "hello from here"
}
}
The second file:
task "hello" {
doFirst{
println "i am the old one"
}
}
When I run this it, it fails
Caused by: java.lang.IllegalStateException: Replacing an existing task that may have already been used by other plugins is not supported. Use a different name for this task ('hello').
So i tried and changed the second file instead of task to tasks.register("hello")
After that it doesn't fail but it will execute the second also. How can i override a task so that the default task is not running anymore?