Jenkins installation and configuration with Maven, Ant and GitHub

In this tutorial we are going to describe Jenkins installation and configuration with Maven, Ant and GitHub. We are going to use a Tomcat Application Server 7. If you don’t have Tomcat installed please refer to our earlier tutorial Eclipse Tomcat 7 Setup where you will find simple steps to accomplish Tomcat installation. You will need a Java 6+ SDK installed as well.
This tutorial is divided into sections:
- Git binaries installation
- Jenkins installation
- Jenkins GitHub plugin installation
- Jenkins Maven, Ant and Git configuration
- Testing – Building public repository hosted on GitHub

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 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 Ant section click Add Ant button, uncheck Install automatically checkbox and enter Name and ANT_HOME
  • 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 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
  • 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.

14 Responses to "Jenkins installation and configuration with Maven, Ant and GitHub"

  1. arun says:

    Hi need a help from u girls … i did all those steps but jankins cant fetch the datas from git

  2. satish says:

    Hi, i did all steps, got this error.
    Started by user anonymous
    Building in workspace C:\Users\satishp\.jenkins\workspace\buildtest
    Cloning the remote Git repository
    Cloning repository
    Fetching upstream changes from
    ERROR: Error cloning remote repo ‘origin’
    hudson.plugins.git.GitException: Command “git fetch –tags –progress +refs/heads/*:refs/remotes/origin/*” returned status code 128:
    stderr: error: Connection time-out while accessing
    fatal: HTTP request failed

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$200(
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(
    at hudson.plugins.git.GitSCM.retrieveChanges(
    at hudson.plugins.git.GitSCM.checkout(
    at hudson.model.AbstractProject.checkout(
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(
    at jenkins.scm.SCMCheckoutStrategy.checkout(
    at hudson.model.AbstractBuild$
    at hudson.model.Run.execute(
    at hudson.model.ResourceController.execute(
    ERROR: null
    Finished: FAILURE

  3. subbareddy says:

    i want to be joining with you guys

  4. kriti says:

    I have already installed jdk, configured java_home and installed maven and jenkins in my system
    Now i want to change jdk and maven configurations however if i go to jenkins -> Manage Jenkins ->configure system then i am not able to see jdk and maven options.

    Is there something that i need to enable in jenkins dashboard to see this configuration
    I have an AWS EC2 instance and installed jenkins there.
    is tomcat installation required?

    can you tell me the prerequisite for jenkins.

    Kriti Singh

  5. Anil says:

    Nice Video.. Thanks for providing …I would like to build tomcat application and jenkins Since my tomcat application is different server and jenkins is different server. Can you guys provide any document for this.

  6. Pisey says:

    Started by user user
    Building in workspace /var/lib/jenkins/workspace/test002
    Unpacking to /var/lib/jenkins/tools/hudson.tasks.Ant_AntInstallation/Ant_1.7.1 on Jenkins
    [test002] $ /var/lib/jenkins/tools/hudson.tasks.Ant_AntInstallation/Ant_1.7.1/bin/ant compile
    Buildfile: /jenkins/workspace/test002/build.xml

    /jenkins/workspace/test002/build.xml:2: Unexpected element “{}build” {}build

    Total time: 0 seconds
    Build step ‘Invoke Ant’ marked build as failure
    Finished: FAILURE

  7. uday kiran reddy says:

    I tried each and every step mentioned in your video.But when I am trying to add the GItHUb project, I am getting the below error the Git source code management repo add section of New Job.

    Failed to connect to repository : Command “git.exe ls-remote -h HEAD” returned status code 128:
    stderr: fatal: unable to access ‘’: Couldn’t resolve host ‘’

    Please suggest how to resolve this.

  8. Mahesh Kulkarni says:

    Hello ,
    Nice video.
    I am facing issue with eclipse server.I add server to edit but how to run that server from eclipse(Prevoius video tomcat server setup) as well as from command promt because when i used command then another cmd is open & closed.
    Same for tail command.
    Then when i open jenkins localhost:8080 in available tab github is not shown for downloading.
    Please help me out for this.
    Thanks in advance.

  9. Dhamu says:

    do we need to install ANT and MAVEN seperately for building jobs using Jenkins?

  10. devops online training says:

    Nice Article. In short description good explanation about the DevOps. Thanks For sharing the informative news.

  11. Sunil says:

    How to integrate external maven/intellij idea to jenkin.

  12. Maya says:

    Hi Girls,

    I want to join the community for the DevOps practice tutorials.

    Please add me in your community.



Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>