Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publishing own libary to mavenCentral from private repository

I have created an Android library for customer, which is stored in private repository (it can be Github or Bitbucket, does not matter). And now this library should be published to mavenCentral for future use by other programmers. And there are two important requirements:

  1. Code of library must be in private repository, other programmers, which will use it, will not be able to download repo.
  2. Code of library must be obfuscated, programmers, which will use it, will be able to use methods, but will NOT be able to see code of that methods.
  3. Programmers will be able to implement library via gradle, as usual

How can I make this? I found many tutorials for mavenCentral, but all of them was only for public repos.

like image 291
Alex D. Avatar asked Jul 26 '21 13:07

Alex D.


People also ask

How to publish a Java library to Maven Central?

The process of publishing a Java library to Maven Central is not as straightforward as you might think and we will go through all the required steps to share your new shiny Java library with the of world. Maven central requires having a unique Group ID that is usually a domain name reversed.

How do I get a library into mavencentral in 2021?

So, if you feel up for a bit of a challenge, and want to do things the right way, here’s how you can get a library into MavenCentral, in 2021. Registering a Jira account with Sonatype, and verifying your ownership of the group ID you want to publish your artifact with

How do I publish a library to the Nexus repository?

Once you account is verified you should be able to access the Nexus Repository Manager where you will be able to see the artifacts of your uploaded libraries. GPG is required by Maven Central in order to be able to publish a libraries. Install GPG. For MacOS users you can run: brew install gpg.

What is the best place to host a Maven repository?

Finally, the fanciest place you can be in is The Central Repository via Sonatype OSSRH (OSS Repository Hosting), which I’ll refer to as simply MavenCentral from here on. This is the place to be if you’re a Maven dependency.


Video Answer


1 Answers

I am kind of facing some similar issue. However, I liked the idea in this link below:

https://medium.com/student-beans/publishing-a-library-as-a-aar-package-55ed725fa638

Create .aar file -> Create new repo -> Upload your .aar file to Github directly -> Create release version -> Distribute using Jitpack.

This way people can directly use your library without having to see the implementation.

Suggestion: If you want it to be more secure, I would recommend creating a separate account for AAR distribution. Make the AAR repo private and distribute Github token to your partner companies only. (This is just a suggestion and I have not yet tested it)

Update: Please follow the below tutorial as the above reference is not fully working.

https://www.talentica.com/blogs/publish-your-android-library-on-jitpack-for-better-reachability/

Take the jitpack.yml file from the first article and add it to your GitHub project along with the 3 generated files from the above tutorial.

like image 108
Preet Patel Avatar answered Oct 16 '22 13:10

Preet Patel