I want to send my Cucumber reports to Slack using Jenkins Declarative Pipeline. I have installed Cucumber+Slack+Notifier+Plugin.
With this code,
pipeline {
agent any
tools {
maven 'M2'
jdk 'JDK'
nodejs 'NODEJS'
//cucumberSendSlack 'cucumberSendSlack'
}
stages {
stage('Start') {
steps {
bat 'mvn -v'
cucumberSendSlack channel: 'slack-room-cicd', json: '$WORKSPACE/reports.json'
}
}
}
post {
always {
echo "Post Build"
}
}
}
It gives an error,
No such DSL method 'cucumberSendSlack' found among steps
But I have installed the plugin and I was able to send the cucumber report using a Freestyle project
.
Any idea of how to use the plugin in Declarative Pipeline?
*********** edit ***********
[Pipeline] {
[Pipeline] bat
Z:\Jenkins3\workspace\cucumbver>mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T22:11:47+05:30)
Maven home: C:\tools\apache-maven-3.3.9
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_151\jre
Default locale: en_IN, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"
[Pipeline] cucumberSlackSend
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage`