SlideShare a Scribd company logo
JENKINS’ MASTER AND SLAVE
ARCHITECTURE
MASTER AND SLAVE
ARCHITECTURE
INTRODUCTION OF JENKINSFILE
• A continuous delivery pipeline is an automated expression of your process for
getting software from version control right through to your users and
customers.
CREATING A JENKINSFILE
• The current Jenkinsfile has two ways of writing, and pipeline if it is the root,
it is called Declarative Pipeline. In this case, you cannot write the Groovy
script directly, and if you want to write Groovy you script need to use the
directive.
• Pipeline If that does not start from, say Scripted Pipeline, to this case also
write directly Groovy script, node() arrow stage(), such as, can also be
written Pipeline Steps method. Although it seems convenient, degrees of
freedom are too high and tend to be craftsmen code.
JENKINS PIPELINE & COMPONENTS
• What is Jenkins Pipeline?
Jenkins Pipeline (or simply "Pipeline" with a capital "P") is a suite of
plugins which supports implementing and integrating continuous
delivery pipelines into Jenkins.
• Pipeline
A Pipeline is a user-defined model of a CD pipeline. A Pipeline’s code
defines your entire build process, which typically includes stages for
building an application, testing it and then delivering it.
Also, a pipeline block is a key part of Declarative Pipeline syntax.
• Node
A node is a machine which is part of the Jenkins environment and is
capable of executing a Pipeline. Also, a node block is a key part of
CONT….
• Stage
A stage block defines a conceptually distinct subset of tasks
performed through the entire Pipeline (e.g. "Build", "Test" and
"Deploy" stages), which is used by many plugins to visualize or
present Jenkins Pipeline status/progress.
• Step
A single task. Fundamentally, a step tells Jenkins what to do at a
particular point in time (or "step" in the process). For example, to
execute the shell command make use the sh step: sh 'make'.
When a plugin extends the Pipeline DSL, [1] that typically means
JENKINSFILE (DECLARATIVE PIPELINE)
pipeline {
agent any
stages {
stage('Build') {
steps {
echo "We are in Build Stage"
}
}
stage('Test') {
steps {
echo "We are in Test Stage"
}
}
stage('Deploy') {
steps {
echo "We are in Deploy Stage"
}
}
}
}
JENKINSFILE (SCRIPTED PIPELINE)
node {
stage('Build') {
echo “Build stage”
}
stage('Test') {
echo “Test stage”
}
stage('Deploy') {
echo “Deploy stage”
}
}
STRING INTERPOLATION
• Jenkins Pipeline uses rules identical to Groovy for string interpolation.
• While Groovy supports declaring a string with either single quotes, or double quotes
def username = 'Jenkins'
echo 'Hello Mr. ${username}'
echo "I said, Hello Mr. ${username}“
Result:
Hello Mr. Jenkins
I said, Hello Mr Jenkins
USING ENVIRONMENT VARIABLES
• Jenkins Pipeline exposes environment variables via the global variable env, which is available from anywhere within a Jenkinsfile.
• Declarative Pipeline:
pipeline {
agent any
environment {
NAME = 'ricardo'
LASTNAME = 'gonzalez'
}
stages {
stage('Build') {
steps {
sh 'echo $NAME $LASTNAME'
}
}
}
}
PLUGIN INTEGRATION
• Git Setup
Configure Git pulgin on Jenkins
Git is one of the most popular tools for version control system. you can pull code from git
repositories using jenkins if you use github plugin.
Prerequisites:
Jenkins server
Install Git on Jenkins server
yum install git –y
Setup Git on jenkins console
Install git plugin without restart
Manage Jenkins > Jenkins Plugins > available > github
Configure git path
Manage Jenkins > Global Tool Configuration > git
MAVEN INTRODUCTION
• Maven is a powerful project management tool that is based on POM (project
object model). It is used for projects build, dependency and documentation.
• Building a software project typically consists of such tasks as downloading
dependencies, putting additional jars on a class-path, compiling source code
into binary code, running tests, packaging compiled code into deployable
artifacts such as JAR, WAR, and ZIP files, and deploying these artifacts to an
application server or repository.
• Apache Maven automates these tasks, minimizing the risk of humans making
errors while building the software manually and separating the work of
compiling and packaging our code from that of code construction
WHY USE MAVEN?
• Simple project setup that follows best practices: Maven tries to avoid as
much configuration as possible, by supplying project templates.
• Dependency Management: It includes automatic updating, downloading and
validating the compatibility, as well as reporting the dependency closures
• Isolation between project Dependencies and Plugins: With Maven, project
dependencies are retrieved from the dependency repositories while any
plugin's dependencies are retrieved from the plugin repositories, resulting in
fewer conflicts when plugins start to download additional dependencies.
• Central Repository System: Project dependencies can be loaded from the
local file system or public repositories, such as Maven Central
PROJECT OBJECT MODEL(POM)
• The configuration of a Maven project is done via a Project Object Model
(POM), represented by a pom.xml file. The POM describes the project,
manages dependencies, and configures plugins for building the software.
• The POM also defines the relationships among modules of multi-module
projects.
LET'S LOOK AT THE
BASIC STRUCTURE OF
A TYPICAL POM FILE:
PROJECT IDENTIFIERS
• Maven uses a set of identifiers, also called coordinates, to uniquely identify a
project and specify how the project artifact should be packaged:
• groupId – a unique base name of the company or group that created the
project
• artifactId – a unique name of the project
• version – a version of the project
• packaging – a packaging method (e.g. WAR/JAR/ZIP)
The first three of these (groupId:artifactId:version) combine to form the unique
identifier and are the mechanism by which you specify which versions of
external libraries (e.g. JARs) your project will use.
DEPENDENCIES
• These external libraries that a project uses are called dependencies. The
dependency management feature in Maven ensures automatic download of
those libraries from a central repository, so you don't have to store them
locally.
• This is a key feature of Maven and provides the following benefits:
• uses less storage by significantly reducing the number of downloads off
remote repositories
• makes checking out a project quicker
• provides an effective platform for exchanging binary artifacts within your
organization and beyond without the need for building artifact from source
every time
CONT….
• In order to declare a
dependency on an external
library, you need to provide
the groupId, artifactId, and
the version of the library.
Let's take a look at an
example:
REPOSITORIES
• A repository in Maven is used to hold build artifacts and dependencies of
varying types. The default local repository is located in the .m2/repository
folder under the home directory of the user.
• If an artifact or a plug-in is available in the local repository, Maven uses it.
Otherwise, it is downloaded from a central repository and stored in the local
repository. The default central repository is Maven Central.
CONT….
• Some libraries, such as JBoss
server, are not available at the
central repository but are available
at an alternate repository. For those
libraries, you need to provide the
URL to the alternate repository
inside pom.xml file:
PROPERTIES
• Custom properties can help to make your pom.xml file easier to read and
maintain. In the classic use case, you would use custom properties to define
versions for your project's dependencies.
• Maven properties are value-placeholders and are accessible anywhere within
a pom.xml by using the notation ${name}, where name is the property.
• Let's see an example: in next slide
CONT…
• Now if you want to
upgrade Spring to a
newer version, you
only have to change the
value inside
the<spring.version>
property tag and all the
dependencies using that
property in their
<version> tags will be
updated.
BUILD
• The build section is also a
very important section of the
Maven POM. It provides
information about the default
Maven goal, the directory for
the compiled project, and the
final name of the application.
The default build section
looks like this:
• The default output folder for
compiled artifacts is named
target, and the final name of
the packaged artifact consists
of the artifactId and version,
but you can change it at any
time.
USING
PROFILES
• Another important feature
of Maven is its support for
profiles. A profile is
basically a set of
configuration values. By
using profiles, you can
customize the build for
different environments
such as
Production/Test/Develop
ment:
MAVEN BUILD LIFECYCLES
• Every Maven build follows a specified lifecycle. You can execute several
build lifecycle goals, including the ones to compile the project’s code, create
a package, and install the archive file in the local Maven dependency
repository.
LIFECYCLE PHASES
• Validate – checks the correctness of the project
• Compile – compiles the provided source code into binary artifacts
• Test – executes unit tests
• Package – packages compiled code into an archive file
• Integration-test – executes additional tests, which require the packaging
• Verify – checks if the package is valid
• Install – installs the package file into the local Maven repository
• Deploy – deploys the package file to a remote server or repository
CONT…
Maven Setup
Install & configure Maven build tool on Jenkins
Maven is a code build tool which used to convert your code to an artifact. this is a widely used plugin to build in continuous integration
Prerequisites
Jenkins server
Install Maven on Jenkins
1. Download maven packages https://maven.apache.org/download.cgi onto Jenkins server. In this case, I am using /opt/maven as my installation directory
Link : https://maven.apache.org/download.cgi
# Creating maven directory under /opt
mkdir /opt/maven cd /opt/maven
# downloading maven version 3.6.0
Wget http://mirrors.estointernet.in/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
tar -xvzf apache-maven-3.6.1-bin.tar.gz
2. Setup M2_HOME and M2 paths in .bash_profile of the user and add these to the path variable
vi ~/.bash_profile
M2_HOME=/opt/maven/apache-maven-3.6.1
M2=$M2_HOME/bin
PATH=<Existing_PATH>:$M2_HOME:$M2
CHECKPOINT
• logoff and login to check maven version
mvn –version
• So far we have completed the installation of maven software to support maven
plugin on the jenkins console. Let's jump onto Jenkins to complete the remaining
steps.
• Setup maven on Jenkins console:
1. Install maven plugin without restart
• Manage Jenkins > Jenkins Plugins > available > Maven Invoker
• Manage Jenkins > Jenkins Plugins > available > Maven Integration
2. Configure maven path
• Manage Jenkins > Global Tool Configuration > Maven
DEMO

