Reputation: 41
Hello i am trying to create a pipeline but when launch it it ends with success but without executing any stage !
pipeline {
agent any
stage('Build') {
steps{
dir('C:/Users/user/Downloads/devopss-main/devopss-main') {
bat 'mvn clean install'
}}
}
stage("Sonar") {
steps {
dir('C:/Users/user/Downloads/devopss-main/devopss-main') {
bat 'mvn sonar:sonar'
}}
}
}
Upvotes: 2
Views: 3821
Reputation: 3834
First make sure you have the Declarative : Pipeline plugin installed.
After installation you need to modify your script. When you write your pipeline declaratively as opposed to imperatively ( colloquially referred to as a scripted pipeline ) you need to all wrap stage
's in a stages
block.
However, your pipeline does not even work in Jenkins 2.x. The pipeline will throw an error as it's currently configured so I'm not sure how your pipeline even finished successfully. With these modifications your pipeline will work
pipeline {
agent any
stages {
stage('Build') {
steps{
dir('C:/Users/user/Downloads/devopss-main/devopss-main') {
bat 'mvn clean install'
}
}
}
stage("Sonar") {
steps {
dir('C:/Users/user/Downloads/devopss-main/devopss-main') {
bat 'mvn sonar:sonar'
}
}
}
}
}
Upvotes: 7