Jenkins – Continuous deployment

Posted: September 9, 2018 in Jenkins

In this example we’ll copy war file from Jenkins project to Tomcat using Jenkins.

Install Tomcat

configure tomcat credentials:edit file conf\tomcat-users.xml

<role rolename=”manager-script”/>
<role rolename=”admin-gui”/>
<user username=”tomcat” password=”tomcat” roles=”manager-script,admin-gui”/>

If tomcat port needs to be changed, edit file conf\server.xml

<Connector port=”8081″ protocol=”HTTP/1.1″
redirectPort=”8443″ />

Install copy artifact and deploy to container plugins:

Manage Jenkins-Manage Plugins








Create Jenkins job for compiling war file and to invoke other job for copying war files to tommcat (job name:packer)



In build step add Invoke top-level Maven targets

select Maven Version and Goals:clean package


In Post-build Action add Archive the artifacts

Files to archive **/*.war (archive all war file)

Add Post-build Action to run other job after this one is executed (deploy_staging)



Creating job for copying war file to tomcat (deploy_staging)

Build action:pecify project name (one we created in previous step)

Artifacts to copy:**/*.war


Post-build Actions:

Deploy war/ear to a container:**/*.war

Specify tomcat credentials-click Add to add credentials and Tomcat URL






Now run first job (packer), it should compile war file and copy it to Tomcat dierctory



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s