Replies: 4 comments 2 replies
-
|
Hey @blackears, I get what you’re running into. Even if your Maven package is public, GitHub Packages often requires some form of authentication, which is why users might see unauthorized errors. Usually, they need a personal access token (PAT) with the Make sure your package is set to public in the repository settings, and check that users have the correct repository URL in their If users are still having trouble, sharing the exact error message can help pinpoint what’s going wrong. |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
TL;DR
When publishing Java artifacts to GitHub Packages, there are two important things to know up front:
What you can do
# ~/.gradle/gradle.properties
gpr.user=USERNAME
gpr.key=YOUR_GITHUB_PATAnd in repositories {
maven {
url = uri("https://maven.pkg.github.com/OWNER/REPO")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
}
}
}
If you want true public access (no tokens required), the standard practice in the Java ecosystem is to deploy to Maven Central.
Some projects keep their "source of truth" on GitHub Packages but add a CI job that republishes to Maven Central. This way, casual users get easy access from Central while you keep GitHub Packages for internal/dev builds. Why GitHub hasn't changed thisGitHub has been consistent since ~2020: authentication is required for |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
I recently went through the process of creating and publishing a Maven package for an old Java project using Github. I had thought that once I published the project that this would be enough, but a user is saying that they're getting an unauthorized error when they try to include it in their Gradle build:
blackears/svgSalamander#111
I came across an old thread from 2020 that said that Github was not allowing Maven packages to be publicly referenced, but was wondering if anything had changed? Is there a way to allow unauthenticated public users to access my package?
Beta Was this translation helpful? Give feedback.
All reactions