0
votes

I checked a few articles and made changes but still facing the issue

/home/jenkins/workspace/pps_pexip-policy-server_PR-108@tmp/durable-5e322754/script.sh: line 1: mvn: not found script returned exit code 127

This is the previous question I checked

Jenkins pipeline mvn: command not found

1
Clearly Jenkins cannot find maven. Something in your config or system path is not set up correctly. Please post more info to clarify. - Wiszh

1 Answers

0
votes

First you need to install maven plugin. Second: add maven tool to jenkins config in 'Manage Jenkins' -> Global tools config. Insert 'tool' section into pipeline:

pipeline {
    agent any
    tools { 
        maven 'Maven 3.3.9' 
    }
    stages {
        stage ('Initialize') {
            steps {
                sh '''
                    echo "PATH = ${PATH}"
                    echo "M2_HOME = ${M2_HOME}"
                ''' 
            }
        }
    }
}

Look an article here