Skip to content

Maven

Maven CI on GitHub Actions

Maven downloads the internet on every run.

150s → 4s
Dependency download
10m → 3m
Build

Maven downloads the internet on every run.

Why it happens

~/.m2/repository is empty on a fresh runner, so every dependency and plugin is fetched again.

What to change

  1. Cache ~/.m2/repository keyed on all pom.xml files
  2. Build with -T 1C to use one thread per core
  3. Use -o offline mode once the cache is warm to skip metadata checks
  4. Add -B -ntp to cut log noise and transfer-progress overhead

Maven on runnerhut

yaml
jobs:
build:
runs-on: runnerhut-8vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with: { java-version: '21', distribution: temurin, cache: maven }
- run: ./mvnw -B -ntp -T 1C verify
A working starting point

The only runnerhut-specific line is `runs-on: runnerhut-8vcpu-ubuntu-2404`. Everything else is standard GitHub Actions — the same actions, the same secrets and the same permissions model you use today.

Your next build could be twice as fast, at half the price

Start free. Migrating away is the same one line, and we publish that diff too.