Including XML files in EAR's META-INF directory

Hi,

I have a Gradle project in IntelliJ IDEA and I want to create an EAR with the following structure:
- myEar.ear

  • myWar.war
  • META-INF
    • application.xml
    • weblogic-application.xml
    • MANIFEST.MF

Unfortunately, the weblogic-application.xml file is missing and the application.xml file is the default file and not mine.

How do I include these two files? Below is my build.gradle file:

apply plugin: ‘java’
apply plugin: ‘war’

version ‘1.0-SNAPSHOT’

sourceCompatibility = 1.8

// To use the Java JDK instead of the JRE in the PATH
compileJava.options.fork = true
compileJava.options.forkOptions.executable = javacExe

dependencies {
compile fileTree(dir: ‘lib’, include: [’*.jar’])
}

war {
archiveName = ‘myWar.war’
from (fromResourcesDir) {
into toResourcesDir
}
}

project(":myEar") {
apply plugin: ‘ear’

project.version = rootProject.version
project.buildDir = rootProject.buildDir

dependencies {
    deploy project(path:":", configuration:'archives')
}

ear {
    archiveName = 'myEar.ear'
    from ('src/main/application/META-INF/weblogic-application.xml') {
        into 'META-INF'
    }
    from ('src/main/application/META-INF/application.xml') {
        into 'META-INF'
    }

    manifest {
        attributes 'Weblogic-Application-Version': weblogicApplicationVersion
    }
}

}

Figured it out. The relative path was wrong for the weblogic-application.xml and application.xml files. I used the absolute path instead.