Java, Maven and Gradle
Set up Maven
Point mvn at the ForgeRepo™ Maven repository with a mirror in settings.xml.
The ForgeRepo™ Maven repository is at https://packages.example.com/maven/. Add it as a mirror in ~/.m2/settings.xml, with your token as the password:
$ cat ~/.m2/settings.xml <settings> <servers> <server> <id>company</id> <username>your-user-name</username> <password>${env.REPO_TOKEN}</password> </server> </servers> <mirrors> <mirror> <id>company</id> <mirrorOf>*</mirrorOf> <url>https://packages.example.com/maven/</url> </mirror> </mirrors> </settings>
Captured by running these commands against a real ForgeRepo™.
mirrorOf *sends every download through packages.example.com, Maven Central and plugins included, so nothing skips the checks.- The
serverid has to match themirrorid. That is how Maven knows which password to send. ${env.REPO_TOKEN}is read from the environment, so the token never goes into the file.
Then build as usual:
$ mvn -B -q package -DskipTests && ls target/*.jar target/orders-1.0.jar $ ls ~/.m2/repository/com/fasterxml/jackson/core/jackson-databind/*/*.jar /root/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.17.3/jackson-databind-2.17.3.jar
Captured by running these commands against a real ForgeRepo™.