December 13, 2013 | Posted in:tools

Installation procedure for Hudson, the open source Source code build management tool

To use Hudson you need:

  • An accessible source code repository, e.g. subversion, with your code checked in.
  • A working build script, e.g. ant script, checked into the respository
  • A webapplication server, e.g. Tomcat, to run Hudson

Steps to configure Hudson:

  • 1.To use Hudson you need to setup Apache Ant as a build tool.
    2.Download the “hudson.war” file and put the it into your Tomcat “webapps” directory. If you start Tomcat your Hudson installation should be available under “http://localhost:8080/hudson/”.
    3.Open the hudson url then click  on “Manage Hudson” -> “Configure System” and configure the JDK and ant path.
    4.Setup the email notification settings like smtp server ,port ,admin email address.
    5.To deploy wars using hudson install Hudson deploy plugin also subversion release manager plugin to build specific svn revision. 
    Setting up hudson job:
  • 1.Select “New Job” -> “Freestyle Job”.
    2.Select “subversion” and give your project svn url also enter svn credentials.
    3. If you want to schedule a job you can schedule it using Build Triggers .In that you can use Poll SCM or build periodically option and set the time to run a job. If you want to create a build manually use build now option.
    4.Then in Build section select invoke ant option. It will use project build.xml file and execute the targets defined in build.xml.
    5.In Post-build Actions you can select the option you want  like email notification etc. If your project build.xml contains the target to create a war and you want to deploy it into the tomcat then select Deploy war/ear to a container and provide all the details like tomcat url ,tomcat credentials, war file path respective to workspace. 
    6. Then save this job. It will run according to specified schedule or you can run it manually when want to run.
    Build specific svn revision 
    1.If you want to create a build of specific svn revision first install subversion release manager plugin in hudson.
    2.In configuration select  build is parameterized option ->String parameter and provide name: {REVISION}, value:@rev_no  
    3.In Source Code Management->Subversion Release and at the end of repository url add {REVISION} 
    4.Save the configuration and then build .