Hudson is a very user friendly Continuous Integration Server Software that can be used to monitor any type of project and inform you the status in many different ways. Hudson being an open source software, has an active community and has frequent releases when compared to many other open source projects with added features. It has a huge plug-in base that provides the capability to Hudson CI to be integrated to many other relevant applications.
To install Hudson you only need a Servlet/JSP container like Tomcat installed. The Servlet Container needs not to be limited only to Tomcat. But for this tutorial I’m going to use Apache Tomcat.
Tomcat bundle can be downloaded from http://tomcat.apache.org/download-60.cgi
Configuring Hudson for use
Once you go to the Hudson Dashboard all the configurations can be done from ‘Manage Hudson’ link as follows,
figure :1Once you are inside the ‘Manage Hudson’ link, you can see a screen as follows whether you must go to the ‘Configure System’ link to do the actual configuration.
figure :2Essential Configuration Settings
Before building any java application we have to do 2 key configurations in ‘Configure System’ link. Those are to provide the JDK path and a build tool path. For this example we are using Ant as the build tool. Both JDK (downloadable from: http://java.sun.com/javase/downloads/widget/jdk6.jsp) and the Ant (downloadable from: http://ant.apache.org/bindownload.cgi) should be installed and tested before doing this step for easy isolation of faults at latter time.
figure :3Create Users
Hudson doesn’t require users or user groups to be defined before using it to build jobs. But it is always better to define privileges to avoid unnecessary meddling from anonymous users.
To define users first check the ‘Enable Security’ option and select “Hudson’s own user database” and check ‘Allow users to sign up’ option. In the Authorization sub heading, select ‘Matrix base security’ where you can provide privileges to users. I have created ‘Guest’ user for demonstration purposes. Guest was marked with an error symbol because we have not created the Guest user yet, even though we set the privileges to the Guest user. Make sure you give at least one user all the administration privileges which can be used later to setup other configurations. After creating few users, save the settings from the ‘save’ button provided at the end of the page. This will redirect you to a login page.
Create a java jobGo to ‘New Job’ tab to create a new job. Then enter a name and select ‘Build a free-style software project’ and click ‘Ok’.
Then a job called ‘Test’ is created and the user is directed to job’s configuration page. In here we have to specify the Source Code Management tool path that we are using for this particular project and some additional features like which Build tool to use and the command to archive the artifacts.
As the source code management tool, I’m using Subversion. So I selected ‘Subversion’ under the SCM heading and gave the repository URL to my Test job, which is the repository URL for my project named ‘Welcome’.
Since ‘Welcome’ is a java web application, under the Build heading I selected Invoke Ant because I want Ant to build my java project. After selecting Invoke Ant from the drop down menu, specify the ‘Ant version’ from ‘Default’ to the Ant setup name, you created in the initial system configuration.
In ‘Post-Build Action’ we can program the CI Server to do many other operations other than building the project. Here I have checked ‘Archive the Artifacts’, which will save a working executable file along with the build. For this option it is required to correctly specify which file to be archived.
In ‘Post-Build Action’ it is also possible to set email notifications after every build. This option I have not shown here because I have not configured Email settings in system configuration.
Building a .NET project in HudsonBefore creating a job to build a .NET project there is a small system configuration to be done in ‘Configure System’ page. In this page now choose the ‘Manage Plug-ins’ link. After going to that page in the ‘Available’ tag under the heading ‘Build Tools’ check MSBuild option and click ‘Install’ button in the bottom right corner of the same page. After that through internet the plug-in will be downloaded and installed automatically. Once the plug-in is installed, Hudson CI is needed to be restarted.
Once the server is restarted, in the ‘Configure System’ page there is a new heading named, ‘MSBuild Builder’. In this, we have to provide the path to MSBuild installation in your machine which is an inbuilt tool shipped with Visual Studio setup and can be usually found in location C:\Windows\Microsoft.NET\framework\version.