# Exclude folder doesn't work in Jar task

**URL:** <https://discuss.gradle.org/t/exclude-folder-doesnt-work-in-jar-task/1368>\
**Category:** Old Forum Archive\
**Created:** [April 10, 2012, 6:27pm UTC](https://discuss.gradle.org/t/exclude-folder-doesnt-work-in-jar-task/1368 "2012-04-10T18:27:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![guy\_brand](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/guy_brand/32/294_2.png) [@guy\_brand](https://discuss.gradle.org/u/guy_brand)\
**Post date:** [April 10, 2012, 6:27pm UTC](https://discuss.gradle.org/t/exclude-folder-doesnt-work-in-jar-task/1368/1 "2012-04-10T18:27:00Z")

</div>

Hi we have the following source folder structure:

```gradle
com
--test
----internal
----foo
------internal
----bar

```

and we want to create an api jar file with the following task:

```gradle
task jarApi(type: Jar) {
      from compileJava
      exclude ' **/internal/**'
      includeEmptyDirs = false
      classifier = 'api'
    }

```

Our problem is that the generated jar file includes some internal folders but not all. Am I missing something? I also tried to set the includes and excludes properties and this also doesn’t work.

Thanks in advance.

Guy

---

<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:** [April 10, 2012, 10:24pm UTC](https://discuss.gradle.org/t/exclude-folder-doesnt-work-in-jar-task/1368/2 "2012-04-10T22:24:00Z")

</div>

I don’t see anything wrong with your code (except that ‘from compileJava’ won’t include any resource files), and it appears to work fine for me. Can you provide a self-contained build that allows us to reproduce the problem? Also, can you post the output of ‘gradle -v’?

---

<div class="post-metadata">

**Author:** ![guy\_brand](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/guy_brand/32/294_2.png) [@guy\_brand](https://discuss.gradle.org/u/guy_brand)\
**Post date:** [April 11, 2012, 6:41am UTC](https://discuss.gradle.org/t/exclude-folder-doesnt-work-in-jar-task/1368/3 "2012-04-11T06:41:00Z")

</div>

I found the problem while creating the self-contained build. Sorry for the inconvenience.
