Extract dependency war file

What is the best way to extract a dependency war file to a certain directory. I have the following but that involved specifying the specific war file name, since the name changes depending on the version and the dependencies, I don’t want to do this, I was hoping for something like *.war as there is only one war file in my configurations.runtime. Any ideas ??



task explode(type: Copy) {
from configurations.runtime
include '*.war’
into “$buildDir/staged/”

explode.doLast {
def warFile = file("$buildDir/staged/myWar-26333.war")
from zipTree(warFile)
into “$buildDir/exploded”