JSON shell scripting with Node.js

I’m currently in a project team working on an application that stores much of its data in CouchDB. One of the lovely things about Couch is its RESTful API. It’s all simple HTTP and JSON, easy to understand and easy to program to.

One aspect where this interface isn’t so readily accessible is in shell scripting. There’s curl to handle all the HTTP stuff we could ever need, but to transform a JSON structure or extract information from it proved less straightforward. We can cover simple cases with grep and awk, but JSON is complex enough that we (or, well, I) wouldn’t want to. If the documents were XML, we could have used xpath and xslt to do our heavy lifting. There is to my knowledge no equivalent to xmlstarlet for JSON to reliably handle these chores.

We solved our shell scripting problem and the solution is dead obvious, Read more →

How Sonatype Nexus 1.9 ruined my day

Update, 26-02: Brian Demers from Sonatype pointed out in the comments that Maven 2.0.10 and later are forwards-compatible with changes in the metadata format. If your Maven 2 version is one of the recommended versions on the download page, you will not have this problem.

Two days, in fact. Yesterday evening, after my colleagues went home, I brought down our Nexus 1.8.0.1 instance to upgrade it to 1.9 without interrupting their work. The download page for Nexus 1.9 contains the following instruction:

Sonatype has changed how the lucene indexes are stored on disk, it is required that users reindex all repositories in their nexus server to start benefitting from the changes (and for search to work properly).

Inconspicuous enough. Furthermore, clicking through from the change overview to the full change log reveals:

[NEXUS-3849] – Add full support for the new maven 3 snapshot metadata

What it doesn’t reveal is that the rebuild metadata command in the repository administration screen, which would appear to be proper housekeeping at a time when you’re reindexing the repositories, now generates Maven 3 style metadata and inadvertently breaks compatibility with Maven 2 (update: older versions). This is where the fun begins.

Read more →