Skip to content

when I deploy a project that contains a maven dependency of GitHub Packages. I get 401. #432

@yaoqiangpersonal

Description

@yaoqiangpersonal

Description:
I push a maven project to GitHub packages. I use default settings.xml. but it doesn't work. I have to add the GitHub profile to setting.xml and activate it. then it works well.

Task version:
actions/setup-java@v3

Platform:
Ubuntu

Repro steps:
Error: Non-resolvable import POM: Could not transfer artifact xxx from/to bom (https://maven.pkg.github.com/xxx/*): authentication failed for xxxxx, status: 401 Unauthorized @ line 56, column 16

Expected behavior:
I don't need to set settings. xml for each project

Actual behavior:
I have to set a custom settings.xml like this:

<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 https://maven.apache.org/xsd/settings-1.0.0.xsd">
	<servers>
		<server>
			<id>github</id>
			<username>${env.GITHUB_ACTOR}</username>
			<password>${env.GITHUB_TOKEN}</password>
		</server>
		<server>
			<id>gpg.passphrase</id>
			<passphrase>${env.GPG_PASSPHRASE}</passphrase>
		</server>
	</servers>
	<profiles>
		<profile>
			<id>github</id>
			<repositories>
				<repository>
					<id>github</id>
					<name>GitHub Apache Maven Packages</name>
					<url>https://maven.pkg.github.com/xxxxx/*</url>
				</repository>
			</repositories>
		</profile>
	</profiles>
	<activeProfiles>
		<activeProfile>github</activeProfile>
	</activeProfiles>
</settings>

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions