Manual Hudson v1!0!12 July 2013
Manual Hudson v1!0!12 July 2013
Chapter 1
What is Hudson?
Hudson is a powerful and widely used open source continuous integration server providing
development teams with a reliable way to monitor changes in source control and trigger a
variety of builds. Hudson excels at integrating with almost every tool you can think of. Use
Apache Maven, Apache Ant or Gradle or anything you can start with a command line script
for builds and send messages via email, SMS, IRC and Skype for notifications.
In addition to providing a platform for continuous integration builds, Hudson can also be
extended to support software releases, documentation, monitoring, and a number of use
cases secondary to continuous integration. In short, if you can think it, Hudson can do it.
From automating system administration tasks with Puppet and verifying infrastructure setup
with Cucumber, to building and testing PHP code, to simply building Enterprise Java
applications Hudson stands ready to help.
Chapter 2
1. Hudson has one prerequisite, a Java Runtime Environment (JRE) compatible with
Java 6 or higher. Hudson is most often run with the JRE that is bundled with a Java
Development Kit (JDK) installation. Visit the following link to download JRE/JDK
http://www.oracle.com/technetwork/java/javase/downloads/index.html
2. The Hudson web site (http://hudson-ci.org/) provides a Java web archive file (WAR)
for download. This file can either be started directly or used in an existing Java
servlet container or application server. So, first download this WAR file.
4. Next we need to make a source code repository, for this tutorial I will be using GIT as
the repository, visit the official website (https://github.com/users) of GIT and make an
account over there
6. Give name to the repository, and set it to public, for private repository GIT will charge
you but your rep wont be public
7. After creating the repository, GIT will provide you a link of the repository, you will be
using this link in Hudson server
8. After that visit this website http://git-scm.com/downloads and download GIT. I will be
downloading and installing GIT.exe as Im using Windows
9. Now we will be installing GIT and HUDSON plugins on eclipse. For this download
ECLIPSE (www.eclipse.org downloads ) and run it. If you are behind a proxy server
you need to give the address of proxy server in eclipse, for this go to Window -> and
click on Preferences
10. Go to General -> and click on Network Connections, change Active Provide to Native
and provide your proxy server address.
12. Paste these two links to download and install GIT and Hudson plugin
i.
Hudson plugin: https://repository.sonatype.org/content/-repositories/forge sites/m2eclipse-hudson/0.13.0/S/0.13.0.20111015-0033/
ii.
13. After you have installed both plugins, restart Eclipse. Then go to Window tab ->
Show View -> and click on Other
15. You will have Hudson Jobs and Git Repositories at the bottom.
10
17. Go to Network connections, expand it and click on SSH2. Click on Generate DSA
Key to generate Public and Private Key pairs, copy the Public Key. And click on Save
Private Key to save the key.
11
18. Go to GIT, click on Account Settings located on top right corner, from there click on
SSH Keys present on left side, paste the public key generated in eclipse, give a title
to it and click on the Add Key. This Key will provide authentication that valid user is
using the repository. You can add multiple keys, if there are multiple users accessing
the repository.
19. Up till now we have installed GIT and Hudson plugins on eclipse, have generated
and uploaded the key to our GIT source code repository. Now we will create a simple
Hello World project on eclipse and will upload it to our repository.
12
13
14
24. Finally add HELLO WORLD code, and build the project
25. Now to upload this project, right click on the project, go to Team and click on Share
Project
15
27. Click on Create repository, name your repository and click Finish
16
29. Now go to the GIT repository view, right click on Remote and from there click on
Create Remote
17
31. Following window will pop up, click on Change and specify GIT url.
18
19
34. Again go to Team, this time you will have wide variety of options, click on Commit
35. Check the JAVA class you want to upload, type in commit message and click Commit
20
37. If your internet is working, eclipse would upload your source code / class to GIT
21
39. The following figure shows that hello_world_upload class has been uploaded to
my_5th_rep in GIT
22
41. To update the GIT repository some later time with new source code you have to
commit again, for this repeat step 34 to 36.
42. Eclipse and GIT are configured and working. Now lets move to Hudson, for this you
need to type the following command in command prompt java jar Hudso.war
23
44. Go to your web browser and type 127.0.0.1:8080, Hudson page will show, this
indicates that server is working fine.
24
45. First of all you need to configure Hudson that is to install the necessary plugins and
specify path of Java JDK and GIT.exe. For this click on Manage Hudson
25
47. After installing plugins go to Configure System and specify the following paths
48. Now lets create a job, click on New Job, specify the job name, choose build a free
style software job and click Ok.
26
49. GIT have created the HTTPS and SSH link of the repository copy that
27
51. Press the play button, so that job starts building, green icon means build was
successful while red icon means there was a failure.
28
53. Now we will load these jobs from eclipse, for this go to Hudson window, click on the
Add Jobs Icon, specify the Build Server url, and, then click on Load Jobs, all the jobs
will load, select the jobs you want to watch in eclipse and then press Ok.
29