Oct 5, 2010

Automating a svn project by using hudson

Hudson is a continues integration system. It can monitor executions of a job continuously.
Hudson can use to monitor SVN projects and CVS projects. It can build a project at a given time and in a given frequency. User can setup it to build a project when some one commit the project.
The build can be done by invoking Mavan, Ant, Windows batch command or even a shell script. And also user can get a feedback to his/her e-mail.
The best thing is a it got very user friendly web interface where the all configurations take part.

Now we are going to setup hudson, to execute svn project with the help of Mavan. As I sad before, this is a web based thing we need to install apache tomcat server. So download it from the apache website and install it. Also you may need to install JDK in order to work properly. Now you may need to install mavan too. Download mavan from the apache site and install it. Make sure that you  are installing the stable versions of all these software.
While installing, check that you are make path variables as in the software installation document.
If javac, mvn and apache tomcat things are working properly, you can download the hudson. Go to hudson website and download a .WAR file. Stop the tomcat server and move the .WAR file into webapps folder in the tomcat server. Then start the web server. Server will execute the .WAR file and it will put hudson live. You will be able to use hudson by visiting http://localhost:8080/hudson URL. So up to this point we had setup the hudson. Now we should configure hudson to build a project.
To do that, go to new job and select "Build a free-style software project". Then it will give a form like thing to fill. That is the place you can configure the build. Give a name and fill other relevant fields as you need. Then in the source code management section choose subversion and give the URL where the svn project is located. Then you can move to build triggers. If you only need to build if someone commit the svn, you should use "pool scm". We will use mavan to build our project so, we invoke Mavan. In the goals field write the mavan commands without "mvn" word. Finally in the post build action section you can set E-mail notifications too.
Now when ever you commit that project it will automatically build the project. And if there any build fail, it will send a e-mail notification.

No comments:

Post a Comment

Your comments are always welcome ...