Suresh Payankannur

Friday, September 5, 2014

Handling Resources with Gradle

Gradle copies resources to a different directory than Maven. So when migrating from Maven, the source code needs to be changed to take care of the new resource locations. In order to keep the resources are copied to the correct location, add the following into your projects build.gradle file.

project.buildDir = 'target'

sourceSets {
    main {
        output.resourcesDir "${project.buildDir}/classes"
    }
    test {
        output.resourcesDir "${project.buildDir}/classes/test"
    }
}

0 comments:

Post a Comment

Blog Archive

Scroll To Top