How to execute multiple tasks on a specific submodule with gradle?
Asked Answered
S

1

6

I have a multi-module project. Unfortunately I had to place build.gradle and settings.gradle in other directory(gradlep/), rather than root directory, so that I have to use -p option.

I found that I can execute multiple tasks on a specific submodule like this.

$ gradle -p gradlep/ :long-named-submodule:clean :long-named-submodule:build

Is there any way to invoke more concisely?

Shrift answered 23/11, 2015 at 13:5 Comment(1)
What you can do is to define a task in the script that depends on the most often used combinations of tasks and run this aggregate task. That's all that comes to my head.Absolutely
P
0

One thing you can do is to only specify the number of characters needed for Gradle to unambiguously identify your module. So in your example, if there's no other module that starts with l you can do:

$ gradle -p gradlep/ :l:clean :l:build

Another option is to define a new task in your build script that depends on the combinations of tasks you want to run, as proposed by @Opal in the comments.

Pleuropneumonia answered 12/9, 2018 at 17:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.