More Related Content

PPTX
Jenkins introduction
PPTX
KEY
Continuous Delivery Using Jenkins
PPTX
PPTX
Jenkins CI
PDF
Jenkins
PPTX
Ci jenkins maven svn
PPTX
Automated Testing Environment by Bugzilla, Testopia and Jenkins
Jenkins introduction
Continuous Delivery Using Jenkins
Jenkins CI
Jenkins
Ci jenkins maven svn
Automated Testing Environment by Bugzilla, Testopia and Jenkins

What's hot (20)

PPT
Jenkins CI
PDF
Yale Jenkins Show and Tell
PDF
Using CI for continuous delivery Part 1
PDF
Anatomy of a Continuous Integration and Delivery (CICD) Pipeline
PPTX
Contineous integration
PDF
Continuous integration / deployment with Jenkins
PPTX
Building the Test Automation Framework - Jenkins for Testers
PDF
Jenkins-CI
PPT
CI and CD with Jenkins
PDF
Continuous delivery with open source tools
PPT
Continuous integration
PPTX
Continuous integration with Jenkins
PPTX
Continuous integration using jenkins
PPTX
JENKINS Training
PPTX
Jenkins Introduction
PPT
Continuous Integration (Jenkins/Hudson)
PDF
Automate your build on Android with Jenkins
PPTX
Supermondays: Jenkins CI lightning talk
PPT
Continuous deployment steve povilaitis
PPTX
Introduction to jenkins
Jenkins CI
Yale Jenkins Show and Tell
Using CI for continuous delivery Part 1
Anatomy of a Continuous Integration and Delivery (CICD) Pipeline
Contineous integration
Continuous integration / deployment with Jenkins
Building the Test Automation Framework - Jenkins for Testers
Jenkins-CI
CI and CD with Jenkins
Continuous delivery with open source tools
Continuous integration
Continuous integration with Jenkins
Continuous integration using jenkins
JENKINS Training
Jenkins Introduction
Continuous Integration (Jenkins/Hudson)
Automate your build on Android with Jenkins
Supermondays: Jenkins CI lightning talk
Continuous deployment steve povilaitis
Introduction to jenkins
Ad

