Failed to publish publication 'gpr' to repository 'GitHubPackages' because of HTTP 422 error

I am trying to publish my Katalon Studio SDK to GitHub packages.

I have been following these instructions to do so.

I created environment variables GITHUB_ACTOR and GITHUB_TOKEN on my machine, set up my build.gradle and then tried to run it.

My build.gradle looks like:

The build.gradle file

plugins {
  id 'java'
  id 'maven-publish'
  id "com.katalon.gradle-plugin" version "0.1.1"

group = 'com.mikewarren.katalonstudiosdk'
version = '1.0'

dependencies {
  implementation 'com.github.javafaker:javafaker:1.0.2'

repositories {

sourceSets {
    main {
        groovy {
            srcDirs = ['Keywords', 'Libs']
            excludes = ['CustomKeywords.groovy', "Temp*.groovy"]
    test {
        groovy {
            srcDirs = ['Include/scripts/groovy']

publishing {
    repositories { 
        maven {
            name = "GitHubPackages"
            url = uri("")
            credentials {
                username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
                password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
    publications {
        gpr(MavenPublication) {

How I tried to run it

At the BASH shell, I said:

gradle clean build --info

What happened

What ended up happening…is this:

> Task :publishGprPublicationToGitHubPackagesRepository FAILED
Caching disabled for task ':publishGprPublicationToGitHubPackagesRepository' because:
  Build cache is disabled
Task ':publishGprPublicationToGitHubPackagesRepository' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
Publishing to repository 'GitHubPackages' (
Uploading KatalonStudioSDK-1.0.jar to /MikeWarren2014/KatalonStudioSDK/com/mikewarren/katalonstudiosdk/KatalonStudioSDK/1.0/KatalonStudioSDK-1.0.jar
:publishGprPublicationToGitHubPackagesRepository (Thread[Execution worker for ':' Thread 3,5,main]) completed. Took 1.5 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':publishGprPublicationToGitHubPackagesRepository'.
> Failed to publish publication 'gpr' to repository 'GitHubPackages'
   > Could not PUT ''. Received status code 422 from server: Unprocessable Entity

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.

* Get more help at

I did a sanity check on the environment variables prior to running this script, they were initialized.

What did you try?

I tried to check the artifact ID, whatever it is in this context (is it the group and version?) and can’t seem to find it here… idk what to do here…

I tried to check if something with ${group}:${version} existed already, via this guy’s code snippet, which returned an HTTP 401 error instead. The GITHUB_TOKEN environment variable came straight from a package-read-write-authorized personal access token (classic) created on GitHub .

What is the way to fix this once and for all?!

UPDATE: I found the solution here, and it is two-fold:

  • to take care of the HTTP 422 error: It turns out that it was taking the folder name KatalonStudioSDK as the artifact ID. I fixed that by writing
artifactId = 'katalon-studio-sdk'

inside the gpr closure , and then

  • to take care of the HTTP 401 error: restart the BASH shell, so that the environment variables GITHUB_ACTOR and GITHUB_TOKEN get recognized by it