Issue with Running Java Maven Tests in Codex - Dependency Resolution Failure

Hello,

I’m encountering an issue when trying to run tests for my Java Maven project in Codex. Every time I attempt to execute the tests, I receive the following error message:

:cross_mark: ./mvnw -q test
(failed to resolve dependencies)

Despite having granted the environment and agent access to the internet, the Maven test step fails when trying to download the spring-boot-starter-parent dependency from Maven Central.

I am a ChatGPT Plus user, and my environment is not running locally or behind a corporate network, so there shouldn’t be any network restrictions that would prevent dependencies from being resolved.

Has anyone experienced a similar issue or can provide guidance on how to resolve this? I’m using Maven in a typical setup with the required dependencies specified in the pom.xml, and I can’t figure out why Codex is unable to resolve them.

Any help would be greatly appreciated!

Thank you in advance.

2 Likes

Go to your environment and add this as a setup script:


#!/usr/bin/env bash
set -euxo pipefail     # fail hard, fail fast, print everything

# 1. System update & required packages
apt-get update -qq
apt-get install -yqq maven

# 2. Verify the install (good for debugging)
mvn   -v

# 3. Configure Maven to use the Codex proxy
mkdir -p ~/.m2
cat > ~/.m2/settings.xml <<'EOF'
<settings>
  <proxies>
    <proxy>
      <id>codexProxy</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>proxy</host>
      <port>8080</port>
    </proxy>
  </proxies>
</settings>
EOF

# 4. Pre-download all project dependencies while the network is still up
#    Replace “pom.xml” with the path to your own POM if needed
mvn --batch-mode dependency:go-offline

1 Like