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

How to configure Gradle, Github Package Registry Maven

Solved! Go to Solution.

I was just playing with this and thought I would share what I have found so far.
Configuration is fairly straight forward when using the `maven-publish` plugin.
https://docs.gradle.org/current/userguide/publishing_maven.html

apply plugin: "maven-publish"

publishing {
  repositories {
    maven {
      name = "Github"
      url = uri("https://maven.pkg.github.com/owner/repo") //TODO update owner/repo
      credentials {
        //findProperty will allow these properties to be absent and still run the build, just won't publish
        username = findProperty("GITHUB_USERNAME")
        password = findProperty("GITHUB_API_TOKEN")
      }
    }
  }
  publications {
    register("jar", MavenPublication) {
      from(components["java"])
      pom {
        url.set("https://github.com/owner/repo.git") //TODO update owner/repo
      }
    }
  }
}

 

I am unable to upload classified artifacts, IE sources jar.

Could not PUT 'https://maven.pkg.github.com/owner/repo/com/owner/repo/x.y.z/ArtifactId-x.y.z-sources.jar'. Received status code 403 from server: Forbidden

 I sent in a support request on the classified artifacts being rejected, as well as a request to add gradle to the documentation. 

My hope is that they will also have decent support for gradle projects producing `.module` metadata by the time it reaches general release as well.
https://github.com/gradle/gradle/blob/f6a98158e75a636245f70d46604fcab3152361e8/subprojects/docs/src/...

17 Replies
Ground Controller Lvl 1
Message 2 of 18

Re: How to configure Gradle, Github Package Registry Maven

Hej man any news on that? 

I have the same issue that my sources.jar gets rejected

Copilot Lvl 3
Message 3 of 18

Re: How to configure Gradle, Github Package Registry Maven

@MarvinSchramm They responded asking for reproduction steps which I provided and have not heard anything since then.

 

additionally they don't handle the maven-metadata.xml correctly which results in 400 errors when gradle tries to read what is there before publishing a new snapshot.

Ground Controller Lvl 1
Message 4 of 18

Re: 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!

Copilot Lvl 2
Message 5 of 18

Re: How to configure Gradle, Github Package Registry Maven

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.

Copilot Lvl 2
Message 6 of 18

Re: How to configure Gradle, Github Package Registry Maven

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

Highlighted
Ground Controller Lvl 1
Message 7 of 18

Re: How to configure Gradle, Github Package Registry Maven

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

 

Copilot Lvl 2
Message 8 of 18

Re: How to configure Gradle, Github Package Registry Maven

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.grad...

 

The packages with pom only:

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

Copilot Lvl 3
Message 9 of 18

Re: How to configure Gradle, Github Package Registry Maven

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

Ground Controller Lvl 2
Message 10 of 18

Re: How to configure Gradle, Github Package Registry Maven

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