Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 3
Message 11 of 18

Re: How to configure Gradle, Github Package Registry Maven

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

Copilot Lvl 2
Message 12 of 18

Re: How to configure Gradle, Github Package Registry Maven

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

Highlighted
Solution
Copilot Lvl 3
Message 13 of 18

Re: How to configure Gradle, Github Package Registry Maven

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

Copilot Lvl 2
Message 14 of 18

Re: How to configure Gradle, Github Package Registry Maven

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.

Copilot Lvl 3
Message 15 of 18

Re: How to configure Gradle, Github Package Registry Maven

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) {

 

Copilot Lvl 2
Message 16 of 18

Re: How to configure Gradle, Github Package Registry Maven

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

Copilot Lvl 3
Message 17 of 18

Re: How to configure Gradle, Github Package Registry Maven

can you be more specific about your issue?

Ground Controller Lvl 1
Message 18 of 18

Re: How to configure Gradle, Github Package Registry Maven

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