In our previous articles, we have already created a job for a maven project using pipelines. we’ve not deployed the code on the production server yet. So, today we will create a Jenkins production job for maven.

Step 1: I’m supposing you’re aware of how to create a maven job for your project if not you can visit this article.

Check Out: Create a Job For Maven Project(Java) In Jenkins Server

Create Jenkins Production Job For Maven Project :

First of all, you need a plugin installed to deploying the war files directly on the tomcat server. You must have install maven plugins before starting the work.

Go to Manage plugins -> choose available -> and Look for deploy to container plugin and install it.

After successfully, installation of plugins and you need to ask a few things from developers which I will mention below with screenshot.

Step 2: Click on Item -> Maven project and “Ok”

Click on Discard old build,

Check Out: How To Create Pipeline For Maven Project In Jenkins

Step 3: Click on Source code Management, if you’re using git then select it.

You need to put the git repository URL that ends with .git and master branch name. you’ll get this information from developers.

Step 4: Next you can choose build trigger

Choose build, here you need to define commands to make war file and pom.xml can be on a different path.

Step 5: In the post steps, choose to run only if the build succeeds.

You can also send an email notification by using the E-mail notifications.

Check Out: How To Solve Missing Jenkins Login Page

Step 6: Finally here you need to define the tomcat server IP address, port, and credentials to run tomcat server.

Go to post-build actions and choose deploy war/ear to a container, and here I’m just giving you an example the location of war/ear files and context path need to ask from developers.

You also need to add tomcat URL credentials,

After these all settings, you need to run the build and see this should work.

You’re done

LEAVE A REPLY

Please enter your comment!
Please enter your name here