Similar to Jenkins advance topic (20)

PPTX
Jenkins advance topic
PPTX
Maven
PDF
Introduction to maven, its configuration, lifecycle and relationship to JS world
PDF
Java Builds with Maven and Ant
PDF
Apache maven, a software project management tool
PPSX
Maven Presentation - SureFire vs FailSafe
PPTX
Maven Basics - Explained
PDF
PDF
PDF
Mavennotes.pdf
PDF
Build Automation using Maven
PPTX
Introduction to maven
ODP
Maven in Java EE project
PDF
BMO - Intelligent Projects with Maven
PPT
Introduction tomaven
ODP
An Introduction to Maven Part 1
PDF
Practical maven-slides 2
PPTX
Apache Maven
PPTX
Jenkins an opensource CICD platform for all
Jenkins advance topic
Maven
Introduction to maven, its configuration, lifecycle and relationship to JS world
Java Builds with Maven and Ant
Apache maven, a software project management tool
Maven Presentation - SureFire vs FailSafe
Maven Basics - Explained
Mavennotes.pdf
Build Automation using Maven
Introduction to maven
Maven in Java EE project
BMO - Intelligent Projects with Maven
Introduction tomaven
An Introduction to Maven Part 1
Practical maven-slides 2
Apache Maven
Jenkins an opensource CICD platform for all
Ad

