Facing several issues trying to consume a GitHub package I published

I created an SDK package today, but for some reason I cannot seem to use it…!

How the package was created

It is published to GitHub packages under these instructions. I had saved personal access token to environment variable on my machine, as well as my username, under GITHUB_TOKEN and GITHUB_ACTOR, respectively.

My build.gradle look like :

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 {
    mavenCentral()
}

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

publishing {
    repositories { 
        maven {
            name = "GitHubPackages"
            url = uri("https://maven.pkg.github.com/MikeWarren2014/KatalonStudioSDK")
            credentials {
                username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
                password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
            }
        }
    }
    publications {
        gpr(MavenPublication) {
            artifactId = 'katalon-studio-sdk'
            from components.java
        }
    }
}

I also, before all this, set up a GitHub action to publish the package, but it did NOT get hit when I said gradle clean publish --info:

When I try to use the package

Here is the package in question. I follow GitHub’s instructions and hit a brick wall…

Here’s the build.gradle for the consumer project:

plugins {
  id 'groovy'
  id "com.katalon.gradle-plugin" version "0.1.0"
}

repositories {
  maven {
      name = "GitHubPackages"
      url = uri("https://maven.pkg.github.com/MikeWarren2014/KatalonStudioSDK")
      credentials {
          username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
          password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
      }
  }
}

dependencies {
  implementation 'me.mikewarren.katalonstudiosdk:katalon-studio-sdk:1.0'
}

When I gradle clean build, it "succeeds`:

image

However, when I search the consumer project for the katalon-studio-sdk-1.0.jar or katalon-studio-sdk-1.0-all.jar, it’s nowhere!

I then remember this is a Katalon Studio project, which gives me the idea to gradle katalonCopyDependencies, only to be met with this:

I try to crawl the URL in my browser, and get prompted by GitHub for my credentials. Looks promising…

The page it returns for my doing so, is text page that simply says:

maven package "me.mikewarren.katalonstudiosdk.katalon-studio-sdk" does not exist under owner "MikeWarren2014"

What am I doing wrong here?

@kazurayam

This is “forum.katalon.com”, and your post has nothing to do with the Katalon products. The Katalon products has nothing to do with Maven Repositories, Gradle, GitHub Actions, GitHub Packages.

You had better ask this question somewhere more appropriate.

I don’t understand what you mean by “but it did NOT get hit …”. I do not see if you were successful or not.

Have you checked if your jar is successfully uploaded to the Maven Repository on GitHub Packages?

If you haven’t made a Maven Repository on GitHub Package, then you can not used it, of course

The environment variables on your local PC are not visible for any GitHub Actions, which run on some remote server machines.

If you want a GitHub Action to get access to the Maven Repository on GitHub Packages, you need to pass appropriate value to Gradle propeires or System environment variable on the server machine, not on your local PC, as your build.gradle script below requires either of Gradle property or System environment on the runtime envrionment = the server machine where GitHubAction is running:

            credentials {
                username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
                password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
            }

How can you pass the values to the GitHub Action on server machines? — You need to use “GitHub Actions Secrets”

Are you aware what the gradle publish command does?

There are many other publish***** commands. For example, in my “inspectus” project i can retrieve avaliable task names like:

$ cd <projectDir>
$ gradle tasks --all | grep publish
publish - Publishes all publications produced by this project.
publishAllPublicationsToGprRepository - Publishes all Maven publications produced by this project to the gpr repository.
publishAllPublicationsToMavenRepository - Publishes all Maven publications produced by this project to the maven repository.
publishInspectusPublicationToGprRepository - Publishes Maven publication 'inspectus' to Maven repository 'gpr'.
publishInspectusPublicationToMavenLocal - Publishes Maven publication 'inspectus' to the local Maven repository.
publishInspectusPublicationToMavenRepository - Publishes Maven publication 'inspectus' to Maven repository 'maven'.
publishToMavenLocal - Publishes all Maven publications produced by this project to the local Maven cache.

So if I want to publish my “inspectus” jar, I would type

$ gradle publishInspectusPublicationsToGprRepository 

I can download katalon-studio-sdk-1.0-all.jar from it, and the Katalon Studio recognizes all of its keywords. Also, when I examine it with WinRAR, everything is in there…

You seem to be trying to overcome 2 hurdles at once.

  1. How to utilize the Maven Repository on the GitHub Packages
  2. How to utilize the GitHub Actions

and you seem to have problems for both yet. Trying 2 targets at once, too difficult.

I would recommend you to try the problem #1 and resolve it complete. Once you could overcome #1, then you could try #2 later.

When I run that command, I see:

publish - Publishes all publications produced by this project.
publishAllPublicationsToGitHubPackagesRepository - Publishes all Maven publications produced by this project to the GitHubPackages repository.
publishGprPublicationToGitHubPackagesRepository - Publishes Maven publication 'gpr' to Maven repository 'GitHubPackages'.
publishGprPublicationToMavenLocal - Publishes Maven publication 'gpr' to the local Maven repository.
publishToMavenLocal - Publishes all Maven publications produced by this project to the local Maven cache.

The package consumption issue was a PEBKAC (Problem Existing Between Keyboard And Chair)…

I had mistakenly called my package group:

'com.mikewarren.katalonstudiosdk'

but was tryna consume package with group:

'me.mikewarren.katalonstudiosdk'

Silly me! Pun intended?

Now to wrap my head around that pesky GitHub Actions issue…