What are GitHub Packages

GitHub Packages GitHub provides Packages for specific users in their projects.

token

Create a token in Settings>Developer Settings> Personal Access Tokens to access repO and write packages. Note that you need to write down the generated tokens for later use.

In gradle configuration file: ~ /. Gradle/gradle properties (if there is no this file is the new one) to add account configuration:

gpr.user=Your GitHub username
gpr.key=Token created above
Copy the code

Upload the jar

Modify build.gradle file to add package upload configuration:

plugins {
    id 'java'
    id 'maven-publish'}... publishing {repositories {
        maven {
            name = "GitHubPackages"
            url = "https://maven.pkg.github.com/phantom0103/elem-open-sdk"
            credentials {
                username = project.findProperty("gpr.user")
                password = project.findProperty("gpr.key")
            }
        }
    }

    publications {
        gpr(MavenPublication) {
            from(components.java)
        }
    }
}
Copy the code

Note that all url uploads should be lowercase. Last published: Gradle publish, you can see this package in Packages on your home page.

How to use

To modify the build.gradle configuration, first add this repository to repositories:

Maven {url 'https://maven.pkg.github.com/phantom0103/elem-open-sdk' credentials {username 'making user name password 'GitHub password '}}Copy the code

Then introduce dependencies:

Implementation Group: 'IO. Github. Phantom0103 ', name:' Em-open-sdk ', version: '2.1.0'Copy the code

GitHub Packages are not public repositories like Maven. GitHub Packages are intended for use by specific organizations, because GitHub account sensitive information needs to be configured in gralde.properties.