[logback-dev] How about switching build to Gradle?
jhuxhorn at googlemail.com
Wed Dec 29 15:08:26 CET 2010
I've recently switched the build of sulky and Lilith from Maven to Gradle and it's a real pleasure to use. Hibernate and parts of Spring have switched, too.
Take a look at http://blogs.jfrog.org/2010/07/to-build-or-not-to-be-seminar-videos.html and/or http://vimeo.com/16571738 for a nice introduction into Gradle.
http://github.com/huxi/sulky contains the following 5 files:
build.gradle is the actual build file and simply includes dependencyDefinitions.gradle, projectDependencies.gradle and config.gradle.
dependencyDefinitions.gradle contains the definitions of all external dependencies - comparable to a dependencyManagement section in a parent pom.
projectDependencies.gradle contains the basic definition of the sub-modules (and should probably be renamed accordingly ;)), including the dependencies of each sub-module.
config.gradle contains the actual configuration of the build, i.e. anything that isn't already handled by the default Gradle build, including everything necessary to perform a release into oss.sonatype.org maven repository.
settings.gradle is a currently mandatory file that defines all sub-modules in a multi-module project.
http://github.com/huxi/lilith contains the same general structures but is handling more complex tasks, e.g. sub-sub-modules, fatjar...
I'm not saying that this is a perfect setup. You have much more freedom in Gradle than in Maven about the way you are structuring your build. It's merely meant as a functional example of a non-trivial multi-module project.
Gradle offers major improvements in build speed (very intelligent up-to-date detection that makes clean unnecessary, vastly improved test execution) and saves a lot of time during release.
In contrast to Maven you only have to change a single file instead of one pom in each sub-module.
I'm currently still keeping the Maven build in place but I do this only because Gradle isn't yet supported by Sonar, something that is supposed to change with Sonar 2.6 due in february. See (and vote) http://jira.codehaus.org/browse/GRADLE-888 .
I'd also like to point out that Gradle doesn't offer something like the Maven site plugin, yet.
Beside that, using Gradle is pure pleasure.
The switch wasn't always easy, mainly because PGP signing was still missing (so I wrote a plugin to support it ;)), but the people on the #gradle channel over at irc.codehaus.org are very, very helpful.
Let me know what you think. I'd certainly offer help migrating SLF4J & Logback if needed.
More information about the logback-dev