Saturday, August 10, 2013

Latest plugins on Apache Maven Central

by Richard Vowles

Blue Train Software Plugins


I've made a couple of plugins lately for the projects that we use at Group Applications at the University of Auckland. I decided they would be better as open source plugins, so I did them on my own time, and they address two aspects of the lifecycle of Maven projects that we build these days.

The Release POM Plugin

The first one,  the Release POM plugin is specifically designed to generate a single pom with all transitive dependencies resolved. All dependendencies also add an exclusion clause for all dependencies of their own.

Why? Because sometimes, particularly when you are patching a production artifact, you need to make sure all dependencies stay exactly the same, except for the one you are changing. That is to me what a patch is, and that is very hard to do, as Maven doesn't actually store the versions of the artifacts you use. 

This is exacerbated because we use version ranges, which greatly aids development, bug fixing, feature enhancement and general working within the team, but it also means you need to make sure versions are locked down once you do an actual release intended for production. 

The release pom plugin and its documentation are on Github.

The Karma Runner Plugin


This one is for our Javascript, as we use AngularJS, however it can be used with any Javascript library, it just works very well with AngularJS. It requires the use of Node JS as the Karma Runner project uses that framework. 

Much of what the Karma Runner Plugin does could be done with a considerable amount of manual setup in a Maven pom - it just assumes you are using a war or (preferably) Servlet 3 JAR setup, it scans your dependencies, unpacks the javascript, re-writes the Karma config file, brings in local developer overrides (e.g. browser setups) and runs your tests. It means with minimum fuss, and maximum compatibility, we can run our Jasmine tests for Angular JS. In our case, the definition of the plugin is in the parent of every Servlet 3 jar project, nothing else needs to be configured for an individual project.

If you use Karma in a Maven project lifecycle, it really is a useful plugin.

The Karma Runner plugin for Karma is on Github.

No comments: