Thursday, April 29, 2010

Getting Maven to Work in Hudson

We were having some trouble today getting a Maven 2 project to build in Hudson v1.353. Specifically, we were getting an 'Exception in thread "main" Connection refused'.

We added:

to MAVEN_OPTS in the hudson configuration page (per Martijn Dashorst and mbrictson's posts) and this issue seems to have gone away. Thanks much to Martijn and mbrictson for sharing this solution!

It is strange that after setting this and then removing it, projects continue to build correctly, even if MAVEN_OPTS in each individual project (in Advanced under Build section of your projects Configure page in Hudson) does not contain this parameter. It also continued to work after Hudson was restarted.

Note: I had previously installed Maven to a local spot manually instead of via Hudson. I tried to let Hudson automatically install it, but it had some wierd errors on build. First I had some rights-related issues that I fixed, but then I ran into a SocketTimeoutException and just decided install Maven 2 myself in different directory than where Hudson puts it.

No comments: