apache/maven · warning · InvalidArtifactRTException

The artifactId cannot be empty.

Error message

The artifactId cannot be empty.

What it means

After a transfer, DefaultWagonManager.cleanupTemporaryFiles deletes the temporary files used during download. File.delete() returned false, meaning the file is held or locked by another process, so Maven warns and registers deleteOnExit() as a safety net before moving on. This is cosmetic unless the temp directory fills up.

Source

Thrown at compat/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java:172

        if (classifier == null) {
            classifier = artifactHandler.getClassifier();
        }

        this.classifier = classifier;

        this.optional = optional;

        validateIdentity();
    }

    private void validateIdentity() {
        if (empty(groupId)) {
            throw new InvalidArtifactRTException(
                    groupId, artifactId, getVersion(), type, "The groupId cannot be empty.");
        }

        if (empty(artifactId)) {
            throw new InvalidArtifactRTException(
                    groupId, artifactId, getVersion(), type, "The artifactId cannot be empty.");
        }

        if (empty(type)) {
            throw new InvalidArtifactRTException(groupId, artifactId, getVersion(), type, "The type cannot be empty.");
        }

        if ((empty(version)) && (versionRange == null)) {
            throw new InvalidArtifactRTException(
                    groupId, artifactId, getVersion(), type, "The version cannot be empty.");
        }
    }

    public static boolean empty(String value) {
        return value == null || value.isBlank();
    }

    @Override

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Exclude the local repository and temp directory from antivirus real-time scanning
  2. Give each concurrent build its own repository: mvn -Dmaven.repo.local=$PWD/.repo ...
  3. Treat the warning as harmless: deleteOnExit removes the file when the JVM exits
  4. If temp files accumulate, schedule an offline cleanup of the affected directories
Defensive patterns

Strategy: fallback

Validate before calling

lsof +D ~/.m2/repository 2>/dev/null | head   # who holds local-repo files right now

Prevention

When it happens

Trigger: Another process holds the temporary file open at cleanup time: antivirus real-time scanning, a second concurrent Maven or IDE build using the same local repository, or a file indexer.

Common situations: Windows with Defender scanning ~/.m2/repository; parallel CI jobs sharing one -Dmaven.repo.local; Eclipse or IntelliJ indexing while a CLI build runs.

Related errors


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