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:

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 Available tab
  • In the Filter text field enter ‘github’
  • Select GitHub Plugin and click Download now and install after restart button. 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 JDK section click Add JDK button, uncheck Install automatically checkbox and enter Name and JAVA_HOME values
  • Int the Git section click Git Installations... button and enter Name and Path to Git executable values

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 Maven section click Add Maven button, uncheck Install automatically checkbox and enter Name and MAVEN_HOME
  • Click Apply and then Save

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 project option, enter Job name value and click OK
  • In the Source Code Management section select Git option
  • Enter Repository URL – for this test let’s use https://github.com/username/repo.git
  • Click Advanced button
  • Click Advanced button – this is the other button that displays after the first click 🙂
  • Check Skip internal tag checkbox

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 Build section select Invoke top-level Maven targets
  • Enter compile in the Goals field
  • Click Advanced... button
  • Enter HighScoresServiceClient\pom.xml in the POM field

You need to tell Jenkins where to find pom.xml file when looking from the root of the project.

  • Click Apply and then Save
  • On the next screen click Build Now button
  • In the Build History section a new build has appeared
  • Move your mouse over it and select Console Output item – 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.