How to access GitHub Packages (Maven Repository) of public artefacts?

374 Views Asked by At

Has anyone an idea how to access GitHub Packages (Maven Repository) of public artefacts?

In my case, there is an artefact published in a public repository: https://github.com/viascom/spring-boot-starter-maintenance/packages/1424240

I know that I can access it like this:

repositories {
    maven {
        url = uri("https://maven.pkg.github.com/viascom/*")
        credentials {
            username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
            password = project.findProperty("gpr.token") ?: System.getenv("GITHUB_TOKEN")
        }
    }
}

and having the corresponding username and token placed in the properties.gradle.

But what I actually want to achieve is something easy to share with others maybe not even having to have a registered GitHub Account as an alternative for the Maven Central releases.

So my question is, is there a way to define GitHub Packages as a repository for any organization? And if not then organization only dependent, instead of specifying it till the project?

And also interesting, is there a way to access those artefacts without providing a username and pasword/token?

Thanks for any hints in advance!

Cheers

1

There are 1 best solutions below

0
On

You can use a Gradle plugin of mine (magik, I was exactly in your shoes) to easier the consumption of artifacts, you can either:

  • have a Github repository acting as a Maven repository
  • or publish on Github Packages and easier the consumption for Gradle clients