In this tutorial we are going to describe Jenkins installation and configuration with Maven and GitHub. We are going to use a Tomcat Application Server 7. If you don’t have Tomcat installed please get one here. You will need a Java 7+ SDK installed as well
Git binaries installation
At first we need client tool using which git operations like cloning, fetching, pooling can be done. We have chosen git client implementation available at git-scm.com. Download and install it. Important thing is to select Run Git from the Windows Command Prompt option on Adjusting your PATH environment installation screen so that git client executables are added to your PATH variable.
Jenkins installation
Now we are going to install Jenkins. Jenkins is a web application that is being distributed as a WAR archive. Follow this few steps:
- Start Tomcat
- Navigate to jenkins-ci.org and download latest Java Web Archive.
- Copy jenkins.wartowebappsdirectory of your Tomcat installation
- Jenkins is available at http://localhost:8080/jenkins
Jenkins GitHub Plugin Installation
In order to build projects that are hosted on a GitHub repository our Jenkins installation has to have GitHub Plugin installed. Follow this steps:
- Navigate to http://localhost:8080/jenkins
- Click Manage Jenkins
- Click Manage Plugins
- Click the Availabletab
- In the Filtertext field enter ‘github’
- Select GitHub Pluginand clickDownload now and install after restartbutton. Appropriate plugins are being installed
- After installation finishes restart Tomcat
Jenkins Maven, Ant and Git configuration
Now we are going to configure Jenkins to use Maven, Ant and a Git client local installations. The steps are:
- Navigate to http://localhost:8080/jenkins
- Click Manage Jenkins
- Click Configure System
- In the JDKsection clickAdd JDKbutton, uncheckInstall automaticallycheckbox and enterNameandJAVA_HOMEvalues
- Int the Gitsection clickGit Installations...button and enterNameandPath to Git executablevalues
since we have pointed that git client binaries needs to be added to the PATH variable during Git client installation, just enter git client program name – git.exe
- In the Mavensection clickAdd Mavenbutton, uncheckInstall automaticallycheckbox and enterNameandMAVEN_HOME
- Click Applyand thenSave
Testing – Building public repository hosted on GitHub
Now let’s test our configuration. We are going to build one of our project hosted on GitHub. This projects uses maven. It can be found at https://github.com/username/repo.git. Here are the steps:
- Navigate to http://localhost:8080/jenkins
- Click Click New Job
- Select Build a free-style software projectoption, enterJob namevalue and clickOK
- In the Source Code Managementsection selectGitoption
- Enter Repository URL– for this test let’s usehttps://github.com/username/repo.git
- Click Advancedbutton
- Click Advancedbutton – this is the other button that displays after the first click 🙂
- Check Skip internal tagcheckbox
This will tell Jenkins to clone the repository. If not checked Jenkins would create a separate tag for each build in the repository.
- In the Buildsection selectInvoke top-level Maven targets
- Enter compilein theGoalsfield
- Click Advanced...button
- Enter HighScoresServiceClient\pom.xmlin thePOMfield
You need to tell Jenkins where to find pom.xml file when looking from the root of the project.
- Click Applyand thenSave
- On the next screen click Build Nowbutton
- In the Build Historysection a new build has appeared
- Move your mouse over it and select Console Outputitem – you can see how project is being cloned and build.
Our Jenkins installation and configuration with Maven, Ant and GitHub works.
The Disqus comment system is loading ...
If the message does not appear, please check your Disqus configuration.