Works locally, but on Github Actions: build can't transfer own Github hosted parent pom, receives Bad Request and 'parent.relativePath' points at wrong local POM

I’m at the moment building a project.
This project should use my parent.pom from the Github registry.

It works perfectly on my machine, even if I delete the parent-pom from my .m2 repository
Unfortunately, I always get an error when Github tries to run the tests after each push, because the parent-pom can’t be resolved.

    [ERROR] Some problems were encountered while processing the POMs:
    [FATAL] Non-resolvable parent POM for io.joergi:basics:0.0.1-SNAPSHOT: Could not 
    transfer artifact io.joergi:parent-jdk11-mongo:pom:2.3.0-1.RELEASE from/to github 
    (https://maven.pkg.github.com/joergi/parent-jdk11-mongo): Transfer failed for 
    https://maven.pkg.github.com/joergi/parent-jdk11-mongo/io/joergi/parent-jdk11-
    mongo/2.3.0-1.RELEASE/parent-jdk11-mongo-2.3.0-1.RELEASE.pom 400 Bad Request and 
    'parent.relativePath' points at wrong local POM @ line 5, column 10

The parent-pom has this definition:

  <groupId>io.joergi</groupId>
	<artifactId>parent-jdk11-mongo</artifactId>
	<version>2.3.0-1.RELEASE</version>
	<packaging>pom</packaging>
	<name>joergi.io parent-jdk11-mongo</name>

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.3.3.RELEASE</version>
		<relativePath /> <!-- lookup parent from repository -->
	</parent>

My new project use Github actions for automatic testing.
It integrates the parent pom like this:


    <parent>
		<groupId>io.joergi</groupId>
		<artifactId>parent-jdk11-mongo</artifactId>
		<version>2.3.0-1.RELEASE</version>
	</parent>

	<distributionManagement>
		<repository>
			<id>github</id>
			<name>GitHub joergi Apache Maven Packages</name>
			<url>https://maven.pkg.github.com/joergi/parent-jdk11-mongo</url>
		</repository>
	</distributionManagement>

I also have a settings.xml in the new project

  <activeProfiles>
        <activeProfile>github</activeProfile>
      </activeProfiles>
    
      <profiles>
        <profile>
          <id>github</id>
          <repositories>
            <repository>
              <id>github</id>
              <name>GitHub joergi Apache Maven Packages</name>
              <url>https://maven.pkg.github.com/joergi/parent-jdk11-mongo</url>
            </repository>
          </repositories>
        </profile>
      </profiles>
    
      <servers>
        <server>
          <id>github</id>
          <username>joergi</username>
          <password>${{ secrets.PACKAGES_READ_ONLY }}</password>
        </server>
      </servers>

The secret is in my Github secrets. If I remove or change it, I’m not authorized anymore, so this works.

Can one of you give me a hint, what is wrong

(I already posted it on StackOverflow, but no answer yet)

@joergi ,

I have created an issue ticket (actions/virtual-environments#1554) to help you report the problem the appropriate engineering team for further investigation and evaluation.

You can follow this issue ticket and add your comment to it.


In addition, you mentioned,

It works perfectly on my machine, even if I delete the parent-pom from my .m2 repository

You can try to install a self-hosted runner on your local machine to run the workflow to see if the error still occurs.

how do I start / use a self-hosted runner?
never tried it

Honestly, at the moment I’m not sure if the setting.xml uses the github secret.
because if I look into my Github tokens, I can see that it’s never used…

@joergi ,

how do I start / use a self-hosted runner?

You can see “Adding self-hosted runners” to get more details about adding self-hosted runners.
And more information about self-hosted runners, you can see “Hosting your own runners”.


Honestly, at the moment I’m not sure if the setting.xml uses the github secret.
because if I look into my Github tokens, I can see that it’s never used…

To use the GITHUB_TOKEN or a personal access token (PAT) in the setting.xml, you can try like as the following:

  • In the setting.xml file, you can set like as this.

    <settings . . .>
      . . .
      <servers>
        <server>
          <id>github</id>
          <username>USERNAME</username>
          <password>${MVN_AUTH_TOKEN}</password>
        </server>
      </servers>
    </settings>
    
  • In the workflow file, you need to map the GITHUB_TOKEN or the PAT as an environment variable.
    For example:

    - name: Publish to GitHub Packages
      run: mvn deploy -s settings.xml
      env:
        MVN_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    
1 Like

Thanks a lot.
This works.
you can close the other ticket, I guess!?

(no I have some other error, but I know how to solve it)