0

I would like to use GitHub Actions to build and publish a Java application with Maven. The simple constellation is already working. A repository (lets Call it repo A) in GitHub including GitHub Actions:

  • build the Java application
  • push it to GitHub Packages

Now I would like to extend it a little bit. I want to build a second Java application (App B) and want to use the jar Artifact from Java-App A. So I include the jar in my POM.

<dependencies>
    <dependency>
        <groupId>my_group</groupId>
        <artifactId>Artifact_A</artifactId>
        <version>1.0.0</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

I also added the corresponding GitHub repository to my POM.

<repository>
    <id>github</id>
    <name>GitHub Packages</name>
    <url>https://maven.pkg.github.com/my_org/repository_A</url>
</repository>

My local build is OK, therefore I added all necessary information to my settings.xml But if I perform the build with GitHUb Actions I get a 401 error.

Error:  Failed to execute goal on project app_b: Could not resolve dependencies for project app_b:jar:1.0-SNAPSHOT: Failed to collect dependencies at Artifact_A:jar:1.0.0: Failed to read artifact descriptor for Artifact_A:jar:1.0.0: Could not transfer artifact Artifact_A:jar:1.0.0 from/to bicm (https://maven.pkg.github.com/my_org/repository_A): Authentication failed for https://maven.pkg.github.com/my_org/repository_A/Artifact_A/1.0.0/Artifact_A-1.0.0.pom 401 Unauthorized -> [Help 1]

Is it possible to access the packages of another repository and if yes, what do I have to do to make it work?

LStrike
  • 1,598
  • 4
  • 26
  • 58

0 Answers0