Maven Authentication Guide: Difference between revisions
Jump to navigation
Jump to search
JohnyMuffin (talk | contribs) (Created page with "__NOTOC__ = Adding GitHub Credentials to Maven = == Purpose == This guide is intended for '''RetroMC developers''' who need to configure their '''local development environments''' to access '''private RetroMC artifacts''' published via '''GitHub Packages'''. These credentials allow Maven to authenticate against GitHub in order to: * Download private RetroMC dependencies * Publish internal artifacts where required * Build and test RetroMC projects locally without authe...") |
JohnyMuffin (talk | contribs) No edit summary |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
[[Category:Server internals]] [[Category:Guides]] [[Category:Developing]] | |||
__NOTOC__ | __NOTOC__ | ||
= Adding GitHub Credentials to Maven = | = Adding GitHub Credentials to Maven = | ||
| Line 4: | Line 5: | ||
== Purpose == | == Purpose == | ||
This guide is intended for '''RetroMC developers''' who need to configure their '''local development environments''' to access '''private RetroMC artifacts''' published via ''' | This guide is intended for '''RetroMC developers''' who need to configure their '''local development environments''' to access '''private RetroMC artifacts''' published via '''our SonaType RetroMC mirror'''. | ||
These credentials allow Maven to authenticate against GitHub in order to: | These credentials allow Maven to authenticate against GitHub in order to: | ||
| Line 14: | Line 15: | ||
== Prerequisites == | == Prerequisites == | ||
* A | * A RetroMC Sonatype developer account (Requested from JohnyMuffin) | ||
* Access to the relevant GitHub organisation/repositories | * Access to the relevant GitHub organisation/repositories | ||
* Maven installed locally | * Maven installed locally | ||
== Step 1 | == Step 1: Add the SonaType credentials to Maven == | ||
Open (or create) the following file: | Open (or create) the following file: | ||
| Line 83: | Line 39: | ||
<servers> | <servers> | ||
<server> | <server> | ||
<id> | <id>johnymuffin-nexus-retromc</id> | ||
<username> | <username>YOUR_SONATYPE_USERNAME</username> | ||
<password> | <password>YOUR_SONATYPE_PASSWORDE</password> | ||
</server> | </server> | ||
</servers> | </servers> | ||
| Line 96: | Line 52: | ||
Replace: | Replace: | ||
* <code> | * <code>YOUR_SONATYPE_USERNAME</code> with your Legacy Minecraft Sonatype Nexus Repository username | ||
* <code> | * <code>YOUR_SONATYPE_PASSWORDE</code> with the Legacy Minecraft Sonatype Nexus Repository token | ||
[[File:Maven4.png|800px|center|Maven settings.xml configuration]] | [[File:Maven4.png|800px|center|Maven settings.xml configuration]] | ||
== Step | == Step 2: Verify == | ||
You should now be able to: | You should now be able to: | ||
* Deploy artifacts to | * Deploy artifacts to Sonatype | ||
* Download packages from private repositories | * Download packages from private repositories | ||
* Run Maven builds without authentication errors | * Run Maven builds without authentication errors | ||
Latest revision as of 02:26, 5 January 2026
Adding GitHub Credentials to Maven
Purpose
This guide is intended for RetroMC developers who need to configure their local development environments to access private RetroMC artifacts published via our SonaType RetroMC mirror.
These credentials allow Maven to authenticate against GitHub in order to:
- Download private RetroMC dependencies
- Publish internal artifacts where required
- Build and test RetroMC projects locally without authentication errors
This setup is required for local development on projects that depend on private RetroMC packages.
Prerequisites
- A RetroMC Sonatype developer account (Requested from JohnyMuffin)
- Access to the relevant GitHub organisation/repositories
- Maven installed locally
Step 1: Add the SonaType credentials to Maven
Open (or create) the following file:
~/.m2/settings.xml
On Windows, this is typically:
C:\Users\<your-username>\.m2\settings.xml
Add the following configuration:
<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>johnymuffin-nexus-retromc</id>
<username>YOUR_SONATYPE_USERNAME</username>
<password>YOUR_SONATYPE_PASSWORDE</password>
</server>
</servers>
</settings>
Replace:
YOUR_SONATYPE_USERNAMEwith your Legacy Minecraft Sonatype Nexus Repository usernameYOUR_SONATYPE_PASSWORDEwith the Legacy Minecraft Sonatype Nexus Repository token

Step 2: Verify
You should now be able to:
- Deploy artifacts to Sonatype
- Download packages from private repositories
- Run Maven builds without authentication errors
If authentication fails:
- Confirm the
<id>matches your repository id - Ensure the token includes
read:packagesandwrite:packages - Ensure you have access to the desired repository on GitHub
- Check the token has not expired
Security Notes
- Never commit
settings.xmlto Git - Do not share tokens in screenshots, logs, or chat
- Revoke tokens immediately if exposed