SQL Zone is brought to you in partnership with:

Mitch Pronschinske is a Senior Content Analyst at DZone. That means he writes and searches for the finest developer content in the land so that you don't have to. He often eats peanut butter and bananas, likes to make his own ringtones, enjoys card and board games, and is married to an underwear model. Mitch is a DZone Zone Leader and has posted 2573 posts at DZone. You can read more from them at their website. View Full User Profile

For Hibernate Developers, It's Time to Learn Gradle

10.17.2010
| 14117 views |
  • submit to reddit
The Hibernate team made it official when they recently switched the Hibernate 4 master branch on GitHub over to Gradle for its builds.  Now is as good a time as any to learn how the Gradle build system works in comparison to Hibernate's earlier build system, Maven 2.

If you're still wondering why the Hibernate developers decided to switch from Maven to Gradle, you can read these explanations and see what other developers had to say in this StackOverflow thread.

This is important news for anyone who's contributing to the open development of Hibernate.  Now, for those of you willing to try this Gradle thingy, it's always best to bookmark the project's documentation, which is mature and extensive.  This will be your go-to-guide for almost any question.  Since pre-4.0 versions of Hibernate use Maven for builds, most developers will want to know how certain things in Maven translate to Gradle.  For these developers, there is a three-part guide that helps Maven-users learn Gradle.

Intro to Gradle Video


JBoss developer Steve Ebersole also created a list of Gradle tasks that you will probably use the most:

  1. clean - Deletes the build directory.
  2. build - Assembles (jars) and tests this project.
  3. buildDependents - Assembles and tests this project and all projects that depend on it. So think of running this in hibernnate-entitymanager. Gradle would assemble and test hibernate-entitymanager as well as hibernate-envers because envers depends on entitymanager. See below.
  4. classes - compiles the main classes
  5. testClasses - compiles the test classes.
  6. test - Runs the tests for this project
  7. jar - Generates a jar archive with all the compiled classes.
  8. uploadArchives - think Maven deploy
  9. install - I have also enabled the MavenPlugin throughout the projects, which adds this task. install installs the project jar into the local maven repository cache (usually ~/.m2/repository), which is important to inter-operate between projects using Maven to build and those using Gradle to build (otherwise you'd have to push your artifacts to Nexus to “share”)

The newest version of Gradle is 0.9, which is currently in the release candidate stage.  Here's what's new in Gradle 0.9.

Comments

John J. Franey replied on Mon, 2010/10/18 - 8:22am

Your title is not correct. Hibernate users do not need to know how to build hibernate, with gradle or anything else. The title: "For Hibernate Developers, It's Time to Learn Gradle" is almost correct, but when we say "Devloper" we mean those developers who change the hibernate source code.

Mitch Pronschinske replied on Mon, 2010/10/18 - 11:37am in response to: John J. Franey

I updated the title to be more accurate.  Thanks!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.