Gradle composite build task order seems wrong (Gradle 5.6.2)

I have two projects: A and B.

In A, I have applied the java-library plugin and a custom plugin.

In B i have a dependency to A via a custom configuration called myConfig (I have also tried defining my dependency using the archives configuration, same issue). I have a custom task in B which extracts file from the JAR produced by A.

I have created a composite with A and B with default dependency substitution and with explicit dependency substitution.

The task which extracts the JAR in project B is most of the time run after the task which creates the JAR in A. Therefore I am wondering how I can enforce (without using explicit task dependency) that task from B are run after tasks from A.

For me as soon as there is a dependency substitution all tasks from B should be run after task from A, but it seems not to be the case so I don’t understand how it works.

I am facing a similar issue, did you manage to solve it?

Yes, it was a matter of corretly defnining dependencies of my task. I added a dependency to a Gradle configuration and it worked magically! Defining task inputs was not enough.

-> dependsOn project.configurations.myCustomConfiguration

1 Like

Wow, so simple!
Thanks so much, I was about to invent some crazy workarounds - but this just worked!

Cheers! :smiley:

I am quite surprise in fact that I didn’t find any clear example in the Gradle documentation about this kind of scenario. Not event talking about composite build but making a task depend on some configuration.

Would have made the thing much clearer.