Deploying to Github package registry gives 400 error

I have a Spring Boot project using maven build tool. I defined github package config as shown below

\<distributionManagement\>
\<repository\>
\<id\>github\</id\>
\<name\>eShopping\</name\>
\<url\>https://maven.pkg.github.com/pavankjadda/eShopping\</url\>
\</repository\>
\</distributionManagement\>

 When I deploy new package to maven I get 400 error and package deploys successfully

Uploading to github: https://maven.pkg.github.com/pavankjadda/eShopping/com/pj/eShopping/2.1.2/eShopping-2.1.2.pom
539
Progress (1): 4.1/7.4 kB
540
Progress (1): 7.4 kB
541
542
[INFO] ------------------------------------------------------------------------
543
[INFO] BUILD FAILURE
544
[INFO] ------------------------------------------------------------------------
545
[INFO] Total time: 5.444 s
546
[INFO] Finished at: 2020-04-11T16:18:00Z
547
[INFO] ------------------------------------------------------------------------
548
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project eShopping: Failed to deploy artifacts: Could not transfer artifact com.pj:eShopping:jar:2.1.2 from/to github (https://maven.pkg.github.com/pavankjadda/eShopping): Transfer failed for https://maven.pkg.github.com/pavankjadda/eShopping/com/pj/eShopping/2.1.2/eShopping-2.1.2.jar 400 Bad Request -> [Help 1]
549
[ERROR]
550
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
551
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
552
[ERROR]
553
[ERROR] For more information about the errors and possible solutions, please read the following articles:
554
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
555
##[error]Process completed with exit code 1.

Hi @pavankjadda ,

Could you share your workflow yml which you used to deploy maven package to GitHub package registry here ? 

Have you set user and password for github package registry in your settings.xml? I could successfully deploy multiple packages to my github repo by specfying settings.xml when execute mvn deploy. 

My mvn deploy step in workflow yml file: 

- run: mvn deploy --settings settings.xml
      env:
        USENAME: ${{ github.actor }}
        PASSWORD: ${{ secrets.GITHUB_TOKEN }}

I add settings.xml in the root path of my repository, and add servers section in it:

<servers>
    <server>
      <id>github</id>
      <username>${env.USERNAME}</username>
      <password>${env.PASSWORD}</password>
    </server>
  </servers>

Here is my settings.xml file and I set username and password. When I try to depoly form local machine(with settings.xml contains credentials) I got the same error. I am suspecting issue lies with Github package registry.  

settings.xml could not just include server section. There is the document for Maven settings reference. And there is my whole content of settings.xml:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <activeProfiles>
    <activeProfile>github</activeProfile>
  </activeProfiles>

  <profiles>
    <profile>
      <id>github</id>
      <repositories>
        <repository>
          <id>central</id>
          <url>https://repo1.maven.org/maven2</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>false</enabled></snapshots>
        </repository>
        <repository>
          <id>github</id>
          <name>GitHub OWNER Apache Maven Packages</name>
          <url>https://maven.pkg.github.com/zhuorg/maventest</url>
        </repository>
      </repositories>
    </profile>
  </profiles>

  <servers>
    <server>
      <id>github</id>
      <username>${env.USERNAME}</username>
      <password>${env.PASSWORD}</password>
    </server>
  </servers>
</settings>

Hi,

I am facing the similar problem and I have tried many solutions like using Personal Token instead of default GITHUB_TOKEN, custom settings.xml and passing -Dmaven.wagon.http.pool=false flag but none of them worked.

What I noticed is that the problem seems to be with the <executable> flag.

<configuration>
    <executable>true</executable>
</configuration>

When I comment out this then maven deploy worked successfully.