Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 3
Message 21 of 33

Re: GitHub package registry as Maven repo - trouble uploading artifact

Writing to GitHub I have got the message that GitHub Package Registry currently does not support mutable packages, whether your package is SNAPSHOT or not. So the only way to update your package is to publish a new package.

 

Hope GPR supports mutable packags ASAP!

Highlighted
Copilot Lvl 2
Message 22 of 33

Re: GitHub package registry as Maven repo - trouble uploading artifact

> Writing to GitHub I have got the message that GitHub Package Registry currently does not support mutable packages, whether your package is SNAPSHOT or not. So the only way to update your package is to publish a new package.

 

This is strange because the docs clearly state that you can deploy multiple packages (though I'm having the same problem - getting a 400 error after getting one deploy to work half-way).

 

 

Highlighted
Copilot Lvl 3
Message 23 of 33

Re: GitHub package registry as Maven repo - trouble uploading artifact

You can deploy mutiple packages, but you cannot deploy mutable packages.

 

This means that you cannot publish a SNAPSHOT package again, such as publish a `1.0-SNAPSHOT` package, and after updating something you cannot publish this package with version `1.0-SNAPSHOT` again(This is strange for snapshot packages).

 

So the only way to update your package is to publish a new version of you package.

Highlighted
Copilot Lvl 2
Message 24 of 33

Re: GitHub package registry as Maven repo - trouble uploading artifact

Do you know if this is something being worked on? Snapshots are supposed to be mutable :/

Highlighted
Copilot Lvl 2
Message 25 of 33

Re: GitHub package registry as Maven repo - trouble uploading artifact

Here're some fixes which worked for us (multimodule pom). This is mostly the summary of this thread:

  • Disable pooling: -Dmaven.wagon.http.pool=false
  • Switch to maven deploy plugin 3.0.0-M1 which isn't failing the build, when it's not able to upload maven-metadata.xml (<-- maybe we can skip the pooling switch. Didn't try that out anymore)
  • Add scm url with org and common prefix in order to group multiple packages (use the same url as in distributionManagement). This project is a multi-module one, so we do need that:
<scm>
<url>https://maven.pkg.github.com/vsfexperts/rbac</url>
</scm>
  • Use personal access token in settings.xml (username=your github account, password=token)

 

Not of all of this might be necessary, but it's at least working correctly for us for now. It just might help you to solve your issues. 

 

Full sample parent pom available at https://github.com/vsfexperts/rbac/packages/64840

Project available at https://github.com/vsfexperts/rbac

 

Highlighted
Copilot Lvl 2
Message 26 of 33

Re: GitHub package registry as Maven repo - trouble uploading artifact

Hey,

 

I'm trying to deploy an artifact to GitHub package registry. Is has nothing special on it it's just a library class (https://github.com/tvcsantos/javautils/) that i need as a dependency to my other projects.

 

I've followed the guide in https://help.github.com/en/articles/configuring-apache-maven-for-use-with-github-package-registry, with no success.

 

Can someone explain how can I deploy an artifact during my workflow. Just to check, I need to have:

 

<distributionManagement>
   <repository>
     <id>github</id>
     <name>GitHub OWNER Apache Maven Packages</name>
     <url>https://maven.pkg.github.com/OWNER/REPOSITORY</url>
   </repository>
</distributionManagement>

on my pom.xml, did that got a 401. What I'm I missing.

 

A simple hellow world artifact repository example would be a great starting point for everyone i guess.

 

Thanks

 

 

Highlighted
Copilot Lvl 2
Message 27 of 33

Re: GitHub package registry as Maven repo - trouble uploading artifact

It's Feb 2020 I am still facing the same issue. Not sure why Github hasn't fixed the issue

Highlighted
Ground Controller Lvl 2
Message 28 of 33

Re: GitHub package registry as Maven repo - trouble uploading artifact

I am not sure what the problem is, but this works:

 

name: Java CI

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Set up JDK 1.8
      uses: actions/setup-java@v1
      with:
        java-version: 1.8
    - name: Deploy to Github Package Registry
      env:
        GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
      run: |
        mkdir -p ~/.m2
        echo "<settings><servers><server><id>github</id><username>USER</username><password>${GITHUB_TOKEN}</password></server></servers></settings>" > ~/.m2/settings.xml
        mvn deploy -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/ORGANIZATION/REPOSITORY

 

Alternatively, instead of specifying altDeploymentRepository you can also have a DistributionManagement entry in the pom file. In this case mvn deploy should be enough.

 

What I don't understand is, how GitHub presents a command on the packages page that just does not work.

Highlighted
Copilot Lvl 2
Message 29 of 33

Re: GitHub package registry as Maven repo - trouble uploading artifact

I also have the issue, tried the latest maven-deploy-plugin version, disabled pooling but the problem persists.

 
First snapshot deployment apparently works:

 

[INFO] --- maven-deploy-plugin:3.0.0-M1:deploy (default-deploy) @ commons ---
Downloading from snapshots: https://maven.pkg.github.com/batchx/parent/io/batchx/commons/0.0.0-SNAPSHOT/maven-metadata.xml
Uploading to snapshots: https://maven.pkg.github.com/batchx/parent/io/batchx/commons/0.0.0-SNAPSHOT/commons-0.0.0-20200322.103921-1.jar
Uploaded to snapshots: https://maven.pkg.github.com/batchx/parent/io/batchx/commons/0.0.0-SNAPSHOT/commons-0.0.0-20200322.103921-1.jar (14 kB at 3.7 kB/s)
Uploading to snapshots: https://maven.pkg.github.com/batchx/parent/io/batchx/commons/0.0.0-SNAPSHOT/commons-0.0.0-20200322.103921-1.pom
Uploaded to snapshots: https://maven.pkg.github.com/batchx/parent/io/batchx/commons/0.0.0-SNAPSHOT/commons-0.0.0-20200322.103921-1.pom (2.1 kB at 864 B/s)
Uploading to snapshots: https://maven.pkg.github.com/batchx/parent/io/batchx/commons/0.0.0-SNAPSHOT/commons-0.0.0-20200322.103921-1-javadoc.jar
Uploaded to snapshots: https://maven.pkg.github.com/batchx/parent/io/batchx/commons/0.0.0-SNAPSHOT/commons-0.0.0-20200322.103921-1-javadoc.jar (431 kB at 88 kB/s)
Downloading from snapshots: https://maven.pkg.github.com/batchx/parent/io/batchx/commons/maven-metadata.xml
Downloaded from snapshots: https://maven.pkg.github.com/batchx/parent/io/batchx/commons/maven-metadata.xml (232 B at 283 B/s)
Uploading to snapshots: https://maven.pkg.github.com/batchx/parent/io/batchx/commons/0.0.0-SNAPSHOT/maven-metadata.xml
Uploaded to snapshots: https://maven.pkg.github.com/batchx/parent/io/batchx/commons/0.0.0-SNAPSHOT/maven-metadata.xml (980 B at 564 B/s)
Uploading to snapshots: https://maven.pkg.github.com/batchx/parent/io/batchx/commons/maven-metadata.xml
Uploaded to snapshots: https://maven.pkg.github.com/batchx/parent/io/batchx/commons/maven-metadata.xml (312 B at 190 B/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INF

 

but the repository is left in a bad state, failing (HTTP 400) to return maven-metadata.xml

https://maven.pkg.github.com/batchx/parent/io/batchx/commons/0.0.0-SNAPSHOT/maven-metadata.xml

error retrieving metadata for snapshot file: commons-0.0.0-20200322.104140-1-javadoc.jar

 

Making following deployments fail.

 

The error code (400, Bad request) makes no sense to me, since i am able to fetch other non-snapshot maven-metada.xml files the same way.

 

I would appreciate some feedback from the GitHub stuff, looks like the repository implementation is failing for some reason

Highlighted
Copilot Lvl 2
Message 30 of 33

Re: GitHub package registry as Maven repo - trouble uploading artifact

Avoiding attaching the -javadoc.jar made it work.