I have a project that has a public API and an internal code.
The public part is published on MavenCentral.
I thought about making a package each, but everything from the 'internal' package that needs to be accessed from the 'api' package needs to be public -- therefore available from the end-user POV.
Currently, what is done is that the API part is a Gradle project, and the 'internal' part is a subproject of the API project. This way, if you import the API, Gradle knows the dependency between both, but won't give you access on the internal code. So far, so good.
The problem is with publishing to MavenCentral -- only the root project is published.
So I can either:
- Publish the subprojects on MavenCentral - but they're internal so it's weird to publish them!
- Group everything into a single project and use Java packages - but something that needs to be accessed from one package to another therefore is part of the public API (
publickeyword) so I'm exposing part of the internal stuff (but not much)
- Group everything into a single package, so I can use
package-privateaccessibility levels - but that's just messy...
What would you do to solve this issue? Is there even an other way of doing it?
I've heard about Jigsaw Modules in Java 9, but I cannot use them (the lib must be Android-compatible, so Android 8 at most)