# DAG of task dependencides

**URL:** <https://discuss.gradle.org/t/dag-of-task-dependencides/45805>\
**Category:** Help/Discuss\
**Created:** [June 10, 2023, 3:36am UTC](https://discuss.gradle.org/t/dag-of-task-dependencides/45805 "2023-06-10T03:36:15Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raja\_Nagendra\_Kumar1](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/raja_nagendra_kumar1/32/10491_2.png) [@Raja\_Nagendra\_Kumar1](https://discuss.gradle.org/u/Raja_Nagendra_Kumar1)\
**Post date:** [June 10, 2023, 3:36am UTC](https://discuss.gradle.org/t/dag-of-task-dependencides/45805/1 "2023-06-10T03:36:15Z")

</div>

When I run gradle

```plaintext
experiments\java\edu>gradle

Task :compileJava
<Unknown> [warning] Found @DeclareAnnotation while current release does not support it (see 'org.aspectj.weaver.bcel.AtAjAttributes')

1 warning

 Task :compileTestJava
F:\nag\DWork\osource\experiments\java\edu\build\classes\java\test!com\tejasoft\tests\ju\utils\scan\aop\AbstCallAspect.class [warning] advice defined in com.tejasoft.tests.ju.utils.scan.aop.AbstCallAspect has not been applied [Xlint:adviceDidNotMatch]

1 warning
<======-------> 52% EXECUTING [11s]
 :shadowJar

```

I see shadowJar should not called… is there a simpler command that dry runs and gives me what tasks depends on what task for easy debug… simpler to graphical or text-based DAG viewer

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [June 10, 2023, 12:09pm UTC](https://discuss.gradle.org/t/dag-of-task-dependencides/45805/2 "2023-06-10T12:09:30Z")

</div>

Why do you think it should not be called?  
The build you execute defines which task is executed if you don’t specify one.  
By default it displays the help.  
But if the build defines one or more tasks as default tasks, those are run.

If you run with --dry-run you see the list of tasks that would get executed.  
You don’t see the dependencies between the tasks, but you can get a rough feeling on the dependencies, as dependencies are of course higher in the list.  
But it is of course still a list, not a graph that is displayed.

Btw. please stop using quote formatting (`> ` in front of each line) when you actually should use code formatting (three backticks and optionally a format, followed by a newline before and three backticks after), that greatly reduces readability. 🙂 You can see the better result in your post, as I adjusted it.

---

<div class="post-metadata">

**Author:** ![Raja\_Nagendra\_Kumar1](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/raja_nagendra_kumar1/32/10491_2.png) [@Raja\_Nagendra\_Kumar1](https://discuss.gradle.org/u/Raja_Nagendra_Kumar1)\
**Post date:** [June 10, 2023, 5:32pm UTC](https://discuss.gradle.org/t/dag-of-task-dependencides/45805/3 "2023-06-10T17:32:19Z")

</div>

Thank You for reformating it.

In the below script `runJMeter` depends on ‘testClasses’, however, runJMeter is run at last after tests are run…that way, I am not sure why `shadowJar` is called before `test` task.

 ![image](https://global.discourse-cdn.com/gradle/original/2X/8/89140f17237929e77908c5412b5f08ac4e72213b.png)

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [June 10, 2023, 7:11pm UTC](https://discuss.gradle.org/t/dag-of-task-dependencides/45805/4 "2023-06-10T19:11:43Z")

</div>

`test` does not depend on `shadowJar` and also has no ordering constraint defined, so the order in which they run is not guaranteed.

---

<div class="post-metadata">

**Author:** ![Raja\_Nagendra\_Kumar1](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/raja_nagendra_kumar1/32/10491_2.png) [@Raja\_Nagendra\_Kumar1](https://discuss.gradle.org/u/Raja_Nagendra_Kumar1)\
**Post date:** [June 11, 2023, 7:58am UTC](https://discuss.gradle.org/t/dag-of-task-dependencides/45805/5 "2023-06-11T07:58:36Z")

</div>

> [@Vampire](#):
>
> also has not ordering constraint defined,

Did not understand…

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [June 11, 2023, 2:44pm UTC](https://discuss.gradle.org/t/dag-of-task-dependencides/45805/6 "2023-06-11T14:44:14Z")

</div>

> Did not understand…

… what?

---

<div class="post-metadata">

**Author:** ![Raja\_Nagendra\_Kumar1](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/raja_nagendra_kumar1/32/10491_2.png) [@Raja\_Nagendra\_Kumar1](https://discuss.gradle.org/u/Raja_Nagendra_Kumar1)\
**Post date:** [June 12, 2023, 12:55pm UTC](https://discuss.gradle.org/t/dag-of-task-dependencides/45805/7 "2023-06-12T12:55:24Z")

</div>

> [@Vampire](#):
>
> also has not ordering constraint defined,

what is an ordering constraint and how to give one…

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [June 12, 2023, 12:59pm UTC](https://discuss.gradle.org/t/dag-of-task-dependencides/45805/8 "2023-06-12T12:59:26Z")

</div>

Those are for example `mustRunAfter` and `shouldRunAfter`. But usually they should not be used if not necessary.  
What would be the reasoning to run `test` after `shadowJar` if `test` does not use the `shadowJar` output?  
The ordering constraints are for example helpful if you have `test` as unit test task and `integTest` as integration test task and want to run `test` before `integTest` as it gives feedback faster.  
If indeed `test` depends on the output of `shadowJar` but `shadowJar` is not run first, this is more a sign of broken configuration, where this dependency is not modeled properly.

---

<div class="post-metadata">

**Author:** ![Raja\_Nagendra\_Kumar1](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/raja_nagendra_kumar1/32/10491_2.png) [@Raja\_Nagendra\_Kumar1](https://discuss.gradle.org/u/Raja_Nagendra_Kumar1)\
**Post date:** [June 25, 2023, 3:45pm UTC](https://discuss.gradle.org/t/dag-of-task-dependencides/45805/9 "2023-06-25T15:45:49Z")

</div>

showJar is packaging that makes sense only after all the tests are unsuccessful… in our case, we want to move to performance testing with JMeter only after tests pass, JMeter needs all the last jar to be deployed in its library.

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [June 25, 2023, 7:25pm UTC](https://discuss.gradle.org/t/dag-of-task-dependencides/45805/10 "2023-06-25T19:25:35Z")

</div>

But still, you really shouldn’t care whether `shadowJar` is built before or after `test` or maybe at the same time if you for example use configuration cache where all tasks can run in parallel if there is no dependency or ordering constraint between them…
