Shay_t
Shay_t

Reputation: 163

Gradle, include all json files in my build directory

hey all i want gradle to copy all my JSON files inside my source code into the same path under the build directory.

this is what i have in my gradle.build file

sourceSets {
    main {
        resources {
            srcDirs = ['src/main/java', 'src/main/resources']
            include 'com/company/project/package/**/*.json','images/**/*.jpg', 'images/**/*.jpeg', 'images/**/*.png'
        }
    }
}

but the files are missing

thank you

Upvotes: 0

Views: 2394

Answers (2)

Shay_t
Shay_t

Reputation: 163

i had to delete the 'out' and 'build' folders, after that it just worked...

Upvotes: 0

lance-java
lance-java

Reputation: 28016

Not sure it'll help but your code would be more future proof if you blacklisted *.java instead of maintaining a whitelist

sourceSets {
    main {
        resources {
            srcDirs = ['src/main/java', 'src/main/resources']
            exclude '**/*.java'
        }
    }
}

Upvotes: 1

Related Questions