Blog

How to integrate Maven Project from Bitbucket to Continuous Integration Jenkins

How to integrate Maven Project from Bitbucket to Continuous Integration Jenkins

First, let’s understand what Continuous integration is. It’s a process which allows you to identify errors in the starting. All development work is integrated as early as possible and artifacts are created and tested automatically.

Now, what is Bitbucket?

Bitbucket is the most commonly used tool for version control system, the whole team can add and commit the test scripts that are developed locally and push the changes to the bit.

How is Jenkins used?

Jenkins is a widely used open source tool to perform continuous integration and build automation. It monitors the execution of the steps and allows to stop the process if one of the steps fails.

Jenkins can pull the source code from Bitbucket server by selecting the option of source code management and specify the SSH key and can find the source code of your project.

Now we will take you through the process step by step.

  1. To setup Jenkins, first of all, you have to download Jenkins.war file from the link- https://jenkins.io and copy that file to your c drive.
  2. Open a command prompt and execute —
    1. java –jar c:/ jenkins.war
  3. When the installation is complete the browser will be launched. If it doesn’t, open a browser- To browse http://localhost:8080
  4. To unlock Jenkins page, paste this password into the Administrator password field and click Continue.
  5. When Jenkins is up and running you can click on Manage Jenkins.
  6. After that click on Manage Plugins.
  7. Move to Available tab
  8. Search for Maven Integration plugin and Bit Integration by clicking on the checkbox.
    Maven Integration plugin will allow you to add a maven project and Bit Integration plugin will allow you to pull source code from the repository.
  9. Then click install without start and wait for the installation, then click on restart.
  10. Comeback to Manage Jenkins page.
  11. Click on Global Tool Configuration.
  12. Click on JDK Installations.
  13. Now add the JDK path.
  14. Click on Add Git and add the Git path.
  15. Click on Maven installations and add the Maven path.
  16. Click on save. The configuration is done. Now you just need to create a Maven project.
  17. To create a new Project, you have to Move to Jenkins dashboard and click on Create New Job.
  18. Just provide any Name for Project and select Maven Project for creating a maven project and then click on Ok.
  19. Select Git in Source Code Management and enter your repository clone SSH/HTTPS URL and add a valid username and password in credentials.
  20. Scroll Down to Build under this in Goal and Options. Enter clean install or as you need.
  21. Click on Save.
  22. Now you can click on Build and whenever you click on build, Jenkins will pull the latest commit source code from Bitbucket and generating a build. Also, it will generate a test report of that execution.Hope you got some insight on how to  integrate Maven Project from Bitbucket to Continues integration Jenkins and found our tips useful. Suggestions are always welcome and appreciated.  

1 Comment(s)

  1. Divyanshu Kumar
    July 22, 2018

    Nice article

Write a comment