4

Can't access private GitHub package registry

Checked info on "jcenter" how to make custom dependency, but there nothing about private dependency

build.gradle:

repositories{
 jcenter(){
   url "my_custom_package_githubRepository"
 }
}

dependencies{
  compile 'my_custom_dependency'
}

Expect how to get access to private GitHub package registry

Serhii Zadorozhnyi
  • 576
  • 2
  • 8
  • 25
  • 1
    Gradle has a dedicated guide for declaring customer repositories. https://docs.gradle.org/current/userguide/declaring_repositories.html – Cisco Aug 06 '19 at 11:06
  • 3
    https://stackoverflow.com/questions/57373192/how-to-add-github-package-registry-package-as-a-gradle-dependency/57373631#57373631 – Serhii Zadorozhnyi Aug 07 '19 at 09:52
  • https://stackoverflow.com/questions/57373192/how-to-add-github-package-registry-package-as-a-gradle-dependency/57373631#57373631 – Serhii Zadorozhnyi Nov 04 '19 at 10:12

1 Answers1

2

Follow this: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry#authenticating-to-github-packages Be careful on how you set your id and token.

    repositories {
    maven {
        url = uri("https://maven.pkg.github.com/OWNER/REPOSITORY")
        credentials {
            username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
            password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
        }
    }
}
Procrastinator
  • 2,526
  • 30
  • 27
  • 36