fix: set JAVA_TOOL_OPTIONS and generate Maven settings.xml for JVM proxy#963
fix: set JAVA_TOOL_OPTIONS and generate Maven settings.xml for JVM proxy#963
Conversation
Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
|
Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded. |
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
Bun Build Test Results
Overall: PASS All Bun build tests passed successfully.
|
Node.js Build Test Results
Overall: PASS ✅ All projects installed successfully and passed their test suites.
|
C++ Build Test Results
Overall: PASS ✅ All C++ projects built successfully.
|
.NET Build Test Results
Overall: PASS All .NET projects restored, built, and ran successfully.
|
Smoke Test Results (Copilot)Last 2 Merged PRs:
Test Results:
Status: PASS cc
|
Build Test: Deno - Results
Overall: ✅ PASS All Deno tests passed successfully.
|
There was a problem hiding this comment.
Pull request overview
This PR fixes Java builds failing in AWF by configuring JVM proxy settings. The root cause was that Java/JVM tools don't read standard HTTP_PROXY/HTTPS_PROXY environment variables. The solution sets JAVA_TOOL_OPTIONS with JVM system properties for proxy configuration and auto-generates Maven's settings.xml file.
Changes:
- Automatically sets
JAVA_TOOL_OPTIONSenvironment variable in agent container with JVM proxy system properties - Auto-generates
~/.m2/settings.xmlwith Maven proxy configuration during container entrypoint - Updates documentation to reflect these features are now automatic
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/docker-manager.ts | Adds JAVA_TOOL_OPTIONS environment variable with JVM proxy system properties (-Dhttp.proxyHost, -Dhttp.proxyPort, etc.) |
| src/docker-manager.test.ts | Adds test coverage for JAVA_TOOL_OPTIONS environment variable presence and content |
| containers/agent/entrypoint.sh | Auto-generates Maven settings.xml with proxy configuration if SQUID_PROXY_HOST/PORT are set |
| docs/troubleshooting.md | Updates Java proxy documentation to indicate JAVA_TOOL_OPTIONS and Maven settings.xml are now generated automatically |
| .github/workflows/build-test-java.md | Removes manual Maven proxy setup instructions since it's now automatic |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Generate Maven settings.xml with proxy configuration | ||
| # Maven ignores JAVA_TOOL_OPTIONS and HTTP_PROXY; it requires ~/.m2/settings.xml | ||
| if [ -n "$SQUID_PROXY_HOST" ] && [ -n "$SQUID_PROXY_PORT" ]; then | ||
| MAVEN_DIR="$(eval echo ~awfuser)/.m2" |
There was a problem hiding this comment.
The MAVEN_DIR should use $HOME instead of ~awfuser, and needs chroot mode handling. The HOME environment variable is set to the real user's home directory (via getRealUserHome() in docker-manager.ts, e.g., /home/runner on GitHub Actions), not /home/awfuser. Maven will look for settings.xml in $HOME/.m2/, not /home/awfuser/.m2/.
Additionally, in chroot mode, the file must be created at /host$HOME/.m2/settings.xml to be accessible after the chroot transition, following the same pattern as Claude Code configuration (lines 130-134).
Replace line 173 with:
if [ "${AWF_CHROOT_ENABLED}" = "true" ]; then
MAVEN_DIR="/host$HOME/.m2"
else
MAVEN_DIR="$HOME/.m2"
fi| MAVEN_DIR="$(eval echo ~awfuser)/.m2" | |
| if [ "${AWF_CHROOT_ENABLED}" = "true" ]; then | |
| MAVEN_DIR="/host$HOME/.m2" | |
| else | |
| MAVEN_DIR="$HOME/.m2" | |
| fi |
Build Test: Java - FAILED ❌Test Results
Overall: FAILED Error Detailsgson compilation failed with network connectivity issue: Root CauseThe firewall is blocking access to Required ActionThe workflow needs to include Test Environment
Note: Maven settings.xml proxy configuration is not needed when JAVA_TOOL_OPTIONS is set (JVM reads proxy settings directly).
|
|
Smoke Test Results - Claude ✅ GitHub MCP: Last 2 merged PRs retrieved
✅ Playwright: Navigated to github.com (page title verified) Status: PASS
|
Build Test: Rust ✅
Overall: PASS All Rust projects built and tested successfully.
|
|
PRs: feat: update agentic workflows to v0.47.0 and add smoke-gemini; Add macOS binary support (Darwin x64 and ARM64)
|
Chroot Version Comparison Test Results
Overall Result: Tests FAILED (not all runtimes matched) The chroot mode successfully accessed host binaries, but version mismatches were detected for Python and Node.js. This is expected behavior - the test validates that chroot mode uses host binaries transparently.
|
All Java builds (0/10) fail because JVM ignores
HTTP_PROXY/HTTPS_PROXY. The docs claimedJAVA_TOOL_OPTIONSwas set automatically — it wasn't.Changes
src/docker-manager.ts— SetJAVA_TOOL_OPTIONSin agent container environment:containers/agent/entrypoint.sh— Auto-generate~/.m2/settings.xmlwith proxy config (Maven ignores bothHTTP_PROXYandJAVA_TOOL_OPTIONS). Skips if file already exists.docs/troubleshooting.md— Updated to reflect both are now automatic.github/workflows/build-test-java.md— Removed manual Maven proxy setup instructionssrc/docker-manager.test.ts— Test forJAVA_TOOL_OPTIONSpresence and contentOriginal prompt
This section details on the original issue you should resolve
<issue_title>Java builds fail 0/10: Maven Central and Gradle Plugin Portal unreachable through Squid proxy</issue_title>
<issue_description>## Summary
In the AWF Build/Test Experiment v3 (Feb 17, 2026) using gh-aw v0.45.2 and AWF v0.19.1, all 10 Java repos failed to build despite the
javaecosystem domain allowlist includingrepo1.maven.org,repo.maven.apache.org,plugins.gradle.org,services.gradle.org, etc.The chroot binary interception issue (#711) is now fully resolved —
java,javac,gradle, andmvnall execute correctly inside the container. The failure is purely dependency resolution through the Squid proxy.Symptoms
Maven repos (gson, guava, jackson-databind, mapstruct, mybatis-3):
Could not resolve dependencies/Could not transfer artifact from/to centralrepo1.maven.org) returns connection errors through the proxyGradle repos (caffeine, mockito, okhttp, resilience4j, retrofit):
Could not resolve plugin/ Gradle wrapper download fails withSocketExceptionplugins.gradle.org/plugins-artifacts.gradle.orgfailservices.gradle.orgfailsDomains Already in Allowlist
The
javaecosystem already includes:repo1.maven.org,repo.maven.apache.org(Maven Central)plugins.gradle.org,services.gradle.org,plugins-artifacts.gradle.org,gradle.orgjcenter.bintray.com,maven.pkg.github.com,maven.oracle.comRoot Cause Hypothesis
Since the domains ARE in the allowlist, possible causes:
downloads.gradle-dn.com, Sonatype CDN) not in the allowlistImpact
Experiment Context
Comments on the Issue (you are @copilot in this section)
@Mossaka ## Root Cause Found: JVM Proxy Configuration GapAfter deeper investigation, the issue is NOT missing domains — it's that Java/JVM does not read
HTTP_PROXY/HTTPS_PROXYenvironment variables.The Problem
AWF sets
HTTP_PROXY,HTTPS_PROXY,SQUID_PROXY_HOST,SQUID_PROXY_PORTin the agent container environment. However:-Dhttp.proxyHost,-Dhttps.proxyHost) instead~/.m2/settings.xmlwith proxy configuration, even beyond JVM system propertiesHTTP_PROXY— it usesgradle.propertiesor JVM argsThe AWF troubleshooting docs mention
JAVA_TOOL_OPTIONSshould be set automatically, but the actual code insrc/docker-manager.ts(around line 342) only setsHTTP_PROXY,HTTPS_PROXY,SQUID_PROXY_HOST,SQUID_PROXY_PORT— noJAVA_TOOL_OPTIONS.Evidence
Firewall logs from the failed runs showed zero requests to Maven/Gradle domains — traffic never even reached the Squid proxy because the JVM didn't know about it.
Fix Verification
When the Copilot agent was instructed to manually set:
JAVA_TOOL_OPTIONS="-Dhttp.proxyHost=$SQUID_PROXY_HOST -Dhttp.proxyPort=$SQUID_PROXY_PORT -Dhttps.proxyHost=$SQUID_PROXY_HOST -Dhttps.proxyPort=$SQUID_PROXY_PORT"~/.m2/settings.xmlwith proxy configurationResults improved from 0/10 to 5/10 builds succeeding:
maven.google.comdl.google.comdl.google.com(680 blocked requests)Proposed Fix
AWF's
docker-manager.tsshould automatically setJAVA_TOOL_OPTIONSwith proxy configuration whenSQUID_PROXY_HOST/SQUID_PROXY_PORTare available: