Search code examples
androidkotlingithubgradlesdk

How do I publish publicly available libraries from non-open source code in github?


I am working on an Android SDK that is not open source. This is a requirement from my company. I have 2 libraries, A and B. The end-user will implement A in Gradle, and A will refer to B. The customer does not need to refer to B. The end user shouldn't need to use a password to implement library A. The libraries will be hosted in a private repository in GitHub (again, a requirement from my company).

I have tried just publishing to the libraries section of GitHub. This mostly works, but this method always seems to require credentials from the end-user. I have tried dropping all the A and B AAR files into a release in the GitHub repository, but I cannot figure out the syntax to refer to these individual libraries from Gradle (end-user to A, A to B). I have spent some time trying this with Jitpack.io, but I would like to avoid using it if at all possible.


Solution

  • If I got you right, it is not possible.

    GitHub Package Repository does not allow anonymous access to published packages at all. You always have to use a GitHub token for accessing them.

    I agree that JitPack is not a good idea for normal publishing. And especially in your case, as accessing artifacts built from a private repository are also only accessible if you have access to the private repository, so would also need authentication by the consumer and only work if they have access to that private repository as you can read at https://jitpack.io/private.

    The canonical repository to publish libraries is Maven Central. It is not restricted to only contain open-source projects. You can read about publishing closed source artifacts and the according terms of services at https://central.sonatype.org/faq/closed-source/