1. Create a Project Pipelinejob of Project Type Pipeline 2. In the Groovy sandbox write following script and execute the code pipeline {...
1. Create a Project Pipelinejob of Project Type Pipeline
2. In the Groovy sandbox write following script and execute the code
- pipeline {
- agent any
- tools {
- // Install the Maven version configured as "M3" and add it to the path.
- maven "mvn1"
- }
- stages {
- stage('Build') {
- steps {
- // Get some code from a GitHub repository
- git 'https://github.com/onlineTrainingguy/jenkinscicd.git'
- // Run Maven on a Unix agent.
- sh "mvn clean package"
- // To run Maven on a Windows agent, use
- // bat "mvn -Dmaven.test.failure.ignore=true clean package"
- }
- }
- }
- }
3. save and Build the script
4. For Jenkinsfile, Create a Jenkins file in the Github repo (use this reference for jenkins file https://github.com/onlineTrainingguy/jenkinscicd.git)
5. Select Git in the pipeline project and Build the job.
COMMENTS