#4: Build Java Project using Maven in Jenkins Pipeline | Jenkinsfile for Maven Build | Jenkins CI/CD

preview_player
Показать описание
In this Video we are going to cover How to Build Java Project Using Maven in Jenkins Pipeline, creating Jenkinsfile for Maven Build , Jenkins Pipeline to Build Java Project using Maven.
#jenkinspipeline #jenkinsfileformavenbuild #buildjavaprojectusingmaven

0:00 Introduction, What is Jenkins Pipeline, What is Jenkinsfile
1:38 Install Maven Integration, pipeline maven integration and pipeline utility steps plugin in jenkins
2:32 Overview of Maven GitHub Project
3:26 Create Pipeline Job In Jenkins, integrate github repo and add build triggers in Jenkins
4:25 Create Jenkinsfile declarative script to build java project using maven
12:49 Build Java Project using Maven in Jenkins Pipeline

Our GitHub Repo of java project with Jenkinsfile

Follow this article for step by step guide with screenshots

Jenkinsfile to build maven project

pipeline {
agent any

tools {
maven "maven"
jdk "jdk11"
}

stages {
stage('Initialize'){
steps{
echo "PATH = ${M2_HOME}/bin:${PATH}"
echo "M2_HOME = /opt/maven"
}
}
stage('Build') {
steps {
dir("/var/lib/jenkins/workspace/New_demo/my-app") {
sh 'mvn -B -DskipTests clean package'
}

}
}
}
post {
always {
junit(
allowEmptyResults: true,
testResults: '*/test-reports/.xml'
)
}
}
}

Related Videos
How to Build Java Project using Maven in Jenkins | Build a Maven Project using Jenkins

If you likes our video, please subscribe our channel on YouTube,
Рекомендации по теме
Комментарии
Автор

Thank you!!!! Thanks to your lessons, I succeeded for the first time.

iffjtbf
Автор

Thanks for the detailed explanation. ❤ 👍

shankarraj
Автор

sh 'mvn clean package'
Is not working while testing its failing showing following error

Shell Script Cannot run program "nohup" (in directory new Demo Pipeline"): CreateProcess error=2, The system cannot find the file specified

Can you please help me on that (I am working on Windows 10 OS)

ankushkuralkar
Автор

Does the server need maven installed or are the plug ins enough?

MarkRoberts_
Автор

As i followed ur lecture and when i add maven command i got an error
sh 'mvn clean package'
after adding path to it build get successed

harishbabu
Автор

Not helpful at all wasted time, even the documentation is diff. "sh 'mvn clean package'" build is not successful after this stage

himanshusharma