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

How do you upload a Maven artifact to Github Packages using the command line?

I am trying to upload a Maven artifact I haven't built to one my Organization's GitHub package registry. I am using the deploy:deploy-file Maven plugin in order to do so. Here is the command I have been using:

mvn deploy:deploy-file -Dfile=[THE JAR FILE]
-Durl=https://maven.pkg.github.com/[ORG] 
-Dregistry=https://maven.pkg.github.com/[ORG] 
-DgroupId=[GID]
-DartifactId=[ARTIFACTID] 
-Dversion=[VERSION]
-DgeneratePom=false 
-Dtoken=[MY GITHUB TOKEN]

As a result I am receiving 401 errors from Github. I have made sure that:

  • I have sufficient permissions inside of my Organization (currently Owner).
  • The token i am using is valid and has the appropriated scopes: I put all of them on to test.

Also, the github package page states:

<!-- Just a single step: Deploy using a GitHub token -->$ mvn deploy -Dregistry=https://maven.pkg.github.com/[org] -Dtoken=GH_TOKEN

Why can't I find any information in Maven documentation about registry or token parameters? Can I upload this file to the organization's registry without any kind of XML configuration file, using only the cli?

Thanks in advance.

2 Replies
Highlighted
Ground Controller Lvl 1
Message 2 of 3

Re: How do you upload a Maven artifact to Github Packages using the command line?

Were you able to figure out a solution? I'm having the same issue.

 

Thank you

Highlighted
Ground Controller Lvl 1
Message 3 of 3

Re: How do you upload a Maven artifact to Github Packages using the command line?

Hi guys,

 

In my case, I set in settings.xml

 

<server>
    <id>github</id>
    <username>PASTE_HERE_YOUR_GITHUB_USER</username
    <password>PASTE_HERE_YOUR_GITHUB_TOKEN</password
</server>

then

 

mvn deploy:deploy-file -Dfile=[THE JAR FILE]
-Durl=https://maven.pkg.github.com/[ORG]/[REPO]
-DgroupId=[GID]
-Dpacking=jar -DartifactId=[ARTIFACTID] -Dversion=[VERSION] -DrepositoryId=github

 

 

I hope that works