Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 747
bungrudi Avatar asked May 13 '12 09:05

bungrudi


2 Answers

Both can accommodate arbitrary directory structures. IMO it's easier in Gradle, and not worth it in Maven.

That said, I kind of like having an imposed directory structure, and for the most part, I like the Maven structure. It is a pain in CVS because of the directory-handling issues, but in the long run, moving to a consistent structure across projects is worth it.

like image 20
Dave Newton Avatar answered Sep 30 '22 01:09

Dave Newton


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.

like image 67
Dylan Bijnagte Avatar answered Sep 30 '22 03:09

Dylan Bijnagte