Ear plugin , copy into is not consistent

hi,
i am in the processes of moving from ANT to Grable
and i found that from time to time the copy part in the ear file
is not working as i expect.
this is my project layout
i have multi project that include about 15 projects
and in main gradle build i am creating the ear this include the jars from the sub projects
i am using the into in the ear files and not earlib option as i don’t need all the libs from the sub project dependency

this is part of the ear Gradle script
ear {
// insted of useing the the build in earlib
// we will copy the jars one by one
into(‘lib’){
from(“XXXXXXXXX/lib/”) {
include ‘*.jar’
// remove unnecessary jars
exclude ‘com.ibm.mq.headers.jar’
exclude ‘com.ibm.mq.jmqi.jar’
from(“YYYYYY/build/libs”) {
include ‘YYYYY.jar’
}
from(“ZZZZZ/build/libs”) {
include ‘ZZZZ.jar’
}
}
and in the 1 run the ear do not include the ZZZZ.jar
but in the second run the ear include the ZZZZ.jar
and i can not found the problem

do the ear file create runs only after ALL sub projects are done ?

i can now see in the log that the Tasks to be executed order is incorrect
Tasks to be executed: [
.
.
.
.
task ‘YYYYYY:processResources’
task ‘:YYYYYY:classes’
task ‘YYYYYY:war’
task ‘:ear’
task ‘:assemble’
task ‘:check’
task ‘:build’
task ‘:ZZZZ:compileJava’
task ‘:ZZZZ:processResources’
task ‘:ZZZZ:classes’
.
.

how can i control this order