How to add GitHub Package Registry package as a Gradle dependency

后端 未结 1 1718
别那么骄傲
别那么骄傲 2021-01-04 17:18

So, I have a GitHub project with a Package Registry configured. It has two packages:

Package pages have instructions only for Maven, besides that, the instr

相关标签:
1条回答
  • 2021-01-04 17:50

    New answer:

    GitHub has published the official guide: Configuring Gradle for use with GitHub Packages.


    Old answer:

    First, configure Github Package Registry as a Maven repository in your Gradle build config:

    build.gradle.kts:

    repositories {
        jcenter()
        maven("https://maven.pkg.github.com/madhead") {
            credentials {
                username = "madhead"
                password = "<token>"
            }
        }
    }
    

    You can generate a token in your account settings page.

    Now, add a dependency like:

    build.gradle.kts:

    dependencies {
        implementation("so57323260:so57323260:1.0.0")
        implementation("so57323260:test:1.0.2")
    }
    

    Here groupId is the repo's name and artifactId is the name of the published package.

    0 讨论(0)
提交回复
热议问题