{"record":{"id":"33b2df7ac2e04636","repo":"apache/maven","slug":"system-artifact-is-not-a-file","errorCode":null,"errorMessage":"System artifact: {} is not a file: {}","messagePattern":"System artifact: (.+?) is not a file: (.+?)","errorType":"exception","errorClass":"ArtifactNotFoundException","httpStatus":null,"severity":"error","filePath":"compat/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java","lineNumber":168,"sourceCode":"            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();\n                artifactRequest.setArtifact(RepositoryUtils.toArtifact(artifact));\n                artifactRequest.setRepositories(RepositoryUtils.toRepos(remoteRepositories));\n\n                // Maven 2.x quirk: an artifact always points at the local repo, regardless whether resolved or not\n                LocalRepositoryManager lrm = session.getLocalRepositoryManager();","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/compat/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java#L150-L186","documentation":"The third system-scope check in resolve(): File.exists() passed but File.isFile() is false, meaning the systemPath resolves to a directory (or a symlink to one). Maven cannot place a directory on the classpath for a system dependency, so it throws ArtifactNotFoundException 'is not a file' with the offending path.","triggerScenarios":"A <systemPath> that resolves to a directory: pointing at a lib/ folder instead of the jar inside it, a path with a trailing separator, or a symlink chain that ends at a directory.","commonSituations":"Writing <systemPath>${project.basedir}/lib</systemPath> instead of lib/foo.jar; paths assembled by string concatenation that lose the file name; directory symlinks after moving a project.","solutions":["Point systemPath at the jar file itself, e.g. ${project.basedir}/lib/ojdbc8.jar, not the lib directory","Remove trailing slashes or separators from the systemPath value","Verify with ls -l using the exact path from the message, then re-run the build"],"exampleFix":"<!-- before: systemPath is a directory -->\n<systemPath>${project.basedir}/lib/</systemPath>\n<!-- after: point at the jar file inside it -->\n<systemPath>${project.basedir}/lib/ojdbc8.jar</systemPath>","handlingStrategy":"validation","validationCode":"File f = artifact.getFile();\nif (Artifact.SCOPE_SYSTEM.equals(artifact.getScope())\n        && f != null && f.exists() && !f.isFile()) {\n    // systemPath resolves to a directory: point it at the jar file\n}","typeGuard":"private static boolean systemPathIsDirectory(org.apache.maven.artifact.Artifact a) {\n    return a != null && Artifact.SCOPE_SYSTEM.equals(a.getScope())\n            && a.getFile() != null\n            && a.getFile().exists()\n            && !a.getFile().isFile();\n}","tryCatchPattern":"Catch ArtifactNotFoundException; when the message says 'is not a file', correct the systemPath to reference the jar file (not a directory) and re-run.","preventionTips":["Treat systemPath values ending in a separator as a build-breaking smell in review.","Prefer regular dependencies over system scope; jars under the project can go into a project-local repository instead."],"tags":["maven","system-scope","systempath","filesystem","directory"],"backgroundTag":"system-path-not-a-file","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}