Error on Github Packages for `-SNAPSHOT` maven artifacts with a classifier

If you upload a -SNAPSHOT version of maven artifacts with a classifier then you get an error when you try to read back the maven-metadata.xml

More details here:

HTTP/1.1 400 Bad Request
error retrieving metadata for snapshot file: lib-0.2-20200604.123456-4-sources.jar

for maven-metadata.xml

<metadata modelVersion="1.1.0">
  <groupId>com.example</groupId>
  <artifactId>lib</artifactId>
  <version>0.2-SNAPSHOT</version>
  <versioning>
    <snapshot>
      <timestamp>20200604.123456</timestamp>
      <buildNumber>4</buildNumber>
    </snapshot>
    <lastUpdated>20200604123456</lastUpdated>
    <snapshotVersions>
      <snapshotVersion>
        <classifier>sources</classifier>
        <extension>jar</extension>
        <value>0.2-20200604.123456-4</value>
        <updated>20200604123456</updated>
      </snapshotVersion>
      <snapshotVersion>
        <extension>jar</extension>
        <value>0.2-20200604.123456-4</value>
        <updated>20200604123456</updated>
      </snapshotVersion>
      <snapshotVersion>
        <extension>pom</extension>
        <value>0.2-20200604.123456-4</value>
        <updated>20200604123456</updated>
      </snapshotVersion>
      <snapshotVersion>
        <extension>module</extension>
        <value>0.2-20200604.123456-4</value>
        <updated>20200604123456</updated>
      </snapshotVersion>
    </snapshotVersions>
  </versioning>
</metadata>
2 Likes

I was wondering if there’s a public repository that uses a classifier what I could see?

mvn deploy has the same problem, so not specific to gradle, can’t deploy the same -SNAPSHOT twice with “sources” and “javadoc” jars.
You work around this with

mvn deploy -Dmaven.javadoc.skip=true -Dmaven.source.skip=true

for -SNAPSHOT versions.

1 Like

Hi @yogurtearl :wave:

Thanks for the extra details here. I knew about the issues with -sources.jar and -javadoc.jar files, but didn’t realize that they were called classifiers.

Do you know if there’s an issue with the maven-metadata.xml feed that GitHub Packages returns or does the problem happen when it tries to fetch the files?

Thanks,
Jamie.

I have a repository here that shows the issue with javadoc and sources classifiers:

If appears that retrieving the maven-metadata.xml fails completely when a package contains a classifier:

$ curl https://maven.pkg.github.com/jcansdale-test/gradle-java-publish/org/test/javadoc/gradle-java-publish/1.0-SNAPSHOT/maven-metadata.xml -v -u token:<READ_PACKAGES_PAT>

< HTTP/1.1 400 Bad Request
< Date: Wed, 10 Jun 2020 14:32:12 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 99
< Content-Security-Policy: default-src 'none';
< Server: GitHub Registry
< Strict-Transport-Security: max-age=31536000;
< X-Content-Type-Options: nosniff
< X-Frame-Options: DENY
< X-Xss-Protection: 1; mode=block
< X-GitHub-Request-Id: FBF8:C5BE:1FD460:2B2CD6:5EE0EEEC
< 
error retrieving metadata for snapshot file: gradle-java-publish-1.0-20200528.110628-2-javadoc.jar

Hi guys!

I’ve got the same problem in our projects. The first maven deploy with a new SNAPSHOT version succeeds. The next run with the same SNAPSHOT version always fails with:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project myproject: Failed to retrieve remote metadata my-project:my-client:2.2.0-SNAPSHOT/maven-metadata.xml: Could not transfer metadata my-project:my-client:2.2.0-SNAPSHOT/maven-metadata.xml from/to my-repo (https://maven.pkg.github.com/my-company/my-repo): Transfer failed for https://maven.pkg.github.com/my-company/my-repo-maven/com/mycompany/my-client/2.2.0-SNAPSHOT/maven-metadata.xml 400 Bad Request

mvn deploy -Dmaven.javadoc.skip=true -Dmaven.source.skip=true
does not change this behavior. Do you have any idea for me?

1 Like