How to upload an artifact from gradle into a nexus repository? - gradle

I have built an artifact with gradle that I now need to upload to Nexus. What is the best way to do this?

Gradle's Maven Publish plugin can be used for that. The documentation is clear enough I think, you will find there examples that you can adapt for uploading to Nexus repositories.

Related

Bintray, JCenter, Maven, MavenCentral, OSSRH, Sonatype, Nexus, how are they all related?

I have a library shared in JCenter, which I post to through Bintray.
Recently, it is announced JCenter and Bintray are sunsetting, and many advised us to go to MavenCentral. I'm looking to move migrate it over.
Then I notice within the Bintray, it is stated my library is on Maven too, and the user can get my library using
maven {
url "https://dl.bintray.com/elye-project/maven"
}
So I'm confused, does that means I am already in Maven? Is this is just another name for JCenter and will not be available as well?
As I read more, I found an article stating we can publish our library from Bintray to MavenCentral too.
I also read if I need to submit my library to MavenCentral, I need to first create an issue in Sonatype.
Then I saw Sonatype is actually having Nexus Repository Manager. Then I find OSSRH uses Nexus Repository Manager.
I am super confused about what these terms are, and how are they related?
Bintray, JCenter, Maven, MavenCentral, OSSRH, Sonatype, Nexus.
Can someone give a brief description about them, and help to connect the dot for me?
MavenCentral is the place where Java open source artifacts should be published
JCenter was such a place.
Maven is a build system, not a repository. Many repositories have Maven format, which makes them readable from Maven and Gradle.
Sonatype Nexus and JFrog Artifactory are repository managers. You can install them to manage internal and external artifacts on your own server, which is advisable inside a company.

How to get an artifact in Maven Central show up in JCenter

I have published a small library to Maven Central (it can be downloaded via web UI here). This was done more than a full day ago.
My understanding is that JCenter mirrors Maven Central, but for some reason I cannot find my artifact in JCenter both via web interface and as part of Maven build.
Do I need to take some action to make it appear in JCenter too?
Basically, if you want to make sure that your library will exist in JCenter, you can upload your library to Bintray under Maven repository, and request to add it to JCenter.
Bintray can also save you the trouble of uploading your library to Maven Central, and do it for you.
Enjoy
Two weeks later the artifact is now visible in JCenter. Apparently it just takes some time to appear there.

Jenkins upload artifact to nexus plugin

Could you please help me in providing any alternate solution or plugin which will help me to upload my artifacts to Nexus 3.x.
My ground work says that Development is in progress for Nexus Artifact Plugin. I am lost here so need anyone guidance on the same.
Now the Nexus Artifact Uploader plugin supports uploading artifacts to Nexus-3.x.
Support for Nexus-3.x from the version Nexus-Artifact-Uploader 2.6

How can I sync my maven artifacts to jcenter?

I have deploy my fist version to the maven central repository. Now I want sync this to JCenter / Bintray. Is this possible and how can I do this?
Yes, all you need to do is just download your artifacts from JCenter.
On a related note, I'd suggest doing it the other way around - publish to JCenter and sync to Central. It should be easier for you.
I am with JFrog, the company behind Bintray and [artifactory], see my profile for details and links.

Publishing OSS library release to jcenter and maven-central

I'd like to publish my OSS library to be available in both jcenter and maven-central repositories. I have 2 questions related with this topic:
Should I publish by my own to both repositories, or there is some automated sync between them, so will be enough to publish only to one of them? If there is a sync, which one is the primary source and which when is mirrored?
I'd like to perform publish automatically from gradle, using some gradle plugin. Is there any single plugin, being able to work with both repositories?
JCenter is a super-set of Maven-Central and it syncs automatically with the package published to Maven-Central, so essentially artifacts published to Maven-Central will be automatically synced and available in JCenter as well.
Gradle has two plugins supporting publishing to several repositories types, including Maven-Central and JCenter: (1) A "legacy" maven plugin and (2) a new incubating maven-publish plugin.
For sure you need to publish to only one, and another one should pick it up from there. The question is which one to select?
Although #amnon-shochot's solution works, I'd suggest much easier solution: doing it vice-versa and going with Bintray as a main distribution platform.
Publishing to Bintray is much easier than publishing to Maven Central, and Bintray supports a very easy way to sync whatever you published to Bintray's JCenter to Maven Central.
Also, most of Gradle users already prefer jcenter() over mavenCentral() cause it's faster, more reliable, gives you much more as a publisher and more secure.
You can publish to Bintray from Gradle using Bintray Gradle plugin, which support verity of methods to specify what should be published (configurations, publications, filesets, etc.)
I am with JFrog, the company behind Bintray and [artifactory], see my profile for details and links.

Resources