Saturday, March 14, 2015

Gradle: add source dirs vs replace source dirs

http://stackoverflow.com/questions/10570795/can-gradle-handle-builds-for-legacy-projects-without-having-to-restructure-direc?rq=1

Gradle uses convention over configuration which allows you to provide minimal information to build your project if you follow the standard project layout. That said everything is still configurable using a declarative style:
sourceSets {
main {
    java {
        srcDir 'src/java'
    }
    resources {
        srcDir 'src/resources'
    }
}
}
Because you have a real programming language you can do almost anything.


Note that this adds source directories rather than replacing them. The syntax for replacing is srcDirs = ['src/java'] and srcDirs = ['src/resources'].

No comments: