How to configure Gradle, Github Package Registry Maven

Yea i’ve noticed that.

Now we have 1 half published package on our repository which we cant delete…

I think we’ll wait until everything is out of beta.

Thank you!

I have the same issues, I’ve had nothing but issues, this looks like such a useful thing but it seems funamentally broken at the moment.

1 Like

Same Here! @marvinschramm did it work for u???

Same problems from me. I am able to publish the pom files with package registry, but beyond that, everything is rejected. People said that I might need pom properties in my jar, but that doesn’t help in any way.

Addiiton of pom properties:

https://github.com/liachmodded/carttemplate/blob/161758cf93b6317909dcbaa411a06303503acfee/build.gradle#L265

The packages with pom only:

https://github.com/liachmodded/carttemplate/packages/21483

Anyone figured out how to uplaod sources and javadoc ? I am similarly with a half published package.

1 Like

I just ran into the same issue. For me it did upload the build .jar and the .pom file but it rejected the sources and javadoc. The publication can be found here: https://github.com/guthix/Jagex-Store-5/packages/32130

@trevjonez Running into the same issue as well. Support ticket in but nothing yet. Any updates on your side?

I got an initial response that was “can you give a reproduction example” for the classified artifact issue, which I gave them immediately. Radio silence since then.

here is my reproduction: https://github.com/trevjonez/github-registry-repro

as well as a gradle scan of the issue happening: https://scans.gradle.com/s/eqnfwqbyopiyu/

while doing the reproduction I also found that republishing snapshots fail when querying the maven metadata which is shown in this scan: https://scans.gradle.com/s/5dgkmj22kdgls

All of this was August 22 2019

I’ve exactly the same issue. Have you found any solution?

This should work now

I forked your project and ran gradle publish which works without errors.

https://github.com/clarkbw/github-registry-repro/packages/38910

BTW we’ve added a new help section for Gradle here: https://help.github.com/en/articles/configuring-gradle-for-use-with-github-package-registry

6 Likes

Hey @clarkbw,

Still having issues with this on my end. When declaring the implementation for this in an Android project, how are you writing it so it finds the files? I can’t seem to get it to point to the files in that fork of yours correctly for the life of me.

Have tried 

implementation 'com.trevjonez:github-registry-repro:1.1'

and pretty much every other variation I can think of. Have set up the maven url to point to the repository correctly and provided authentication, but its not constructing a valid path to get the files from.

Any help would be greatly appreciated!

Edit:

This is now working, my error was when setting the url in the maven block, we were only including the OWNER in the url, not the OWNER/REPOSITORY (on both the publishing and implementation sides). Though this does lead to published packages having the repository name in the name of the package itself, which isn’t ideal, it fixes it enough to use which is great.

Hi @clarkbw, thanks for posting this. FYI the Kotlin DSL instructions are broken on Gradle 5.6.3. I had to change this line:

register("gpr") {

to:

register("gpr", MavenPublication::class) {
4 Likes

This does not appear to be solved. I’m still seeing this issue with my project.

1 Like

can you be more specific about your issue?

I have tried to publish a package from actions by running “gradle publish”, but is getting:

Could not transfer artifact dk.youtec:appupdater:jar:1.0.1 from/to remote (https://maven.pkg.github.com/clhols/appupdater-plugin): Could not write to resource 'dk/youtec/appupdater/1.0.1/appupdater-1.0.1.jar'

Could not transfer artifact dk.youtec:appupdater:pom:1.0.1 from/to remote (https://maven.pkg.github.com/clhols/appupdater-plugin): Could not write to resource 'dk/youtec/appupdater/1.0.1/appupdater-1.0.1.pom'
> Task :publishAppupdaterPluginPublicationToGitHubPackagesRepository FAILED

7 actionable tasks: 7 executed
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':publishAppupdaterPluginPublicationToGitHubPackagesRepository'.
> Failed to publish publication 'appupdaterPlugin' to repository 'GitHubPackages'
   > Could not deploy to remote repository | Failed to deploy artifacts: Could not transfer artifact dk.youtec:appupdater:jar:1.0.1 from/to remote (https://maven.pkg.github.com/clhols/appupdater-plugin): Could not write to resource 'dk/youtec/appupdater/1.0.1/appupdater-1.0.1.jar'

build.gradle.kts looks like this:

publishing {
    repositories {
        maven {
            name = "GitHubPackages"
            url = uri("https://maven.pkg.github.com/clhols/appupdater-plugin")
            credentials {
                username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME")
                password = project.findProperty("gpr.key") as String? ?: System.getenv("PASSWORD")
            }
        }
    }
    publications {
        register("appupdaterPlugin", MavenPublication::class.java) {
            groupId = "dk.youtec"
            artifactId = "appupdater"
            version = "1.0.1"

            from(components["java"])
        }
    }
}

Actions build.yml looks like this:

name: CI

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - name: set up JDK 1.8
      uses: actions/setup-java@v1
      with:
        java-version: 1.8
    - name: Build appupdater plugin
      run: |
        ./gradlew publish
1 Like

I figured it out. I just had to add the properties to the gradle command in build.yml myself, like so:

-name: Build appupdater plugin
run: |
./gradlew build
./gradlew -Pgpr.user=clhols -Pgpr.key=${{ secrets.GITHUB_TOKEN }} publishAppupdaterPluginPublicationToGitHubPackagesRepository
3 Likes

I ended up using

register<MavenPublication>("gpr"){

Basically the same thing, just throwing that out there :slight_smile:

1 Like

Do you have a link to that support ticket?

just some email threads, last thing I got was a “we don’t support that”

The command I use for publishing is (kinda verbose):

JAVA_HOME=/usr/lib/jvm/java-8-jdk mvn clean source:jar javadoc:jar deploy -Dmaven.install.skip=true -DaltSnapshotDeploymentRepository='github::default::https://maven.pkg.github.com/<owner>/<repo>' -DaltDeploymentRepository='github::default::https://maven.pkg.github.com/<owner>/<repo>'