I have repository with java project and configured GitHub Actions workflow, which publishes jar into GitHub Packages maven repository.
I would like to use the published JAR package in other project, so I need to add it to
<dependency> <groupId>my.group</groupId> <artifactId>myartifact</artifactId> <version>1.0.1</version> </dependency>
I also need to add maven repository into
<repository> <id>github-me-my-repo</id> <layout>default</layout> <name>GitHub Packages Repo</name> <releases><enabled>true</enabled></releases> <snapshots><enabled>false</enabled></snapshots> <url>https://maven.pkg.github.com/me/my-repo</url> </repository>
This does not work, because when maven attempt to download artifact it failes, because request is unauthorized.
GitHub Packages help tells that I need to add my user name and token into
This probably fixes an issue.
But there is so much nonsense in this requirement.
For example, if I clone some project which rely on dependencies hosted on GitHub Packages maven repo I’ll fail to compile it. Will have to investigate what the heck is going on. Figure out that I need to register on GitHub. Then generate token. Store in in
~/.m2/settings.xml. And only then the project might compile.
On the other hand the dependency JAR could be downloaded manually via https://github.com/me/my-repo/packages, so why on earth authorization is required when downloaded via maven?
Is there any hidden setting to turn off requirement?