Jenkins管道上的电子邮件插件

Jenkins管道上的电子邮件插件,jenkins,jenkins-pipeline,jenkins-plugins,Jenkins,Jenkins Pipeline,Jenkins Plugins,我为Jenkins(2.176.3)安装了电子邮件扩展插件(2.66),以便在管道中使用,我正在尝试以下示例: 但我有以下错误: 执行always post条件时出错: java.lang.NoSuchMethodError:在步骤[VersionNumber、acceptGitLabMR、addGitLabMRComment、archive、bat、build、catchError、checkout、deleteDir、dir、dockerFingerprintFrom、dockerFing

我为Jenkins(2.176.3)安装了电子邮件扩展插件(2.66),以便在管道中使用,我正在尝试以下示例:

但我有以下错误:

执行always post条件时出错: java.lang.NoSuchMethodError:在步骤[VersionNumber、acceptGitLabMR、addGitLabMRComment、archive、bat、build、catchError、checkout、deleteDir、dir、dockerFingerprintFrom、dockerFingerprintRun、echo、envVarsForTool、error、fileExists、FindFile、getContext,…]中未找到此类DSL方法“emailext”


此外,我无法配置插件本身,也不知道如何激活它,我重新启动了Jenkins,系统无法工作,管道语法编辑器无法识别插件,有什么建议吗?

出于某种原因,我的Jenkins服务器在plugins文件夹中有一个文件:email-ext.jpi.已禁用并删除该文件,管道语法编辑器开始识别插件本身…我不再有“没有这样的DSL方法emailext”的消息了

以Marat为例进行测试

pipeline {
    environment {
        //This variable need be tested as string
        doError = '1'
    }

    agent any

    stages {
        stage('Error') {
            when {
                expression { doError == '1' }
            }
            steps {
                echo "Failure"
                error "failure test. It's work"
            }
        }

        stage('Success') {
            when {
                expression { doError == '0' }
            }
            steps {
                echo "ok"
            }
        }
    }
    post {
        always {
            echo 'I will always say Hello again!'

            emailext body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}",
                recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']],
                subject: "Jenkins Build ${currentBuild.currentResult}: Job ${env.JOB_NAME}"

        }
    }
}