Exlll / ConfigLib

A Minecraft library for saving, loading, updating, and commenting YAML configuration files
MIT License
135 stars 17 forks source link

GitHub authentication problem #12

Closed hankur closed 10 months ago

hankur commented 2 years ago

Could not transfer artifact de.exlll:configlib-bukkit:pom:2.2.0 from/to de.exlll (https://maven.pkg.github.com/Exlll/ConfigLib): authentication failed for https://maven.pkg.github.com/Exlll/ConfigLib/de/exlll/configlib-bukkit/2.2.0/configlib-bukkit-2.2.0.pom, status: 401 Unauthorized

Exlll commented 2 years ago

Hi,

you need to login with your username and a token that has the required permissions. You can generate such a token under Settings -> Developer Settings -> Personal access tokens.

Cobeine commented 2 years ago

I cant access it too.

Exlll commented 2 years ago

Currently, there is no way to access a package from the Github Package Registry without authentication. If you want to download a package that is hosted here on Github, you have to define a repository and provide your credentials.

For Gradle (using Kotlin DSL), first go to your .gradle/gradle.properties file and add the following two lines where the token is a Github Token which was generated as I described above:

github.actor=<GITHUB USERNAME>
github.token=<GITHUB TOKEN>

Then, you need to define the repository in your build.gradle.kts and add the dependency:

repositories {
    mavenCentral()
        // ...
        maven {
            url = uri("https://maven.pkg.github.com/Exlll/ConfigLib")
            credentials {
                username = project.findProperty("github.actor") as String?
                        ?: System.getenv("GITHUB_ACTOR")
                password = project.findProperty("github.token") as String?
                        ?: System.getenv("GITHUB_TOKEN")
            }
        }
    }
}

dependencies {
    implementation("de.exlll:configlib-core:2.2.0")
}

For Maven, you basically have to do the same as described here.

Insprill commented 2 years ago

Has there been any progress on alternative solutions?

Exlll commented 2 years ago

@Insprill I submitted a request to codemc.io to get access to Nexus almost a month ago. I guess they haven't had time to review this project. Three other people I asked recommended not using jitpack.io. Now I'm thinking about publishing to Maven Central but I'd prefer having a bit more control over the repository. Have you got any other suggestions?

Insprill commented 2 years ago

I've only ever used Maven Central, but it's worked great for me. I got approved in a couple of hours and it's very simple to get set up with Gradle and the Nexus Publish Plugin.

Exlll commented 2 years ago

@Insprill Using the latest commit, you should now be able to use jitpack.io.

Exlll commented 8 months ago

This library is now also published to Maven Central.