This tutorial shows you how to use Jenkins to orchestrate building a simple Java
application with https://maven.apache.org/[Maven].
If you are a Java developer who uses Maven and who is new to CI/CD concepts, or
you might be familiar with these concepts but don't know how to implement
building your application using Jenkins, then this tutorial is for you.
The simple Java application (which you'll obtain from a sample repository on
GitHub) outputs the string "Hello world!" and is accompanied by a couple of unit
tests to check that the main application works as expected. The results of these
tests are saved to a JUnit XML report.
You can stop this tutorial at any point in time and continue from where you left
If you've already run though link:..[another tutorial], you can skip the
<> and <> sections below and proceed on to <>. (Just ensure you have
link:https://git-scm.com/downloads[Git] installed locally.) If you need to
restart Jenkins, simply follow the restart instructions in
<> and then
** link:https://git-scm.com/downloads[Git] and optionally
=== Fork and clone the sample repository on GitHub
Obtain the simple "Hello world!" Java application from GitHub, by forking the
sample repository of the application's source code into your own GitHub account
and then cloning this fork locally.
. Ensure you are signed in to your GitHub account. If you don't yet have a
GitHub account, sign up for a free one on the https://github.com/[GitHub
. Fork the
on GitHub into your local GitHub account. If you need help with this process,
refer to the https://help.github.com/articles/fork-a-repo/[Fork A Repo]
documentation on the GitHub website for more information.
. Clone your forked
simple-java-maven-app repository (on GitHub) locally to
your machine. To begin this process, do either of the following (where
<your-username> is the name of your user account on your operating system):
If you have the GitHub Desktop app installed on your machine:
.. In GitHub, click the green Clone or download button on your forked
repository, then Open in Desktop.
.. In GitHub Desktop, before clicking Clone on the Clone a Repository dialog
box, ensure Local Path for:
* macOS is
.. Open up a terminal/command line prompt and
cd to the appropriate directory
* macOS -
C:\Users\<your-username>\Documents\GitHub\ (although use a Git
bash command line window as opposed to the usual Microsoft command prompt)
.. Run the following command to continue/complete cloning your forked repo: +
git clone https://github.com/YOUR-GITHUB-ACCOUNT-NAME/simple-java-maven-app +
YOUR-GITHUB-ACCOUNT-NAME is the name of your GitHub account.