I’m working on a modified version of an open source project that I have forked on GitHub. I want to share this library with other developers so they can use it as a Maven dependency in their projects.
The problem is that I don’t want to set up my own repository server like Nexus, and since this is a forked version of someone else’s work, I can’t publish it to the official Maven Central repository through Sonatype.
I’m looking for a way to make my library available directly through GitHub so that other developers can add it to their Maven projects. What would be the most effective approach to achieve this? Are there any built-in GitHub features or third-party services that can help with Maven artifact hosting?
GitHub Actions can handle this automatically. just set up a workflow that builds and publishes to GitHub Packages when you push tags. no more manual uploads every time you update your fork.
try using JitPack.io! just push your fork to GitHub, and it builds maven artifacts for you. others can add JitPack as a repo in their pom.xml, and reference your artifact like github username/repo. it’s worked great for me.
GitHub Packages is another solid option that plugs right into your repo. Just configure your Maven project to publish artifacts using the maven-deploy-plugin in your pom.xml. You’ll need to add a distribution management section pointing to your GitHub repo and set up authentication with a personal access token. Once it’s published, other devs can pull your library by adding GitHub Packages as a repository and including your artifact as a dependency. Main advantage? Everything stays in the GitHub ecosystem. Downside is users need to authenticate to download dependencies, even from public repos. I’ve used this for internal team projects and it works great once you get through the initial setup.
You could also try GitHub Releases with manual artifact attachment. Create a release for your fork, build the JAR locally, and attach it as a release asset. Developers can then download it directly or reference it in their build scripts. It’s more manual work than JitPack or GitHub Packages, but you get complete control over what’s distributed. I’ve used this for custom builds that need specific configurations or when I want to include extra documentation with the artifacts. The downside? It doesn’t play nice with Maven’s dependency resolution, so users might have to download and manually install the JAR to their local repository first.