How do I deploy a 3rd party jar to our Nexus (or Archiva) internal repo?

How do I deploy a local jar that currently lives in /lib/ to a repo that we maintain (Nexus);

With maven I could put this in a shell script and deploy (from:

  mvn deploy:deploy-file -DgroupId= \

-DartifactId= \

-Dversion= \

-Dpackaging= \

-Dfile= \

-DrepositoryId=<id-to-map-on-server-section-of-settings.xml> \


With Gradle, I have read this section:

But my answer is not found there.

There is one section that provides this sample code:

But this only applies to my current project jar. I have a 3rd party jar that I downloaded that is not available in any maven repo, but I can push to nexus.

I can install Maven to do this, it is a twice a year thing, but is there a way to do this in Gradle?

There is no easy way to do this with Gradle. You’d have to script your own solution. If you do this twice a year, I’d recommend to do it via the Nexus UI.

With Gradle, is it best/preferred/recommended to use Maven style repos? What is recommended?

We have a Salesforce web services API jar that we must generate (from some sales force utils that queries things there) every two weeks (or more);

I want to script the generation of the jar and have it pushed to a repo (of any kind) we can switch if there is a more highly recommended repo than maven style repos.

How is this related to the original question (deploy a 3rd party jar to our Nexus)?

  1. Gradle advertises ‘Automation Evolved’ 2. deploying a jar to an artifact repo is a very basic 101 thing to do during the build process. 3. If I can not do it in Gradle and it is indeed ‘Automation Evolved’ then there must be some other preferred way and I am approaching Gradle from the wrong angle. We have a jar that needs to be generated on a weekly basis and pushed to an artifact repo for consumption by all developers (this jar will never be found in any public repo anywhere, it is a web services jar specific to our implementation ; the process for generating this jar is defined by Salesforce. We want to script this and not reach for the mouse and click once a week, we simply want a Jenkins job that will generate the jar and deploy to a repo, we are attempting to move to Gradle but we can fall back to Maven if this feature is not available in Gradle at this point. If it can not be done in Gradle I simply want to know if I am looking at things at the right angle, Was Gradle built with the absence of artifact repositories in mind (given that you cannot push a jar to a repo)? and if so, what is the Gradle way?

We do this as part of our regular build and release processes. Both snapshot and release artifacts are published to our local nexus repo using maven. This is the main reason we’re not using gradle for new projects as it requires additional work to complete the workflow.