Posts

Showing posts from December, 2008

Gradle First Look

I have put the Groovy based build system Gradle into use for a first project. The project is a deployable jar. This is intentionally the simplest form of project that you can build. I did not want to attempt anything larger given how difficult builds can be.

Gradle seems to have more in common with Maven than Ant. It has a more structured dependency management system than Ant using Ivy and it has a concept of plugins that implement packages of tasks that are designed to work together.

After a short time together, these are my thoughts:
Pros
Absolutely minimal configuration to get a build goingCompact Groovy syntax for depency resolutionDecent documentationTruly scriptable like Ant or early Maven (even though Jelly was a hideous thing)Big plans (let's hope they follow through)
Cons
Error messages are pretty unclear at the moment.
It doesn't yet feel 'intuitive' to useYoung project and many of the built-ins in Maven are not there yet: Cobertura, PMD, etc...So far, the bigg…

A Groovy ZK Builder

I have built a Groovy builder for the ZK tool set.

Motivation
While using ZK with Grails, I found that I was using a lot of Java object building inside of ZK Composer objects. This leads to a profusion of code like the following:


Listbox lb = new Listbox();
Listhead lh = new Listhead();
lh.setParent(lb);
Listheader idHeader = new Listheader('id');
Listheader nameHeader = new Listheader('name');
idheader.setParent(lh);
nameHeader.setParent(lh);

And as XML

<listbox>
<listhead>
<listheader label="id">
<listheader label="name">
</listhead>
</listbox>


As you can see there is a profusion of boilerplate code that is the hallmark of a nested Java API. The XML is easier on the eye and hides setting parent references. What I really wanted was something like the simplicity of the XML with the flexibility inherent in Groovy closures.

Groovy ZkBuilder
The builder's syntax is very similar to the XML.


ZkBuilder zk = new ZkBuilder()
Window w = …