Resources are included in project jar file twice


(sm_sena) #1

I have build script to generate an EJB jar file shown below. The script should include all files (*.xml, *.xmi , *.properties and MANIFEST.MF )from the source folder ejbModule/META-INF and put then in the META-INF directory of the generated jar file. The script currently places the content of the META-INF both at the root level of the jar and within a META-INF folder. How do I prevent the files from being added to the root level.

Content of jar file

META-INF/ META-INF/MANIFEST.MF META-INF/ibm_ejbext.properties META-INF/ejb-jar.xml META-INF/ibm-ejb-jar-bnd.xmi META-INF/ibm-ejb-jar-ext.xmi MANIFEST.MF

ibm_ejbext.properties ejb-jar.xml ibm-ejb-jar-bnd.xmi ibm-ejb-jar-ext.xmi etc …

build.gradle

sourceSets {
    main {
        java {
            srcDir
"../../$project.name/ejbModule"
        }
        resources {
            srcDir
"../../$project.name/ejbModule/META-INF"
        }
          output.resourcesDir = "$buildDir/classes/main/META-INF"
    }
}
    dependencies {
   compile files ('../../BaseLibrary/lib/was/6.1/plugins/com.ibm.ws.runtime_6.1.0.jar')
   compile group:'org.apache.geronimo.specs',name:'geronimo-jpa_3.0_spec',version:'1.1.1'
   compile group:'org.apache.openjpa',name:'openjpa',version:'1.2.1'
   compile group:'org.apache.geronimo.specs',name:'geronimo-j2ee_1.4_spec',version:'1.1'
   testCompile group:'junit',name:'junit',version:'4.8.1'
     compile project(':CommonBase')
}

(Peter Niederwieser) #2

Remove the ‘output.resourcesDir = …’ line. Or at least, don’t make ‘output.resourcesDir’ a subdirectory of ‘output.classesDir’.


(sm_sena) #3

IBM Websphere requires the META-INF directory and its content to be under the ejbModule directory (in the project source code). If I remove output.resourcesDir … the files will not be placed in the correct location of the Jar file.

Is there another approach I could take.


(Peter Niederwieser) #4

Setting ‘output.resourcesDir’ isn’t the right solution. The ‘…’'s in your paths look suspicious. Anyway, as far as I can tell you need to set ‘resources.srcDir’ to the same value as ‘java.srcDir’ (and remove ‘output.resourcesDir = …’).