Getting 422:Unprocessable Entity when trying to add maven package form github registry to a gradle file
Asked Answered
L

3

7

I have a jar out in gitHub package registry called test.jar (version: 1.0.5), the repository name is testRepo, owner name: tejas3108.

I am trying to add this jar as a dependency in my other gradle project, but with correct credentials, I still get this message: Could not GET 'https://maven.pkg.github.com/tejas3108/com.tejas/1.0.5/testRepo-1.0.5.pom'. Received status code 422 from server: Unprocessable Entity. Pasting the same in the browser gives the message: Invalid path for maven file.

How do I successfully add this jar from the github registry to my build.gradle? Here is what I have now:

repositories {
    mavenCentral()
    maven{
        url = "https://maven.pkg.github.com/tejas3108"
        credentials {
            username = "tejas3108"
            password = "<my_github_token>"
        }
    }
}

dependencies {
   compile "com.tejas:testRepo:1.0.5"
}
Lucic answered 7/10, 2019 at 18:0 Comment(0)
S
6

The URL should include the repository name, as per the documentation. So, in your case, write:

url = "https://maven.pkg.github.com/tejas3108/testRepo"
Subpoena answered 16/11, 2019 at 16:4 Comment(0)
L
1

It may be also because the artifact group must be unique in your Github organisation / account. So for example if you already have the same artifact in a different Github repository of your organisation or account

Liken answered 14/11, 2022 at 17:22 Comment(0)
C
0

My issue was an uppcase letter in mArtifactId

    publications {
        maven(MavenPublication) {
            groupId mGroupId
            artifactId mArtifactId
            version mVersionName
Comprehension answered 23/12, 2022 at 14:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.