ShadesofGraylin.net

A home for the thoughts I think and the things I do

Open Legislation on Maven

This weekend I put Open Legislation back on Maven. It was on Maven before, but while I was away (i.e. ignoring the project over winter break) a new branch was started and it somehow doesn’t have Maven and since it is now the main development branch, it seemed like time to bring Maven back in again.

I’d like to pause here to explain what Maven is and why Maven is a good thing because many (most) people don’t know what Maven is or why it is awesome (at least in my experience).

Maven

Maven is a software project management tool. It makes managing dependencies, building, testing, packaging, and deploying (more or less) easy. How easy? Lets take Open Legislation as an example on Ubuntu.

  1. sudo apt-get install git-core maven2 openjdk-6-jdk tomcat6
    These are the software dependencies not packaged or provided by maven2
  2. git clone git://github.com/nysenatecio/OpenLegislation.git
    Grab the latest copy off of github
  3. cd OpenLegislation; git checkout ingest
    Jump into the repo and checkout the ingest branch (latest and greatest)
  4. mvn package
    Maven grabs all dependencies, builds, tests, and packages OpenLegislation into a .war

Now just grab the .war file and deploy where ever you want. This is especially nice because we don’t keep any of the dependencies in the repository. Maven automatically fetches them as needed in accordance with the `pom.xml` at the root of the repository. Its even got plug-ins for integration with Eclipse and integration with Tomcat so that you can work entirely within eclipse or build,test,package,and deploy to server in one step with `mvn tomcat:deploy`.

So maven does a good job of keeping the repository light weight while making dependencies easy and wrapping the (scary) Java build process up in nice friendly commands.

Now, the pom.xml file itself can be a pain to put together (xml is so tedious) but luckily, the eclipse plug-in makes the process startlingly easy. Just open up the pom.xml file, click add dependency, start typing the package name until the auto-suggest finds what you want, select the version you want (or choose latest) and hit enter. Rinse and repeat for all your dependencies.

Of course the official maven repositories don’t have every single possible Java dependency ever (though often it seems like it), so its not always that easy. But even in these edge cases, its really not too hard to bring them under Maven dependency management.

OpenLegislation

So back to Open Legislation. Now that its back on Maven and we’ve removed the dependencies on MySQL and JDO its getting to the point where its almost a no-brainer to install. There are definitely still some issues and I think there are a few places where manual configuration edits are needed but things are moving along nicely.

Not that it really matters quite yet anyway, the average individual would have virtually no reason to install and deploy Open Legislation since it really only works for the exact use case of the New York Senate’s legislative data. But I’m learning how to reduce friction and make life as a contributor easy. Useful skills for anyone to have going forward.

Even if Open Legislation never makes it to the extensible point where it can be re-used by other bodies, its processes and technology stack can serve as an excellent use case for those who follow.

Posted in RCOS | Tagged , | Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>