The Source for Java Technology Collaboration
User: Password:



Kohsuke Kawaguchi

Kohsuke Kawaguchi's Blog

Hudson became self-executable

Posted by kohsuke on February 11, 2007 at 11:54 AM | Comments (4)

Hudson has always been distributed as a single war file, and the installation was as easy as dropping this war to your web container. I thought this was easy enough, but then people pointed out that installing a web container is not all that easy. There has been some discussion about this in the users list, and usual options like bundling Jetty was mentioned, but none of them seemed quite right.

So this has been in the back of my brain for a while, and then the whole thing "clicked" when I saw an e-mail from one of the Hudson users, where he mentioned a recent blog by Tim Shadel.

Apparently there's this servlet implementation called Winstone, which is pretty handy for the embedded use. The whole implementation is in a single jar. So the "3 minute set up of Hudson" that Tim talks about consists of the following 5 steps:

  1. Download winstone from it's Sourceforge Files page
  2. Download the Hudson war file from its Java.net Release page
  3. Then run java -jar winstone-0.9.6.jar --warfile=hudson.war --httpPort=8081
  4. You should see something like the screenshot below.
  5. Play.

But then I thought, since a war file and a jar file are of the same format, wouldn't it be nice if I put a little bootstrap code in hudson.war, so that you can just execute it like java -jar hudson.war?

hudson.war is already a little more than 10MB, so I could easily afford to put winstone.jar in it, which is around 320KB. When you run java -jar hudson.war, a little Main.class in it will take the control, and it uses winstone.jar inside hudson.war to launch itself.

Of course it's still a war file, so you could still just drop hudson.war in any existing web container, and that works, too. With that, the new "2 minute setup" of Hudson becomes the following:

  1. Download the Hudson war file from its Java.net Release page
  2. Then run java -jar hudson.war
  3. You should see something like the screenshot below.
  4. Play.

... except that as of this writing, this new change is still not released yet. So this will work starting upcoming 1.81.

Really, the installation can't get any easier than that.


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • Or GF v3 when available ... :-) - eduard/o

    Posted by: pelegri on February 11, 2007 at 03:13 PM

  • And 1.81 is just posted.

    Posted by: kohsuke on February 12, 2007 at 05:21 PM

  • Hmm, will this help in developing/debugging Hudson as well? Any ideas? (Using Maven2 support from NetBeans??)

    Posted by: sven on February 13, 2007 at 11:44 AM


  • You could certainly use this to debug Hudson, but doing the following is better, because it provides a far quicker feedback:

    $ cd hudson/main/war
    $ mvn -o jetty:run


    Similarly, you could certainly use this to develop plugins on Hudson, but doing the following is better, because again it makes the edit/build/debug cycle much faster:

    $ mvn hpi:run

    Posted by: kohsuke on February 13, 2007 at 12:03 PM



Only logged in users may post comments. Login Here.


Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds