尝试消费我发布的GitHub包时遇到了一些问题。

huangapple go评论68阅读模式
英文:

Facing several issues trying to consume a GitHub package I published

问题

我今天创建了一个SDK包,但出于某种原因,似乎无法使用它...!

包是如何创建的

它发布到 GitHub packages,遵循了这些说明。我将个人访问令牌保存到了我的计算机环境变量中,分别为 GITHUB_TOKENGITHUB_ACTOR

我的 build.gradle 如下:

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
        }
    }
}

在所有这些之前,我还设置了一个 GitHub action 来发布这个包,但当我运行 gradle clean publish --info 时,它 没有 被触发:

尝试消费我发布的GitHub包时遇到了一些问题。

当我尝试使用这个包时

这就是所讨论的包。我按照 GitHub 的说明操作,但遇到了问题...

以下是消费者项目的 build.gradle

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'
}

当我运行 gradle clean build 时,它 “成功”:

尝试消费我发布的GitHub包时遇到了一些问题。

但是,当我在消费者项目中搜索 katalon-studio-sdk-1.0.jarkatalon-studio-sdk-1.0-all.jar 时,它们都找不到!

然后,我记起这是一个 Katalon Studio 项目,于是我尝试运行 gradle katalonCopyDependencies,却遇到了这个问题:

尝试消费我发布的GitHub包时遇到了一些问题。

我尝试在浏览器中访问该 URL,然后 GitHub 提示我输入凭据。看起来有希望...

它返回的页面是一个文本页面,只显示了:

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

我在这里做错了什么?

更新:当我运行 gradle tasks --all | grep publish 时,我看到:

publish - 发布此项目生成的所有发布版本。
publishAllPublicationsToGitHubPackagesRepository - 将此项目生成的所有 Maven 发布版本发布到 GitHubPackages 存储库。
publishGprPublicationToGitHubPackagesRepository - 将 Maven 发布版本 'gpr' 发布到 Maven 存储库 'GitHubPackages'。
publishGprPublicationToMavenLocal - 将 Maven 发布版本 'gpr' 发布到本地 Maven 缓存。
publishToMavenLocal - 将此项目生成的所有 Maven 发布版本发布到本地 Maven 缓存。
英文:

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:

尝试消费我发布的GitHub包时遇到了一些问题。

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`:

尝试消费我发布的GitHub包时遇到了一些问题。

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:

尝试消费我发布的GitHub包时遇到了一些问题。

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?

UPDATE: When I run gradle tasks --all | grep publish

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.

答案1

得分: 0

包消耗问题是一个 PEBKAC(问题存在于键盘和椅子之间)...

我错误地称呼我的包组为:

'com.mikewarren.katalonstudiosdk'

但试图消耗的包组是:

'me.mikewarren.katalonstudiosdk'

我真是傻啊!是在开玩笑吗?

现在的问题是 GitHub Actions 仍然无法正常工作...

英文:

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 the question remains on the GitHub Actions not working...

huangapple
  • 本文由 发表于 2023年5月28日 06:42:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/76349315.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定