Phyxx
Phyxx

Reputation: 16085

Downloading package from GitHub Maven Package Repo results in a 400 error

I followed the instructions at https://help.github.com/en/github/managing-packages-with-github-packages/configuring-apache-maven-for-use-with-github-packages#authenticating-to-github-packages, but I could not get mvn install to download the artifact.

The error was something like:

[ERROR] Failed to execute goal on project myproject: Could not resolve dependencies for project com.project:myproject:jar:1.0: Failed to collect dependencies at com.dependency:mydependency:jar:0.1.331: Failed to read artifact descriptor for com.dependency:mydependency:jar:0.1.331: Could not transfer artifact com.dependency:mydependency:pom:0.1.331 from/to github (https://maven.pkg.github.com/OWNER/REPO): Failed to transfer file: https://maven.pkg.github.com/OWNER/REPO/com/dependency/mydependency/0.1.331/mydependency-0.1.331.pom. Return code is: 400 , ReasonPhrase:Bad Request. -> [Help 1]

Upvotes: 1

Views: 2013

Answers (1)

Phyxx
Phyxx

Reputation: 16085

Opening the URL in a browser and supplying the GitHub username and access token showed this error:

Unable to download maven package : "GraphQL call failed: Your token has not been granted the required scopes to execute this query. The 'id' field requires one of the following scopes: ['read:packages'], but your token has only been granted the: ['admin:gpg_key', 'admin:org', 'admin:org_hook', 'admin:public_key', 'admin:repo_hook', 'delete_repo', 'gist', 'notifications', 'repo', 'user'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens."

Fixing the permissions allowed the mvn install goal to complete correctly.

Upvotes: 2

Related Questions