Building from SCM

1.25 hours
  • 2 Learning Objectives

About this Hands-on Lab

In this lab we configure Maven to perform a build. This includes pulling the source code for the build from SCM. At the end of the build process, we also create an artifact for the build.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Update Jenkins plugins and Configure Maven Installer

Navigate to the public IP address and specify port 8080.

Update Jenkins plugins

  1. Click the bell icon.
  2. Apply Migration.
  3. Click the bell icon.
  4. Choose Manage Jenkins.
  5. Choose Go to plugin manager.
  6. Select all, Download now and install after restart
  7. Wait to checkmark the "Restart Jenkins when installation is complete and no jobs are running" until all items have been marked for an action.
  8. Reconnect to Jenkins.

Navigate to Manage Jenkins and then Global Tool Configuration. Scroll down to Maven installations and add a new one.

The Maven installation should be named "M3".

Create a new Maven installation and set it to install automatically.

Configure the Build to Use Maven and Make the Index File

Create a new Freestlye Project called "mavenproject".

Update the source code management to use the Git repository provided in the lab instructions.

Add and configure a build step for top-level Maven components.

Configure M3 as the Maven server and set the Goals to "clean package".

Configure a build step to run the following go command:

bin/makeindex

Add a post-build step to archive the artifacts.

Fingerprint all archived artifacts and set the file to index.jsp.

Run the build and verify that the index.jsp is in the root of the directory.

Additional Resources

Your company is ready to start utilizing the Jenkins server that you installed. The first project that they would like to convert to run on Jenkins is a Maven project from your company's M3 Maven server. This is to replace that server, but projects built there have the instance name hardcoded.

You are to create a project named "mavenproject". This should pull the code from the git repo and build the project. This should include the call to the binary that creates the index.jsp file:

go build bin/makeindex 

The index.jsp file needs to be tracked for version control purposes.

The Jenkins login information is as follows:

  • User: student
  • Password: OmgPassword!

The URI of the git repository for this lesson is https://github.com/linuxacademy/content-cje-prebuild.git

Note: Please allow 3 minutes before starting this lab to make sure it is fully provisioned before starting.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?