Copy libs from ear file into my project

In my project, I’m creating a WAR file which is deployed to an OAM server. Oracle has an EAR file, which contains JAR files that I need to copy into my project. I’m placed the EAR file in our artifact repository. So, I want to do is get the EAR and uncompress it in a directory and copy the JAR files into the WAR file.

After researching online, I have made several attempts to copy the ear and uncompress it, but I cannot get it to copy and uncompress the file. This is what I have tried. Any help would be appreciated.

configurations {
dependencies {
earFiles ‘’
ext.unpackedEarFiles = fileTree("$buildDir/tmp/earFiles") {
builtBy 'unpackEarFiles’
println “FileTree…”
task unpackEarFiles(type: Copy) {
println "Copying…"
from configurations.earFiles.files.collect {
println "Extracting…"
println it
into unpackedEarFiles.dir

This is what I’m seeing in output.


I figured it out. I had to add a dependsOn inside my war section. From there, I had to work with copying the JAR files from the tmp location into the war.