Can Gradle handle builds for legacy projects without having to restructure directories?

build, build-automation, gradle, java, maven

Solution

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.

Problem

To put the question in other way, does Gradle impose certain directory structure into the project it manages? I have a legacy project in my plate, and the task is to make it easier for it to build and manage. It is a multi-module Java EE application. I found (and you will too i'm sure) that the current build process is utterly skewed and totally a time waster. I believe this is the time to straighten things by introducing build management system, and the choice is between Maven and Gradle. Most of the projects are using eclipse project's directory structure. Several others using different directory layout which until now I cannot find the reason behind. Using Maven, this will be a stumbling block as we will need to restructure the directories to comply with maven's convention. Restructuring directories might be huge additional effort as we need to sort it out on the CVS also. Thus the question to Gradle.

Original source