{"record":{"id":"60cc6921ea46cf79","repo":"elastic/elasticsearch","slug":"can-t-export-resourcepath-from-build-tools-n","errorCode":null,"errorMessage":"Can't export `${resourcePath}` from build-tools: not found","messagePattern":"Can't export `(.+?)` from build-tools: not found","errorType":"exception","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ExportElasticsearchBuildResourcesTask.java","lineNumber":109,"sourceCode":"            );\n        }\n        resources.put(resource, destName);\n    }\n\n    @TaskAction\n    public void doExport() {\n        if (resources.isEmpty()) {\n            setDidWork(false);\n            throw new StopExecutionException();\n        }\n        resources.entrySet().stream().parallel().forEach(entry -> {\n            String resourcePath = entry.getKey();\n            String destName = entry.getValue();\n            Path destination = outputDir.get().file(destName).getAsFile().toPath();\n            try (InputStream is = getClass().getClassLoader().getResourceAsStream(resourcePath)) {\n                Files.createDirectories(destination.getParent());\n                if (is == null) {\n                    throw new GradleException(\"Can't export `\" + resourcePath + \"` from build-tools: not found\");\n                }\n                Files.copy(is, destination, StandardCopyOption.REPLACE_EXISTING);\n            } catch (IOException e) {\n                throw new GradleException(\"Can't write resource `\" + resourcePath + \"` to \" + destination, e);\n            }\n        });\n    }\n\n}\n","sourceCodeStart":91,"sourceCodeEnd":119,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ExportElasticsearchBuildResourcesTask.java#L91-L119","documentation":"Thrown by ExportElasticsearchBuildResourcesTask.doExport when getClass().getClassLoader().getResourceAsStream(resourcePath) returns null - the requested resource is not present on the build-tools classpath. The task exports classpath resources to an output directory at execution time.","triggerScenarios":"Calling copy('some/path') with a resource path that does not exist under build-tools' src/main/resources, or one that was not packaged into the build-tools jar.","commonSituations":"Resource name typo (wrong case, stray leading slash, wrong extension); resource lives in a different module; resource file deleted but copy() call not updated.","solutions":["Verify the resource path exists under build-tools/src/main/resources.","Remove any leading slash and match the exact case and extension.","Rebuild the build-tools jar so the resource is packaged.","If the resource moved modules, update the copy() call to the new location or move the resource back."],"exampleFix":"// before\nexportTask.copy('/META-INF/license.txt')\n// after\nexportTask.copy('META-INF/license.txt')","handlingStrategy":"validation","validationCode":"if (getClass().getClassLoader().getResource(resourcePath) == null) {\n    throw new GradleException(\"Can't export `\" + resourcePath + \"` from build-tools: not found\");\n}","typeGuard":null,"tryCatchPattern":"try (InputStream is = getClass().getClassLoader().getResourceAsStream(resourcePath)) {\n    if (is == null) throw new GradleException(\"resource not found: \" + resourcePath);\n    Files.copy(is, destination, StandardCopyOption.REPLACE_EXISTING);\n} catch (IOException e) {\n    throw new GradleException(\"Can't write resource `\" + resourcePath + \"` to \" + destination, e);\n}","preventionTips":["Confirm every resource path passed to copy() exists under build-tools/src/main/resources.","Avoid leading slashes in resource paths; match case and extension exactly.","Rebuild the build-tools jar after adding or renaming resources."],"tags":["gradle","resources","classpath","build-tools"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}