Over a million developers have joined DZone.

For Hibernate Developers, It's Time to Learn Gradle

· Java Zone

Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code! Brought to you in partnership with ZeroTurnaround.

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.

The Java Zone is brought to you in partnership with ZeroTurnaround. Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code!

Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}