# Resources are included in project jar file twice

**URL:** <https://discuss.gradle.org/t/resources-are-included-in-project-jar-file-twice/5585>\
**Category:** Old Forum Archive\
**Created:** [July 15, 2013, 8:43pm UTC](https://discuss.gradle.org/t/resources-are-included-in-project-jar-file-twice/5585 "2013-07-15T20:43:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![suriya](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@suriya](https://discuss.gradle.org/u/suriya)\
**Post date:** [July 15, 2013, 8:43pm UTC](https://discuss.gradle.org/t/resources-are-included-in-project-jar-file-twice/5585/1 "2013-07-15T20:43:00Z")

</div>

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

```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')
}

```

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [July 15, 2013, 9:06pm UTC](https://discuss.gradle.org/t/resources-are-included-in-project-jar-file-twice/5585/2 "2013-07-15T21:06:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![suriya](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@suriya](https://discuss.gradle.org/u/suriya)\
**Post date:** [July 15, 2013, 11:00pm UTC](https://discuss.gradle.org/t/resources-are-included-in-project-jar-file-twice/5585/3 "2013-07-15T23:00:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [July 16, 2013, 12:03am UTC](https://discuss.gradle.org/t/resources-are-included-in-project-jar-file-twice/5585/4 "2013-07-16T00:03:00Z")

</div>

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 = …’).
