{"record":{"id":"8e85f4e9431ddfb2","repo":"apache/maven","slug":"system-artifact-has-no-file-attached","errorCode":null,"errorMessage":"System artifact: {} has no file attached","messagePattern":"System artifact: (.+?) has no file attached","errorType":"exception","errorClass":"ArtifactNotFoundException","httpStatus":null,"severity":"error","filePath":"compat/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java","lineNumber":159,"sourceCode":"    @Override\n    public void resolveAlways(\n            Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository)\n            throws ArtifactResolutionException, ArtifactNotFoundException {\n        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()) {","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/compat/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java#L141-L177","documentation":"DefaultArtifactResolver.resolve() shortcuts artifacts with scope 'system': no repository lookup happens, Maven uses only the file attached to the artifact (populated from <systemPath>). If that file is null, resolution fails immediately with ArtifactNotFoundException 'has no file attached'. It is a POM declaration error: the dependency declares system scope but no usable systemPath.","triggerScenarios":"Resolving a dependency declared with <scope>system</scope> whose <systemPath> is absent, empty, or whose property placeholder resolves to nothing at the time DefaultArtifactResolver.resolve(...) runs.","commonSituations":"Copy-pasted system-scope dependencies where systemPath was dropped; systemPath driven by a property defined in a profile that is not active in the current build; ${java.home}-derived paths after a JDK layout change.","solutions":["Add or fix the <systemPath> element on the system-scoped dependency so it points at the jar","Verify any property used in systemPath resolves in the running build: mvn help:evaluate -Dexpression=<prop>","Prefer replacing the system-scope dependency with a normal one (mvn install:install-file into the repository or a project-local repo) - system scope is deprecated precisely because it bypasses resolution"],"exampleFix":"<!-- before: system scope without a systemPath -->\n<dependency>\n  <groupId>com.sun</groupId>\n  <artifactId>tools</artifactId>\n  <version>1.8</version>\n  <scope>system</scope>\n</dependency>\n<!-- after: valid systemPath (or drop system scope entirely) -->\n<dependency>\n  <groupId>com.sun</groupId>\n  <artifactId>tools</artifactId>\n  <version>1.8</version>\n  <scope>system</scope>\n  <systemPath>${java.home}/../lib/tools.jar</systemPath>\n</dependency>","handlingStrategy":"validation","validationCode":"if (Artifact.SCOPE_SYSTEM.equals(artifact.getScope()) && artifact.getFile() == null) {\n    // reject before resolve(): the POM lacks a usable <systemPath>\n    throw new IllegalArgumentException(\n            \"system-scoped dependency \" + artifact + \" has no <systemPath>\");\n}","typeGuard":"private static boolean isUnattachedSystemArtifact(org.apache.maven.artifact.Artifact a) {\n    return a != null\n            && Artifact.SCOPE_SYSTEM.equals(a.getScope())\n            && a.getFile() == null; // will fail resolution with 'no file attached'\n}","tryCatchPattern":"Catch ArtifactNotFoundException; if the message says 'has no file attached', the fix is in the POM (add systemPath or drop system scope), not in repositories or retries.","preventionTips":["Avoid system scope; install the jar or serve it from a project repository instead.","When systemPath is unavoidable, derive it from ${java.home} or ${project.basedir} and assert the property resolves.","Inspect mvn help:effective-pom to see the final systemPath before building."],"tags":["maven","system-scope","dependency","pom","systempath"],"backgroundTag":"system-scope-path-missing","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}