Upload jar file to Artifactory or Nexus repository using Gradle and Maven publish

Sometime we end up with a situation when we have a jar file as dependency of our project and that jar file is not in our artifact repository. This makes difficulties to include this file into our gradle or maven project. Thanks to maven-publish plugin which help us to easily deploy the jar to our private Artifactory or Nexus repository. Here is a sample gradle file to demonstrate that.

Gradle Hello World Example Java

What is Gradle? Gradle is a very popular build tool today in the ecosystem of Java based languages. Although it can be used for other languages as well. Gradle is based on the principal of convention over configuration which is also been popular with Maven. Unlike XML in Maven, Gradle uses Groovy for its language which makes it a very powerful tool. One can do almost anything using Gradle. It has very good plugin system with various ready-made plugins available which can be used for different situations / environments / purposes.