Deploy both war and jar files into Nexus using maven in Jenkins

This tutorial will show you how to deploy both war and jar file from an web application using maven in Jenkins. By default when we build the web project in Jenkins then war file gets uploaded into nexus but not jar file.

Sometimes we need to upload both war and jar files from an web application using maven because some other standalone project needs to include the jar file of the web application and some another web project may need to include the war file of the web application. Hence we require to upload both war and jar files into Nexus.
We need maven war plugin to create an war file from the web application

We need maven jar plugin to create a jar file from the web application

We need to keep the generated jar file into the build directory. So use the below maven plugin.

Now we need another plugin to upload jar artifact as well into the repository.

Putting all together, the entire pom.xml file is given below

That’s all. Thanks for reading.

Soumitra

Software Professional, I am passionate to work on web/enterprise application. For more information please go to about me. You can follow on Twitter. You can be a friend on Facebook or Google Plus or Linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.