{"record":{"id":"a8d390cfc0e07ba8","repo":"apache/maven","slug":"system-artifact-not-found-in-path","errorCode":null,"errorMessage":"System artifact: {} not found in path: {}","messagePattern":"System artifact: (.+?) not found in path: (.+?)","errorType":"exception","errorClass":"ArtifactNotFoundException","httpStatus":null,"severity":"error","filePath":"compat/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java","lineNumber":163,"sourceCode":"        resolve(artifact, remoteRepositories, getSession(localRepository));\n    }\n\n    private void resolve(\n            Artifact artifact, List<ArtifactRepository> remoteRepositories, RepositorySystemSession session)\n            throws ArtifactResolutionException, ArtifactNotFoundException {\n        if (artifact == null) {\n            return;\n        }\n\n        if (Artifact.SCOPE_SYSTEM.equals(artifact.getScope())) {\n            File systemFile = artifact.getFile();\n\n            if (systemFile == null) {\n                throw new ArtifactNotFoundException(\"System artifact: \" + artifact + \" has no file attached\", artifact);\n            }\n\n            if (!systemFile.exists()) {\n                throw new ArtifactNotFoundException(\n                        \"System artifact: \" + artifact + \" not found in path: \" + systemFile, artifact);\n            }\n\n            if (!systemFile.isFile()) {\n                throw new ArtifactNotFoundException(\n                        \"System artifact: \" + artifact + \" is not a file: \" + systemFile, artifact);\n            }\n\n            artifact.setResolved(true);\n\n            return;\n        }\n\n        if (!artifact.isResolved()) {\n            ArtifactResult result;\n\n            try {\n                ArtifactRequest artifactRequest = new ArtifactRequest();","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/compat/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java#L145-L181","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Take the exact path from the message and check it: ls -l <path>","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)","On JDK 9+ remove system dependencies on JDK-internal jars (tools.jar, rt.jar) entirely - they no longer exist","Prefer installing the jar into the local/project repository and using a normal dependency"],"exampleFix":"<!-- before: hard-coded path that does not exist on CI -->\n<systemPath>/home/dev/jars/ojdbc8.jar</systemPath>\n<!-- after: jar shipped with the project, portable path -->\n<systemPath>${project.basedir}/libs/ojdbc8.jar</systemPath>","handlingStrategy":"validation","validationCode":"File f = artifact.getFile();\nif (Artifact.SCOPE_SYSTEM.equals(artifact.getScope())\n        && (f == null || !f.exists())) {\n    // fix the <systemPath> in the POM before calling resolve()\n}","typeGuard":"private static boolean systemPathMissing(org.apache.maven.artifact.Artifact a) {\n    return a != null\n            && Artifact.SCOPE_SYSTEM.equals(a.getScope())\n            && (a.getFile() == null || !a.getFile().exists());\n}","tryCatchPattern":"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.","preventionTips":["Never hard-code absolute systemPath values; use properties or project-relative paths.","Remember JDK 9+ removed tools.jar/rt.jar - system paths referencing them break on modern JDKs.","Add a CI preflight (test -f) for every systemPath declared in the POM."],"tags":["maven","system-scope","file-not-found","systempath","jdk","ci"],"backgroundTag":"system-path-file-not-found","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}