More from Gourav Varma (20)

PPTX
Jenkins introduction
PPTX
Docker introduction (1)
PPTX
Aws day 4
PPTX
Aws day 3
PPTX
Aws day 2
PPTX
Ansible day 4
PPTX
Ansible day 3
PPTX
Adnible day 2.ppt
PPTX
Ansible day 1.ppt
PPTX
Version control git day03(amarnath dada)
PPTX
Version control git day02
PPTX
Version control git day01
PPTX
Dev ops
PPTX
Shell programming 2
PPTX
Introduction to linux
PPTX
Final terraform
PPTX
Version control git day03
PPTX
Version control git day02
PPTX
Version control git day01
PPT
Docker swarm
Jenkins introduction
Docker introduction (1)
Aws day 4
Aws day 3
Aws day 2
Ansible day 4
Ansible day 3
Adnible day 2.ppt
Ansible day 1.ppt
Version control git day03(amarnath dada)
Version control git day02
Version control git day01
Dev ops
Shell programming 2
Introduction to linux
Final terraform
Version control git day03
Version control git day02
Version control git day01
Docker swarm

Recently uploaded (20)

PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
additive manufacturing of ss316l using mig welding
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
Welding lecture in detail for understanding
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Sustainable Sites - Green Building Construction
PDF
Arduino robotics embedded978-1-4302-3184-4.pdf
PPTX
UNIT 4 Total Quality Management .pptx
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
PDF
composite construction of structures.pdf
PDF
PPT on Performance Review to get promotions
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Embodied AI: Ushering in the Next Era of Intelligent Systems
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
additive manufacturing of ss316l using mig welding
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Foundation to blockchain - A guide to Blockchain Tech
Lesson 3_Tessellation.pptx finite Mathematics
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Welding lecture in detail for understanding
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Sustainable Sites - Green Building Construction
Arduino robotics embedded978-1-4302-3184-4.pdf
UNIT 4 Total Quality Management .pptx
Model Code of Practice - Construction Work - 21102022 .pdf
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Strings in CPP - Strings in C++ are sequences of characters used to store and...
composite construction of structures.pdf
PPT on Performance Review to get promotions
CH1 Production IntroductoryConcepts.pptx
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx

