apache/maven · error · ArtifactNotFoundException

System artifact: {} not found in path: {}

Error message

System artifact: {} not found in path: {}

What it means

For a system-scoped dependency, resolve() requires that the file from <systemPath> exists on disk; File.exists() false throws ArtifactNotFoundException with 'not found in path' followed by the exact resolved path Maven looked at. This is a filesystem mismatch between the POM and the machine running the build.

Source

Thrown at compat/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java:163

        resolve(artifact, remoteRepositories, getSession(localRepository));
    }

    private void resolve(
            Artifact artifact, List<ArtifactRepository> remoteRepositories, RepositorySystemSession session)
            throws ArtifactResolutionException, ArtifactNotFoundException {
        if (artifact == null) {
            return;
        }

        if (Artifact.SCOPE_SYSTEM.equals(artifact.getScope())) {
            File systemFile = artifact.getFile();

            if (systemFile == null) {
                throw new ArtifactNotFoundException("System artifact: " + artifact + " has no file attached", artifact);
            }

            if (!systemFile.exists()) {
                throw new ArtifactNotFoundException(
                        "System artifact: " + artifact + " not found in path: " + systemFile, artifact);
            }

            if (!systemFile.isFile()) {
                throw new ArtifactNotFoundException(
                        "System artifact: " + artifact + " is not a file: " + systemFile, artifact);
            }

            artifact.setResolved(true);

            return;
        }

        if (!artifact.isResolved()) {
            ArtifactResult result;

            try {
                ArtifactRequest artifactRequest = new ArtifactRequest();

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Take the exact path from the message and check it: ls -l <path>
  2. Fix the path: correct typos, use ${java.home}-style portable expressions, or point at a jar committed under the project (${project.basedir}/libs/foo.jar)
  3. On JDK 9+ remove system dependencies on JDK-internal jars (tools.jar, rt.jar) entirely - they no longer exist
  4. Prefer installing the jar into the local/project repository and using a normal dependency

Example fix

<!-- before: hard-coded path that does not exist on CI -->
<systemPath>/home/dev/jars/ojdbc8.jar</systemPath>
<!-- after: jar shipped with the project, portable path -->
<systemPath>${project.basedir}/libs/ojdbc8.jar</systemPath>
Defensive patterns

Strategy: validation

Validate before calling

File f = artifact.getFile();
if (Artifact.SCOPE_SYSTEM.equals(artifact.getScope())
        && (f == null || !f.exists())) {
    // fix the <systemPath> in the POM before calling resolve()
}

Type guard

private static boolean systemPathMissing(org.apache.maven.artifact.Artifact a) {
    return a != null
            && Artifact.SCOPE_SYSTEM.equals(a.getScope())
            && (a.getFile() == null || !a.getFile().exists());
}

Try / catch

Catch ArtifactNotFoundException; extract the path after 'not found in path:' from the message and verify it on the machine that ran the build - the mismatch is between the POM and that host's filesystem.

Prevention

When it happens

Trigger: Resolving a system-scoped artifact whose systemPath points to a non-existent file: a hardcoded absolute path from another machine, a property resolving differently (JDK layout change), or a file simply absent on the CI agent.

Common situations: tools.jar referenced on JDK 9+ where it no longer exists; ${basedir} relative paths broken after a module move; a path valid on the developer's machine but different on CI; JDK from a distro package with a different layout.

Related errors


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