apache/maven · warning · IllegalArgumentException

artifactId can neither be null, empty nor blank

Error message

artifactId can neither be null, empty nor blank

What it means

In the legacy wagon layer (DefaultWagonManager.get), a TransferFailedException was thrown while downloading the artifact: a transport-level failure such as authentication rejection, TLS handshake error, or unsupported protocol, not a plain 404. This branch runs when debug is enabled (-X), so the warning carries the full stack trace. The exception is retained and rethrown afterwards unless the file already exists locally, in which case the forced update is ignored.

Source

Thrown at compat/maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java:99

    public static String key(String groupId, String artifactId, String version) {
        notBlank(groupId, "groupId can neither be null, empty nor blank");
        notBlank(artifactId, "artifactId can neither be null, empty nor blank");
        notBlank(version, "version can neither be null, empty nor blank");

        return groupId + ":" + artifactId + ":" + version;
    }

    private static void notBlank(String str, String message) {
        final int strLen = str != null ? str.length() : 0;
        if (strLen > 0) {
            for (int i = 0; i < strLen; i++) {
                if (!Character.isWhitespace(str.charAt(i))) {
                    return;
                }
            }
        }
        throw new IllegalArgumentException(message);
    }

    public static Map<String, Artifact> artifactMapByVersionlessId(Collection<Artifact> artifacts) {
        Map<String, Artifact> artifactMap = new LinkedHashMap<>();

        if (artifacts != null) {
            for (Artifact artifact : artifacts) {
                artifactMap.put(versionlessKey(artifact), artifact);
            }
        }

        return artifactMap;
    }

    public static Artifact copyArtifactSafe(Artifact artifact) {
        return (artifact != null) ? copyArtifact(artifact) : null;
    }

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Read the stack trace included in the warning: the caused-by chain names the exact transport failure
  2. Fix settings.xml: the <server><id> must equal the repository id shown in the message, and the credentials must be current
  3. Test reachability outside Maven: curl -fL -u user:pass <repoUrl>/path/to/artifact
  4. If the artifact already exists in the local repository the build continues; otherwise fix the transport issue and rerun with -U

Example fix

<!-- before: server id does not match the repository id in the warning -->
<settings>
  <servers>
    <server><id>internal-repo</id><username>ci</username><password>token</password></server>
  </servers>
</settings>
<!-- after: id matches repository id 'corp-releases' -->
<settings>
  <servers>
    <server><id>corp-releases</id><username>ci</username><password>token</password></server>
  </servers>
</settings>
Defensive patterns

Strategy: retry

Validate before calling

curl -fsS -u $USER:$PASS $REPO_URL/path/to/artifact-1.0.jar -o /dev/null \
  || echo 'transport broken; fix credentials/proxy before running mvn'

Try / catch

for (int attempt = 1; attempt <= 3; attempt++) {
    try {
        resolver.resolveArtifact(session, request);   // embedder resolution API
        break;
    } catch (ArtifactTransferException e) {           // failure behind the warn
        if (attempt == 3 || !isTransient(e)) {
            throw e;                                  // give up loudly
        }
        TimeUnit.SECONDS.sleep(attempt);              // linear backoff, then retry
    }
}

Prevention

When it happens

Trigger: Downloading from a repository where settings.xml credentials are rejected (401), TLS certificates fail verification, a proxy blocks the connection, or the wagon provider for the URL scheme is missing, with -X/debug output turned on.

Common situations: Corporate Nexus/Artifactory with expired tokens; self-signed or rotated certificates; a <server> id in settings.xml that does not match the repository id; https repositories behind misconfigured corporate proxies.

Related errors


AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21). Data as JSON: /api/errors/efdafd7aad789fec. Report an issue: GitHub.