apache/maven · error · ResourceDoesNotExistException

Unable to download the artifact from any repository

Error message

Unable to download the artifact from any repository

What it means

Final verdict of the legacy multi-repository getArtifact(): Maven iterated every configured remote repository, ResourceDoesNotExistException from each was swallowed (logged at debug), no TransferFailedException was recorded, and the file still does not exist locally - so it throws ResourceDoesNotExistException 'Unable to download the artifact from any repository'. In contrast to the cached variants, each repository was actually checked and answered 'not found'.

Source

Thrown at compat/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java:204

                tfe = e;

                String msg = "Unable to get artifact " + artifact.getId() + " from repository " + repository.getId()
                        + " (" + repository.getUrl() + "): " + e.getMessage();

                if (logger.isDebugEnabled()) {
                    logger.warn(msg, e);
                } else {
                    logger.warn(msg);
                }
            }
        }

        // if it already exists locally we were just trying to force it - ignore the update
        if (!artifact.getFile().exists()) {
            if (tfe != null) {
                throw tfe;
            } else {
                throw new ResourceDoesNotExistException("Unable to download the artifact from any repository");
            }
        }
    }

    @Override
    public void getArtifactMetadata(
            ArtifactMetadata metadata, ArtifactRepository repository, File destination, String checksumPolicy)
            throws TransferFailedException, ResourceDoesNotExistException {
        String remotePath = repository.pathOfRemoteRepositoryMetadata(metadata);

        getRemoteFile(repository, destination, remotePath, null, checksumPolicy, true);
    }

    @Override
    public void getArtifactMetadataFromDeploymentRepository(
            ArtifactMetadata metadata, ArtifactRepository repository, File destination, String checksumPolicy)
            throws TransferFailedException, ResourceDoesNotExistException {
        String remotePath = repository.pathOfRemoteRepositoryMetadata(metadata);

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Verify the exact coordinates (groupId:artifactId:version:packaging:classifier) against the repository (search Nexus/Central web UI)
  2. Add the repository that actually hosts the artifact to the POM or settings.xml, and exempt it from mirrorOf 'catch-alls'
  3. Check the repository policy: a snapshots-only repo cannot serve releases and vice versa
  4. Confirm the artifact was actually deployed (CI deploy job succeeded) and re-check version spelling including -SNAPSHOT suffixes
  5. Run with -e -X to see every repository URL that was tried and each 404 path

Example fix

# before: repo hosting artifact not declared
<dependency><groupId>com.corp</groupId><artifactId>lib</artifactId><version>1.2</version></dependency>
# after: declare (or mirror-exempt) the hosting repo
<repositories>
  <repository>
    <id>corp-releases</id><url>https://nexus.corp.example/releases</url>
  </repository>
</repositories>
# plus settings.xml mirror: <mirrorOf>*,!corp-releases</mirrorOf>
Defensive patterns

Strategy: try-catch

Validate before calling

// Before resolving, confirm each coordinate exists in at least one configured repo
// for (repo : repos) { if (exists(repo.url + '/' + groupPath + '/' + artifactId + '/' + version)) ok; }

Try / catch

catch (org.apache.maven.wagon.ResourceDoesNotExistException e) {
    if ("Unable to download the artifact from any repository".equals(e.getMessage())) {
        // every repo said 404: verify coordinates/repos/policies; run -X to list tried URLs
    }
}

Prevention

When it happens

Trigger: getArtifact(artifact, remoteRepositories, monitor, force) where every repository either has the repo disabled for the artifact policy, misses the artifact path (404), or is skipped, and the local file is absent; no hard transfer error occurred anywhere.

Common situations: Wrong groupId/artifactId/version (typo, uncommitted version bump); artifact deployed to a private repo not in the build's repository list; releases policy disabled where a release is sought (or vice versa); mirrors absorbing all traffic without hosting the artifact; dependencies on a coworker's local-only artifact.

Related errors


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