How do we make a steps in a task complete?

This is a very strange issue that I have run into. I need to unzip a zip file followed by extracting more contents from a jar file.

Extract main.zip

------->main.jar

Extract main.jar

-------> get a resource

But the issue is - even before the zip file is extracted, it looks for the jar file and the task fails. Isn’t the task supposed to execute sequentially?

I seem to be missing an important piece here. Can someone please explain?

This is how I implemented it -

task extract(type:Copy){
  from
zipTree(sourceZip)
into finalDir
  from zipTree(sourceJar)
into finalDir
  }

The multiple into’s you have there are redundant.

It should be:

task extractZip(type:Copy){
  from
zipTree(sourceZip)
  from zipTree(sourceJar)
  into finalDir
}

As for you larger problem. I don’t understand exactly what you are trying to do.