Tuesday, November 1, 2011

Debugging dependencies in Grails



In Grails, and indeed large Java projects generally, dependency resolution can become quite a headache. Tools like Maven and Ivy are a huge help of course, but even they can't prevent tedious days trying to fix that conflict where two classes of the same name are loaded by the same class loader. Grails provides a feature that helps navigate through the complex web of depencies that your web application will no doubt accrue.

Issue the command: grails dependency-report
or if your using the maven-grails plugin: mvn grails:exec -Dcommand="dependency-report"

This will generate a number of reports in the /target/dependency-reports folder for you. The html reports can of course be opened in the browser of your choice. The graph reports (in graphml format) however need a special and - to me at least - uncommon tool. The tool that seems most popular is yEd. Fortunately yEd is available for Linux, Mac, and Windows.

After you have download and installed yEd, open one of the generated graphml files. The graph won't look like much to start, but after you tweak the view it becomes a very useful resource of information. The Ivy site provides a quick how-to on how to make the graph digestible.

Credits


http://burtbeckwith.com/blog/?p=624

No comments:

Post a Comment