DoTaL

My repository for development tidbits, and a few personal anecdotes

My eventual enjoyment with Hudson

Posted by doubleA on March 15, 2007

Due to a Windows password change on my login at work, my Continuum build server quit running builds because it could not connect to CVS. I remembered having this be a major problem when I first setup Continuum so I dug up my notes on how I did the initial setup.

Then the horror came back because there are .cvspass files with Cygwin CVS (my preferred option), .cvspass registry entries with CVSNT (the default on Win). Lots of other applications correctly find the cvspass entries, but for some reason Continuum does not. There are lots of mailing group questions about this issue between Windows and Continuum.

After quite a lot of frustration, I decided to switch build servers. I had seen some articles by Matt Raible and others about Hudson and how it worked with Maven. “Cool, let’s give it the quick test” I thought. So over to the Hudson site for a download and quick setup guide.

I chose to setup Hudson inside Tomcat 6.0.10 but there is also an easy way to test Hudson out. Expand the zip download and then run “java -jar hudson.war”. This starts up Hudson using Winstone and all works quite well. This is probably the best way to do a simple test if you are investigating Hudson for the first time. Using Tomcat is almost as easy because you just drop the WAR into the webapps directory and then go to http://localhost:8080/hudson.

Note: If you use the Winstone container, your Hudson app will be located at http://localhost:8080 with no path.

Note: If you are using Tomcat as a service, setup the service to start as a specific user b/c Hudson creates a .hudson dir under the users Windows home directory. This .hudson dir contains all Hudson data files similar to the way Maven uses the .m2 directory under the user’s home dir.

Now we get to the fun part that eventually gets fun for real. Kohsuke Kawaguchi has a blog post about using the Maven 2 integration in Hudson. DON’T FOLLOW THIS BECAUSE THE FEATURE IS IN ALPHA AND I HAD LOTS AND LOTS OF CLASSPATH ISSUES BETWEEN MAVEN AND HUDSON. It took me almost a day of back and forth before I finally found the quick and easy way to use Maven in Hudson. Just take my advice and don’t struggle with the alpha maven2 integration.

Tip of the day:
Here are my condensed steps for success with Hudson.

  1. Setup JAVA_HOME for your JDK1.5 install
  2. Setup your .cvspass file using the tool of your choice.
  3. Startup Hudson
  4. Click “Manage Hudson”, then “System Configuration”, and configure your JDK, CVS exe, Maven, and email settings. Save the settings
  5. Click “New Job”
  6. This is the most important step. Choose “Build a free-style software project”
  7. Enter all the info for your project. You can enter which maven targets are run, if emails should be sent, if unit tests results should be reported, etc
  8. Save your project and then click “Build now”
  9. All is well in the world and your Continuum troubles go away!!

Further notes:
I setup my builds to poll SCM with a schedule of */5 * * * *. This causes a CVS scan every 5 minutes and it’s working fine for my few projects that are configured. Obviously you may want to change the interval, but be sure to use */n * * * * if you want the poll to occur at regular intervals. If you only use 5 * * * *, CVS will be polled at 5 past the hour for every hour.

I really like the unit test report that is generated. With Maven, you would use a string like “MyApp-core/target/surefire-reports/*.xml MyApp-web/target/surefire-reports/*.xml” if you have a parent project with a core and web sub-project. If you don’t have a parent maven project, use “target/surefire-reports/*.xml”. With this setting, Hudson keeps a graphical view of your unit test success and it’s very easy to see when things go wrong.

About these ads

8 Responses to “My eventual enjoyment with Hudson”

  1. Actually, you need only one key step for success:

    1. Install Parabuild.

    Regards,

    Slava Imeshev

  2. DanR said

    Yeah, that and keep some cold hard cash on hand for the licensing costs of parabuild. Dude, if you’re gonna troll-post adverts for your product, be forthright about it. Why the Hudson slam anyway Slava? Nervous much? ;)

  3. Danny said

    I just found Hudson today and I’m thrilled with its ease-of-install (the JNLP made the demo a sinch), but I’m stuck on using it with a corporate maven2 repository. The project’s don’t seem to read the local settings.xml file or use the ~/.m2/repository so its not finding some of our internal artifacts. Is this a problem you had to work through?

  4. doubleA said

    Danny, I did not have any problems with Hudson picking up my Maven settings. With my config, I setup maven 2.0.4 on the Hudson server first, then I installed Hudson. I’m using maven-proxy for my corporate repo, and that is also on the same server. But it should all work even if it is on different servers because my settings.xml references the full server hostname of the maven-proxy repo.

  5. Danny said

    Actually, the problem ended up being on that system. Someone had left some maven settings lying around in the $MAVEN_HOME/conf directory, which were taking precedence over the ones I had in ~jboss/.m2. The only issue I’m still having is hudson ticket #503, but I’m sure I’ll have that solved soon enough. Thanks for the great blog; sorry to turn your comments area into a ‘help me’ post. :-)

  6. Martha said

    Hi:

    I’m evaluating Hudson to use it for our nightly build system, and I have the same problem that has Danny but I can’t figure it out how to solve it.

    The settings.xml file is in C:\Documments and Settings\username\.m2\repository\ and also in the MAVEN_HOME\conf directory, but when I build my project, Hudson send me that don’t find the artifact that is repository.

    I hope you can give a clue. I put this problem in the hudson mailing list but I’m waiting for an answer. Maybe is something very easy but at this moment I’m block and sometimes the view of other could help.

    Thanks in advance

  7. doubleA said

    Martha, could you post the specific error Hudson is reporting? Your maven settings.xml file should be on the same machine as Hudson and it should be in the MAVEN_HOME/conf dir.

    Are you using a private maven repo for your artifacts, or do you just use the .m2 directory? Finally, is the artifact that is not found one of your artifacts are a third party artifact?

    Oh, and one more note. Did you make sure you are using a free-style project in Hudson instead of a Maven project. I never had any luck with the Maven type project.

  8. Yes! Finally something about affordable coverage.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: