# Multiple fileTree in resources section

**URL:** <https://discuss.gradle.org/t/multiple-filetree-in-resources-section/4047>\
**Category:** Old Forum Archive\
**Created:** [August 6, 2014, 7:20pm UTC](https://discuss.gradle.org/t/multiple-filetree-in-resources-section/4047 "2014-08-06T19:20:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Knut\_Forkalsrud](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/knut_forkalsrud/32/807_2.png) [@Knut\_Forkalsrud](https://discuss.gradle.org/u/Knut_Forkalsrud)\
**Post date:** [August 6, 2014, 7:20pm UTC](https://discuss.gradle.org/t/multiple-filetree-in-resources-section/4047/1 "2014-08-06T19:20:00Z")

</div>

I’m trying to migrate a Maven1 build to Gradle. This is my first real Gradle build, so I’m probably doing something wrong. The issue I face is that there are several directories with their related Ant style matching patterns. Inspired by the users manual (Chapeter 16.3 File Trees: [http://www.gradle.org/docs/current/userguide/working\_with\_files.html#sec:file\_trees](http://www.gradle.org/docs/current/userguide/working_with_files.html#sec:file_trees)) the best I can come up with is the build file below. Unfortunately this causes Gradle to fail with the message

Could not find method main() for arguments [build\_4fd8glkjbn7dka51fkr3r4chr3$\_run\_closure1\_closure2@4959f789] on root project ‘gradleq’.

By the way this is easily reproducible, no other files needed. My Gradle version is 2.0.

My question is either: What am I doing wrong? Alternatively: How can I get two resource directories with associated matching patterns?

```gradle
apply plugin: 'java'
  sourceSets {
    main {
        java {
            srcDir 'src/java'
        }
        resources {
          srcDirs [
            fileTree(dir: 'src/etc', includes: ['*.xml', '*.properties']),
            fileTree(dir: 'other/resources', includes: ['*.xml', '*.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:** [August 8, 2014, 12:29am UTC](https://discuss.gradle.org/t/multiple-filetree-in-resources-section/4047/2 "2014-08-08T00:29:00Z")

</div>

The correct syntax is:

```gradle
sourceSets {
    main {
        java {
            srcDirs = ['src/java'] // want to override the default
        }
        resources {
            // cannot omit the '=' because this would try to
             // index into the 'srcDirs' value
            srcDirs = ['src/etc', 'other/resources']
             include '*.xml', '*.properties'
// or: ' **/*.xml', '** /*.properties'
        }
    }
}

```

As can be seen above, include filters are currently per source directory set (e.g. ‘sourceSets.main.resources’), not per source directory.
