GitHub packages: publish to another repository

As an example we have the follwing setup:

  • module 1: woodpecker with own source repo on GitHub
  • module 2: roadrunner with own source repo on GitHub
  • module 3: coyote with own source repo on GitHub

We don’t want to have a separate maven definition (in our build.gradle) for each of the modules as this would clutter up the complete build.gradle files. So we thought about having the publish task pointing to one central repository e.g. com.acme.

However in doing so we receive an HTTP 422 error like this one:

org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException: Could not PUT ‘https://maven.pkg.github.com/Acme/com.acme/woodpecker/0.0.5/woodpecker-0.0.5.jar’. Received status code 422 from server: Unprocessable Entity

How can this be solved? Many thanks in advance and kind regards

2 Likes

I’m facing the same issue - so this reply is only to raise awareness.

Would be sad if this structure is required :

repositories{  
mavenLocal()
mavenCentral()
maven{  
name ="GitHubPackages"  
url = uri("https://maven.pkg.github.com/some-owner/repo-a")
credentials{  
username = gprUser
password = gprToken
}  
 }  
 maven {  
 name = "GitHubPackages"  
 url = uri("https://maven.pkg.github.com/some-owner/repo-b")  
 credentials {  
 username = gprUser  
 password = gprToken  
 }  
 }  
...  
}
1 Like

It looks like the package group and name must be unique within the user/organization. I got this same error (422) when I tried to publish a previously published package into a new private repository. I tried changing the package name and everything went swimmingly after that.

7 Likes

I’m facing a 422 but happens after publishing. The message is always a 422 even when the package publish.

At least for me, problem was solved when I avoided using uppercase letters in the artifact id. I put all lowercase letters for the group id and the artifact id in the pom file and it worked!

2 Likes