0
votes

I have a multi project in the following way:

  • rootProject

    • Subproject1
    • Subproject2

task whatever << { println "WHATEVER" }

I want to be able to configure task 'whatever' once and execute it from any scope (root or subproject) and be executed only once!

This means:

If I run /gradle whatever, I should get: "WHATEVER"

If I run /subproject1/gradle whatever, I should get: "WHATEVER"

In summary, I don't what to execute the same task several tasks according to the number of projects.

I haven't been able to get such a simple result. Please let me know if you can offer any help! Thanks!

1

1 Answers

1
votes

gradle whatever searches for whatever in the current subproject and below. Instead, use gradle :whatever and declare the task in the root project.