Managed Services, Uncategorized

Enable CI/CD feature in GitLab For Maven Build

This guide will walk through for enabling CI/CD Process in GitLab. GitLab CI/CD had many features like multi-language builds, Parallel builds, versioned tests, pipelines, auto-scaling, build artifacts, testing, Docker.

Following are the steps to configure CI/CD process in GitLab for Maven Build.


  1. JDK 1.8 +
  2. Maven 3.5.0 +
  3. GitLab Runner

Note: All these installations have done in RedHat 7.5 in the single server.


  1. Install Java 8 and Maven in GitLab server.
  2. To install GitLab Runner in GitLab Server for RedHat 7.5 run the following commands

                  # curl -L | sudo bash

                 # sudo yum install gitlab-runner

  1. GitLab runner will create user with /home/gitlab-runner. All the builds will be in this directory.
  2. Next, need to configure runner for the project there are three runners

                 Shared Runner: These are used for Multiple Projects with Similar requirements.

                  Specific Runner: These are for Individual Jobs.

                  Group Runner: These are for multiple projects which is under one group.

In our case, we will use Specific Runner for these

  1. Go to Project > Settings> CI/CD Settings > Runner Settings . Copy the Token as shown in the screenshot.
  2. Next login to the GIT Server from Putty and run following commands

#  gitlab-runner register

Need to give following information to register the runner

Please enter the gitlab-ci coordinator URL (e.g. <Enter GitLab Server URL>

Please enter the gitlab-ci token for this runner: <Enter the token from above step>

Please enter the gitlab-ci description for this runner: < Description of the runner >

Please enter the gitlab-ci tags for this runner (comma separated): <Give tag for the runner>

Whether to lock the Runner to the current project [true/false]: true

Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, VirtualBox, docker-ssh, shell: shell

  1. After updating the details go to Project > CI/CD > Jobs this will show you the CI Jobs.
  2. Create .gitlab-ci.yml in Project Root directory with the following content and commit.

                          image: maven:latest



                              – .m2/repository/

                                – target/


                        stage: build


                   – mvn clean install

Whenever any developer commits the build Build will be triggered automatically.


About The Author

Leave a Reply