# Why sometimes gradle run jar task but doesn't run build task for every subproject

**URL:** <https://discuss.gradle.org/t/why-sometimes-gradle-run-jar-task-but-doesnt-run-build-task-for-every-subproject/4242>\
**Category:** Old Forum Archive\
**Created:** [January 30, 2015, 11:00pm UTC](https://discuss.gradle.org/t/why-sometimes-gradle-run-jar-task-but-doesnt-run-build-task-for-every-subproject/4242 "2015-01-30T23:00:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mingzhi5626](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@mingzhi5626](https://discuss.gradle.org/u/mingzhi5626)\
**Post date:** [January 30, 2015, 11:00pm UTC](https://discuss.gradle.org/t/why-sometimes-gradle-run-jar-task-but-doesnt-run-build-task-for-every-subproject/4242/1 "2015-01-30T23:00:00Z")

</div>

Why sometimes gradle run jar task but doesn’t run build task for every subproject when I run a customized task from root project. If I run gradle build it will execute entire build task for all subprojects, otherwise, it execute jar for some subprojects and execute build for others. Thanks.

[![](https://sea1.discourse-cdn.com/gradle/uploads/default/1192/8f692c8111c556ed.JPG)](https://d2r1vs3d9006ap.cloudfront.net/s3_images/1149667/nobuildexecuted.JPG?1422658791)

---

<div class="post-metadata">

**Author:** ![Mark\_Viera](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/mark_viera/32/1543_2.png) [@Mark\_Viera](https://discuss.gradle.org/u/Mark_Viera)\
**Post date:** [January 31, 2015, 4:25am UTC](https://discuss.gradle.org/t/why-sometimes-gradle-run-jar-task-but-doesnt-run-build-task-for-every-subproject/4242/2 "2015-01-31T04:25:00Z")

</div>

Running the ‘build’ task for a project will in turn run ‘build’ for all its subprojects, as you have correctly described. However, if a build a particular subproject, only that subproject and its dependencies are built. In your case I assume there are project dependencies between your projects. If project ‘A’ depends on project ‘B’ (which is a Java project), the calling ‘🅰build’ will only require calling ‘🅱jar’ because that is all ‘A’ _requires_.
