Invoking Gradle task on module executes that task on all modules in whole project

I have a Gradle build with over 30 sub projects. In Android Studio I can build it all with no problem. However if I want to run a task on a single module, it executes that task on all modules, which takes a lot of time and gets in the way when debugging. For instance if I want to run my unit tests on a single sub-project, Android Studio executes the test task on all 38 modules that are defined in my project. This is killing me since the module I'm interested in is way down in the order of execution.


Is there some way to get Intellij/AS to execute the task only on the module that I've selected? I've tried this both from the Gradle projects window and also as a run configuration for the specific project I want to test.

Thanks, Derek
1

Use fully qualified task name, e.g. :build (or <your_module_path>:build), instead of build
where <your_module_path> is https://docs.gradle.org/current/dsl/org.gradle.api.Project.html#org.gradle.api.Project:path

-3

@vlaidslav but this doesn't solve the problem that the task window is creating new tasks rather unintuitively.

Ideally for this view of the tool window

root
- taskX
- moduleA
  - taskX
- moduleB
  - taskX

clicking on moduleB-taskX would create a new temporary run configuration with :moduleB:taskX, not :taskX

3

I also have same problem, this is not the expected behavior.

Invoking a sub project's task must not invoke same task on all the projects.

E.g.: I have many Android Apps as there own module,with hundreds of other non dependent modules.
Clicking on installDebug task of this app module does not invoke <:selected-module>:installDebug but invokes installDebug on all projects.

This is completely undesirable.

It should invoke :<selected-module>:<selected-task> and not just <selected-task> at the root dir.

Please fix this else this Gradle tool window is completely useless.

3

This is being super annoying in my company current setup. Is there any workaroud to get it working in Android Studio?
I'm currently overcoming it by typing myModule:taskName, but I would like to be able to use the gradle view.

 

Any sights to get it fixed?

0

Hi All,
This issue is fixed in IDEA CE 2017.2+ I believe.
Currently our team uses IDEA CE 2017.3.4 and the Gradle tool window launches the correct task and applies it to the respective module from where we clicked the task.
From my side I would say this issue is FIXED, but I cannot confirm exact version which had this fix.
I update to almost every new version once its available, and it IntelliJ IDEA is just getting better in terms of Gradle Integration.

Thanks to IntelliJ team.

0

Hello all, 

I do agree IntelliJ IDEA is a great product and its Gradle Integration is awesome. 

Still, I can see the feature commented here still failing in Android Studio 3.0.1. Do we have means to find out which version of IntelliJ IDEA is Android Studio 3.0.1 based on? 

 

I can see this feature fixed in library projects where I did apply 'maven' plugin to upload some artifacts. Is it something this plugin is doing?

 

Thanks in advance for your replies.

0

请先登录再写评论。