Jenkins advance topic

  • 1. JENKINS’ MASTER AND SLAVE ARCHITECTURE
  • 3. INTRODUCTION OF JENKINSFILE • A continuous delivery pipeline is an automated expression of your process for getting software from version control right through to your users and customers.
  • 4. CREATING A JENKINSFILE • The current Jenkinsfile has two ways of writing, and pipeline if it is the root, it is called Declarative Pipeline. In this case, you cannot write the Groovy script directly, and if you want to write Groovy you script need to use the directive. • Pipeline If that does not start from, say Scripted Pipeline, to this case also write directly Groovy script, node() arrow stage(), such as, can also be written Pipeline Steps method. Although it seems convenient, degrees of freedom are too high and tend to be craftsmen code.
  • 5. JENKINS PIPELINE & COMPONENTS • What is Jenkins Pipeline? Jenkins Pipeline (or simply "Pipeline" with a capital "P") is a suite of plugins which supports implementing and integrating continuous delivery pipelines into Jenkins. • Pipeline A Pipeline is a user-defined model of a CD pipeline. A Pipeline’s code defines your entire build process, which typically includes stages for building an application, testing it and then delivering it. Also, a pipeline block is a key part of Declarative Pipeline syntax. • Node A node is a machine which is part of the Jenkins environment and is capable of executing a Pipeline. Also, a node block is a key part of
  • 6. CONT…. • Stage A stage block defines a conceptually distinct subset of tasks performed through the entire Pipeline (e.g. "Build", "Test" and "Deploy" stages), which is used by many plugins to visualize or present Jenkins Pipeline status/progress. • Step A single task. Fundamentally, a step tells Jenkins what to do at a particular point in time (or "step" in the process). For example, to execute the shell command make use the sh step: sh 'make'. When a plugin extends the Pipeline DSL, [1] that typically means
  • 7. JENKINSFILE (DECLARATIVE PIPELINE) pipeline { agent any stages { stage('Build') { steps { echo "We are in Build Stage" } } stage('Test') { steps { echo "We are in Test Stage" } } stage('Deploy') { steps { echo "We are in Deploy Stage" } } } }
  • 8. JENKINSFILE (SCRIPTED PIPELINE) node { stage('Build') { echo “Build stage” } stage('Test') { echo “Test stage” } stage('Deploy') { echo “Deploy stage” } }
  • 9. STRING INTERPOLATION • Jenkins Pipeline uses rules identical to Groovy for string interpolation. • While Groovy supports declaring a string with either single quotes, or double quotes def username = 'Jenkins' echo 'Hello Mr. ${username}' echo "I said, Hello Mr. ${username}“ Result: Hello Mr. Jenkins I said, Hello Mr Jenkins
  • 10. USING ENVIRONMENT VARIABLES • Jenkins Pipeline exposes environment variables via the global variable env, which is available from anywhere within a Jenkinsfile. • Declarative Pipeline: pipeline { agent any environment { NAME = 'ricardo' LASTNAME = 'gonzalez' } stages { stage('Build') { steps { sh 'echo $NAME $LASTNAME' } } } }
  • 11. PLUGIN INTEGRATION • Git Setup Configure Git pulgin on Jenkins Git is one of the most popular tools for version control system. you can pull code from git repositories using jenkins if you use github plugin. Prerequisites: Jenkins server Install Git on Jenkins server yum install git –y Setup Git on jenkins console Install git plugin without restart Manage Jenkins > Jenkins Plugins > available > github Configure git path Manage Jenkins > Global Tool Configuration > git
  • 12. MAVEN INTRODUCTION • Maven is a powerful project management tool that is based on POM (project object model). It is used for projects build, dependency and documentation. • Building a software project typically consists of such tasks as downloading dependencies, putting additional jars on a class-path, compiling source code into binary code, running tests, packaging compiled code into deployable artifacts such as JAR, WAR, and ZIP files, and deploying these artifacts to an application server or repository. • Apache Maven automates these tasks, minimizing the risk of humans making errors while building the software manually and separating the work of compiling and packaging our code from that of code construction
  • 13. WHY USE MAVEN? • Simple project setup that follows best practices: Maven tries to avoid as much configuration as possible, by supplying project templates. • Dependency Management: It includes automatic updating, downloading and validating the compatibility, as well as reporting the dependency closures • Isolation between project Dependencies and Plugins: With Maven, project dependencies are retrieved from the dependency repositories while any plugin's dependencies are retrieved from the plugin repositories, resulting in fewer conflicts when plugins start to download additional dependencies. • Central Repository System: Project dependencies can be loaded from the local file system or public repositories, such as Maven Central
  • 14. PROJECT OBJECT MODEL(POM) • The configuration of a Maven project is done via a Project Object Model (POM), represented by a pom.xml file. The POM describes the project, manages dependencies, and configures plugins for building the software. • The POM also defines the relationships among modules of multi-module projects.
  • 15. LET'S LOOK AT THE BASIC STRUCTURE OF A TYPICAL POM FILE:
  • 16. PROJECT IDENTIFIERS • Maven uses a set of identifiers, also called coordinates, to uniquely identify a project and specify how the project artifact should be packaged: • groupId – a unique base name of the company or group that created the project • artifactId – a unique name of the project • version – a version of the project • packaging – a packaging method (e.g. WAR/JAR/ZIP) The first three of these (groupId:artifactId:version) combine to form the unique identifier and are the mechanism by which you specify which versions of external libraries (e.g. JARs) your project will use.
  • 17. DEPENDENCIES • These external libraries that a project uses are called dependencies. The dependency management feature in Maven ensures automatic download of those libraries from a central repository, so you don't have to store them locally. • This is a key feature of Maven and provides the following benefits: • uses less storage by significantly reducing the number of downloads off remote repositories • makes checking out a project quicker • provides an effective platform for exchanging binary artifacts within your organization and beyond without the need for building artifact from source every time
  • 18. CONT…. • In order to declare a dependency on an external library, you need to provide the groupId, artifactId, and the version of the library. Let's take a look at an example:
  • 19. REPOSITORIES • A repository in Maven is used to hold build artifacts and dependencies of varying types. The default local repository is located in the .m2/repository folder under the home directory of the user. • If an artifact or a plug-in is available in the local repository, Maven uses it. Otherwise, it is downloaded from a central repository and stored in the local repository. The default central repository is Maven Central.
  • 20. CONT…. • Some libraries, such as JBoss server, are not available at the central repository but are available at an alternate repository. For those libraries, you need to provide the URL to the alternate repository inside pom.xml file:
  • 21. PROPERTIES • Custom properties can help to make your pom.xml file easier to read and maintain. In the classic use case, you would use custom properties to define versions for your project's dependencies. • Maven properties are value-placeholders and are accessible anywhere within a pom.xml by using the notation ${name}, where name is the property. • Let's see an example: in next slide
  • 22. CONT… • Now if you want to upgrade Spring to a newer version, you only have to change the value inside the<spring.version> property tag and all the dependencies using that property in their <version> tags will be updated.
  • 23. BUILD • The build section is also a very important section of the Maven POM. It provides information about the default Maven goal, the directory for the compiled project, and the final name of the application. The default build section looks like this: • The default output folder for compiled artifacts is named target, and the final name of the packaged artifact consists of the artifactId and version, but you can change it at any time.
  • 24. USING PROFILES • Another important feature of Maven is its support for profiles. A profile is basically a set of configuration values. By using profiles, you can customize the build for different environments such as Production/Test/Develop ment:
  • 25. MAVEN BUILD LIFECYCLES • Every Maven build follows a specified lifecycle. You can execute several build lifecycle goals, including the ones to compile the project’s code, create a package, and install the archive file in the local Maven dependency repository.
  • 26. LIFECYCLE PHASES • Validate – checks the correctness of the project • Compile – compiles the provided source code into binary artifacts • Test – executes unit tests • Package – packages compiled code into an archive file • Integration-test – executes additional tests, which require the packaging • Verify – checks if the package is valid • Install – installs the package file into the local Maven repository • Deploy – deploys the package file to a remote server or repository
  • 27. CONT… Maven Setup Install & configure Maven build tool on Jenkins Maven is a code build tool which used to convert your code to an artifact. this is a widely used plugin to build in continuous integration Prerequisites Jenkins server Install Maven on Jenkins 1. Download maven packages https://maven.apache.org/download.cgi onto Jenkins server. In this case, I am using /opt/maven as my installation directory Link : https://maven.apache.org/download.cgi # Creating maven directory under /opt mkdir /opt/maven cd /opt/maven # downloading maven version 3.6.0 Wget http://mirrors.estointernet.in/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz tar -xvzf apache-maven-3.6.1-bin.tar.gz 2. Setup M2_HOME and M2 paths in .bash_profile of the user and add these to the path variable vi ~/.bash_profile M2_HOME=/opt/maven/apache-maven-3.6.1 M2=$M2_HOME/bin PATH=<Existing_PATH>:$M2_HOME:$M2
  • 28. CHECKPOINT • logoff and login to check maven version mvn –version • So far we have completed the installation of maven software to support maven plugin on the jenkins console. Let's jump onto Jenkins to complete the remaining steps. • Setup maven on Jenkins console: 1. Install maven plugin without restart • Manage Jenkins > Jenkins Plugins > available > Maven Invoker • Manage Jenkins > Jenkins Plugins > available > Maven Integration 2. Configure maven path • Manage Jenkins > Global Tool Configuration > Maven
  • 29. DEMO