gradlegithub-package-registry

Gradle fails to download package from Github Package Registry


Uploading the public package with gradle works: https://github.com/ttiganik/hrd-java-test-registry/packages/61312

But I am unable to download it. I tried different URL-s and package names, but none of them work.

According to documentation the correct URL-s should be:

repositories {
    maven {
        url "https://maven.pkg.github.com/ttiganik/hrd-java-test-registry"
        credentials {
            username = System.properties['hmGithubUser']
            password = System.properties['hmGithubToken']
        }
    }
}

dependencies {
    implementation 'com.ttiganik:test:1.0.0'
}

The credentials are the same as for uploading.

gradle installDebug says it looks from the correct location:

> Could not find com.ttiganik:test:1.0.0.
  Searched in the following locations:
    - https://maven.pkg.github.com/ttiganik/com/ttiganik/test/1.0.0/test-1.0.0.pom
    - https://maven.pkg.github.com/ttiganik/com/ttiganik/test/1.0.0/test-1.0.0.jar
  Required by:

but it doesn't install it.

If I comment out the credentials in maven repository, it says 401 unauthorised. So the location seems to be correct.

What is wrong with my GPR configuration?


Solution

  • The problem was that I didn't include correct package name. You need to include package name 2x.

    -     implementation 'com.ttiganik:test:1.0.0'
    +     implementation 'com.ttiganik.test:test:1.0.0'
    
    

    It's easier to just copy the dependency straight from Github. They include the correct name