This repo reproduces a proxy-auth problem with Maven 3.9.x (Aether HttpTransporter)
when using a Squid proxy that requires Basic authentication.
- Docker Desktop (Windows)
docker composeavailable in PATH
docker compose up -ddocker exec -it mvn3911 bash -lc "
apt-get update >/dev/null 2>&1 || true &&
apt-get install -y curl >/dev/null 2>&1 || true &&
curl -I -x http://artifact:artifact@squid-test:3128 https://repo.maven.apache.org/maven2/ | head -n 30"Expected: HTTP/1.1 200 (or 3xx) and no 407.
To reliably reproduce the issue, Maven must download artifacts through the proxy. After every test run, the Maven local repository must be cleaned so cached artifacts do not hide the problem.
docker compose down -v
docker compose up -ddocker exec -it mvn3911 bash -lc "rm -rf /root/.m2/repository/*"You must do this: before the failing multithread run and again before the single-thread workaround run Otherwise Maven may reuse cached artifacts and bypass the proxy.
This is required so Maven is forced to download artifacts through the proxy.
Run Maven with debug and force update using the provided settings:
docker exec -it mvn3911 bash -lc "
cd /work &&
mvn -U -X -B -Dstyle.color=never -s /work/settings.xml clean verify 2>&1 | tee /work/maven-proxy.log"Expected: build fails with 407 Proxy Authentication Required. In Squid log you may see requests with ProxyAuth:- (missing header) before auth succeeds.
Limit Maven artifact resolver threads:
docker exec -it mvn3911 bash -lc "
cd /work &&
mvn -U -X -B -Dstyle.color=never -Dmaven.artifact.threads=1 -s /work/settings.xml clean verify 2>&1 | tee /work/maven-proxy-threads1.log"Expected: build succeeds (or the 407 disappears).
maven-proxy.log — FAIL run (multithread)
maven-proxy-threads1.log — PASS run (single thread)
maven-multithread.log
maven-singlethread.log
docker exec -it squid-test bash -lc 'tail -n 200 /var/log/squid/access.log'docker compose down -v