What you see
[ERROR] Failed to execute goal on project app: Could not resolve dependencies for project com.acme:app:jar:1.0.0:
[ERROR] Could not transfer artifact org.springframework:spring-core:jar:6.2.0 from/to central (https://repo.maven.apache.org/maven2): Connection resetCommon causes
- Transient network problems between the runner and Maven Central.
- Many parallel builds downloading at once from shared addresses.
- Proxies that cut long-running downloads.
How to fix it
- 01
Retry transfers
Maven 3.9 uses a resolver transport with configurable retries.
.mvn/maven.config -Daether.connector.http.retryHandler.count=5 -Daether.connector.requestTimeout=120000 - 02
Cache the local repository
Persist ~/.m2/repository between builds with your CI cache.
.github/workflows/ci.yml - uses: actions/setup-java@v4 with: distribution: temurin java-version: 21 cache: maven - 03
Mirror Central through a regional cache
One settings.xml entry routes every artifact through the cache.
.mvn/settings.xml <mirror> <id>cacheport</id> <mirrorOf>*</mirrorOf> <url>https://acme.cacheport.cc/maven/</url> </mirror>