Maven + GitHub Packages
Stage 1 — Configure Maven access to GitHub Packages
How to complete this stage
Configure Maven so it can authenticate to GitHub Packages and resolve private IA dependencies during builds.
Approach and rationale
Several IA components are published as private Maven packages on GitHub. Maven must be able to authenticate to GitHub Packages or the builds in later stages will fail. Completing this stage up front avoids hard-to-diagnose dependency errors later in the process.
1.1 Locate or create Maven settings
Locate (or create) this file:
If the .m2 directory does not exist then create it as follows:
1.2 Add GitHub Packages Credentials
Edit ~/.m2/settings.xml and ensure it contains a server entry configured as follows:
- id must be set to
github - username must be your GitHub username or email
(use the value your organisation expects; many setups accept email) - password must be your GitHub Personal Access Token (PAT)
Use this template:
<settings>
<servers>
<server>
<id>github</id>
<username>YOUR_GITHUB_USERNAME_OR_EMAIL</username>
<password>YOUR_GITHUB_PAT</password>
</server>
</servers>
</settings>
Operational Notes
- Keep the
github exactly as shown. Maven uses this identifier to match credentials to repositories defined in POMs/settings. - If your PAT expires or is rotated, you must update settings.xml.
1.3 Checkpoint
At the end of this stage:
- Maven can authenticate to GitHub Packages
- Private dependencies resolve during mvn clean install
- No 401 or 403 errors occur during dependency resolution
If Maven cannot resolve private dependencies, re-check credentials in settings.xml before continuing.