在jenkins中运行管道shell脚本时出错

时间:2020-10-22 08:52:04

标签: shell maven jenkins github

pipeline {

    agent any

    tools{
        maven "maven"
    }

    stages{

        stage('git scm'){

            steps{
                git changelog: false, poll: false, url:'https://github.com/saikishore789/SampleMaven.git'
            }
        }
    
            stage('build'){
                steps{
                    
                sh "mvn package"
            }
            }
    }
}

运行此脚本后,构建失败并显示此错误:

Cannot run program "nohup" (in directory "C:\WINDOWS\system32\config\systemprofile\AppData\Local\Jenkins.jenkins\workspace\Pipeline-project1"): CreateProcess error=2, The system cannot find the file specified

1 个答案:

答案 0 :(得分:0)

我假设您有一个Windows节点,请尝试使用此步骤bat代替sh


stage('build'){
                steps{
                    
                bat "mvn package"
                 }
             }