# Gradle 1.0m6 changes jar resource behavior

**URL:** <https://discuss.gradle.org/t/gradle-1-0m6-changes-jar-resource-behavior/6430>\
**Category:** Old Forum Archive\
**Created:** [November 29, 2011, 7:22pm UTC](https://discuss.gradle.org/t/gradle-1-0m6-changes-jar-resource-behavior/6430 "2011-11-29T19:22:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![phil\_swenson](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@phil\_swenson](https://discuss.gradle.org/u/phil_swenson)\
**Post date:** [November 29, 2011, 7:22pm UTC](https://discuss.gradle.org/t/gradle-1-0m6-changes-jar-resource-behavior/6430/1 "2011-11-29T19:22:00Z")

</div>

gradle 1.0m6 seems to have changed the behavior on building a jar containing only resources.

in m3 this worked:

```gradle
sourceSets.main.resources {
    srcDirs = ["../../src/java/core"]
    include "com/web/bpo/ui/portlet/GlobalResources.properties"
}

```

I get this error on m6, runs fine on m3 12:21:10.473 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.IllegalArgumentException: A Jar can only accept a valid file or directory: /Users/pswenson/dev/sag/optimize/trunk/gradle/bpo-resource/build/classes/main

in m6, it looks for a “classes” directory and errors out.

Is there a work-around?

---

<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:** [November 29, 2011, 11:23pm UTC](https://discuss.gradle.org/t/gradle-1-0m6-changes-jar-resource-behavior/6430/2 "2011-11-29T23:23:00Z")

</div>

I can’t reproduce this. Can you show the rest of the build script? What task(s) do you run? Which OS?

---

<div class="post-metadata">

**Author:** ![phil\_swenson](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@phil\_swenson](https://discuss.gradle.org/u/phil_swenson)\
**Post date:** [November 30, 2011, 8:39pm UTC](https://discuss.gradle.org/t/gradle-1-0m6-changes-jar-resource-behavior/6430/3 "2011-11-30T20:39:00Z")

</div>

OS X, “gradle assemble”

the project is very simple. For the subproject in question, there are no “source” files, only resources.

The root project is:

```gradle
apply plugin: 'idea'
buildscript {
    dependencies {
        classpath(
                'com.myco.bas:bas-plugins-core:latest.milestone',
        )
    }
}
  subprojects {
    apply plugin: 'bas-osgi'
    sourceCompatibility = 5
    targetCompatibility = 5
    build.version.major=8
    build.version.minor=2
    build.version.micro=5
}

```

the subproject that is the prob is code is

```gradle
sourceSets.main.resources {
    srcDirs = ["../../../src/java/core"]
    include "com/myco/bpo/ui/portlet/GlobalResources.properties"
}

```

---

<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:** [December 1, 2011, 2:24pm UTC](https://discuss.gradle.org/t/gradle-1-0m6-changes-jar-resource-behavior/6430/4 "2011-12-01T14:24:00Z")

</div>

Still can’t reproduce. Can you attach a project that demonstrates the issue?

---

<div class="post-metadata">

**Author:** ![Tinh\_Truong](https://avatars.discourse-cdn.com/v4/letter/t/b5ac83/32.png) [@Tinh\_Truong](https://discuss.gradle.org/u/Tinh_Truong)\
**Post date:** [July 17, 2012, 7:41am UTC](https://discuss.gradle.org/t/gradle-1-0m6-changes-jar-resource-behavior/6430/5 "2012-07-17T07:41:00Z")

</div>

I can reproduce this issue locally even with Gradle 1.0 Final Here is the step: -Create folder structure like this: +resource-only

|—build.gradle

|—src

|------main

|---------java

|---------resources

|------------sample-resource.conf (empty file) -Run ‘gradle jar’ Here is the content of the build.gradle

```gradle
apply plugin: 'java'
apply plugin: 'osgi'

```

If I remove the plugin osgi, everything works as expected! So there is some wrong with osgi plugin in this case.

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [July 17, 2012, 8:35am UTC](https://discuss.gradle.org/t/gradle-1-0m6-changes-jar-resource-behavior/6430/6 "2012-07-17T08:35:00Z")

</div>

Raised as GRADLE-2391.
