Maven based application in declarative pipeline

Step 1 – Now let us look at how to build a sample Jenkins pipeline project whit a basic Groovy script.
Click on “New item” on Jenkins home page

And then give a name for the project and then click on pipeline (project type) and then click OK.

Step 2 – Once by clicking ok the page will be directed to another page where you can customize your pipeline project. You can also enable the necessary addons such as enabling git where you can give your URL of the project stored in the git repository as we did for the Maven project.


Step 3 – Once finished with the above topics, now you can write a groovy script where you can segregate the project into different stages such as the Build stage, Testing stage, and Deploying stage. 
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building..'
}
}
stage('Test') {
steps {
echo 'Testing..'
}
}
stage('Deploy') {
steps {
echo 'Deploying....'
}
       }
    }
}

Through this script, we can define the necessary adding in each stage

Step 4 – Once finished with the pipeline scripts (Groovy Scripts), Click “Apply” the changes you made will be saved. And then click “Save”.


Step 5 – After saving, click on the Build now option the build the pipeline project, it will be segregated into different stages

Step 6 – After the build process laid successful, you can directly view the console output to witness how the process got build with different stages and their dependencies, locations where the files are being accessed, etc.

Recent Comments

No comments

Leave a Comment