English 中文(简体)
why jenkins showing git, maven not found error even git and maven installed?
原标题:

`hi there,hope you are doing well. I am new to Jenkins, and errors are encountered during practice. i took a sample project. error and jenkins file content posted below please have a look into it. feel free to ask if you have any questions. please suggest solution.

Thank you for your support and help.`

Error as below

Started by user admin
Obtained Jenkins-decnew from git https://github.com/kdhani/myweb-p1.git
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/pipeline1
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
**Selected Git installation does not exist. Using Default
**The recommended git tool is: NONE
using credential gitid
 > /usr/bin/git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/pipeline1/.git # timeout=10
Fetching changes from the remote Git repository
 > /usr/bin/git config remote.origin.url https://github.com/kdhani/myweb-p1.git # timeout=10
Fetching upstream changes from https://github.com/kdhani/myweb-p1.git
 > /usr/bin/git --version # timeout=10
 > git --version #  git version 2.40.1 
using GIT_ASKPASS to set credentials 
 > /usr/bin/git fetch --tags --force --progress -- https://github.com/kdhani/myweb-p1.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 > /usr/bin/git rev-parse refs/remotes/origin/master^{commit} # timeout=10
Checking out Revision c8f4db412eaf023b2ae78c1a9e168db17ea6ac73 (refs/remotes/origin/master)
 > /usr/bin/git config core.sparsecheckout # timeout=10
 > /usr/bin/git checkout -f c8f4db412eaf023b2ae78c1a9e168db17ea6ac73 # timeout=10
Commit message: "Update Jenkins-decnew"
 > /usr/bin/git rev-list --no-walk c8f4db412eaf023b2ae78c1a9e168db17ea6ac73 # timeout=10
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Git Checkout)
[Pipeline] git
Selected Git installation does not exist. Using Default
The recommended git tool is: NONE
using credential gitid
 > /usr/bin/git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/pipeline1/.git # timeout=10
Fetching changes from the remote Git repository
 > /usr/bin/git config remote.origin.url https://github.com/kdhani/myweb-p1.git # timeout=10
Fetching upstream changes from https://github.com/kdhani/myweb-p1.git
 > /usr/bin/git --version # timeout=10
 > git --version #  git version 2.40.1 
using GIT_ASKPASS to set credentials 
 > /usr/bin/git fetch --tags --force --progress -- https://github.com/kdhani/myweb-p1.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 > /usr/bin/git rev-parse refs/remotes/origin/master^{commit} # timeout=10
Checking out Revision c8f4db412eaf023b2ae78c1a9e168db17ea6ac73 (refs/remotes/origin/master)
 > /usr/bin/git config core.sparsecheckout # timeout=10
 > /usr/bin/git checkout -f c8f4db412eaf023b2ae78c1a9e168db17ea6ac73 # timeout=10
 > /usr/bin/git branch -a -v --no-abbrev # timeout=10
 > /usr/bin/git branch -D master # timeout=10
 > /usr/bin/git checkout -b master c8f4db412eaf023b2ae78c1a9e168db17ea6ac73 # timeout=10
Commit message: "Update Jenkins-decnew"
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Maven Build)
[Pipeline] sh
**+ mvn clean package
**/var/lib/jenkins/workspace/pipeline1@tmp/durable-7e042d4d/script.sh: line 1: **mvn: command not found**
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (deploy-dev)
Stage "deploy-dev" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 127
Finished: FAILURE
REST API
Jenkins 2.401.1

jenkins file content from here :)

pipeline{

    agent any
    
    environment{
        PATH = "/opt/maven3/bin:$PATH"
    }
    stages{
        stage("Git Checkout"){
            steps{
                git credentialsId:  gitid , url:  https://github.com/kdhani/myweb-p1.git 
            }
        }
        stage("Maven Build"){
            steps{
                sh "mvn clean package"
                sh "mv target/*.war target/myweb.war"
            }
        }
        stage("deploy-dev"){
            steps{
                sshagent([ tomcat-new ]) {
                    
                sh """
                    scp -o StrictHostKeyChecking=no target/myweb.war  ec2-user@172.31.33.108:/home/ec2-user/apache-tomcat-9.0.63/webapps/
                    
                    ssh ec2-user@172.31.33.108 /home/ec2-user/apache-tomcat-9.0.63/bin/shutdown.sh
                    
                    ssh ec2-user@172.31.33.108 /home/ec2-user/apache-tomcat-9.0.63/bin/startup.sh
                
                """
            }
            
            }
        }
    }
}

问题回答

暂无回答




相关问题
Tomcat´s server.xml dynamic configuration

My web application uses the same database configuration as the application XYZ. I have a resource declaration for a context in server.xml, so I have a duplicated configuration (once for web ...

session transfer issue from Tomcat to ASP.Net

I am using Tomcat to host JSP and using IIS 7.0 to host aspx (C# + .Net 3.5 + VSTS 2008), and I have some session transfer issue from JSP page to ASPX page. JSP page is in one domain and all other ...

JSP exception - class not found (tomcat)

I m setting up an existing application on a new Tomcat 5.5 server connecting to a Postgres database (running on Debian Lenny). When I access it I get a series of stack traces with the following root ...

热门标签