quarkusio/quarkus · error · GradleException
Failed to copy %s to %s
Error message
Failed to copy %s to %s
What it means
For ordinary jar dependencies, jarDependencies copies each jar into the dependency cache with Files.copy using COPY_ATTRIBUTES. If the copy fails with IOException the build fails with this GradleException naming source and target. Commonly a lock, permission, or disk-space problem on either side of the copy.
Source
Thrown at devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildDependencies.java:211
if (!Files.exists(target)) {
getLogger().debug("Dependency {} : copying {} to {}",
dep.toGACTVString(),
p, target);
if (Files.isDirectory(p)) {
// This case can happen when we are building a jar from inside the Quarkus repository
// and Quarkus Bootstrap's localProjectDiscovery has been set to true. In such a case
// the non-jar dependencies are the Quarkus dependencies picked up on the file system
try {
ZipUtils.zip(p, target);
} catch (IOException e) {
throw new GradleException(
String.format("Failed to archive classes at %s into %s", p, target), e);
}
} else {
try {
Files.copy(p, target, StandardCopyOption.COPY_ATTRIBUTES);
} catch (IOException e) {
throw new GradleException(String.format("Failed to copy %s to %s", p, target), e);
}
}
}
});
})
.collect(Collectors.toMap(Map.Entry::getKey, depAndTarget -> 1, Integer::sum))
.forEach((path, count) -> getLogger().info("Copied {} files into {}", count, path));
}
private static Set<ArtifactKey> dependenciesListToArtifactKeySet(String optionalDependenciesProp) {
return Arrays.stream(optionalDependenciesProp.split(","))
.map(String::trim)
.filter(gact -> !gact.isEmpty())
.map(ArtifactKey::fromString)
.collect(Collectors.toSet());
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Stop running Quarkus dev/lock-holding processes and other Gradle daemons (./gradlew --stop), then rebuild
- Verify disk space and write permissions on the dependency output directory
- Check the source jar exists and is readable; re-download it by deleting it from the local cache
- Run ./gradlew clean quarkusBuild to start from a clean layout
Example fix
// shell-side remedy ./gradlew --stop rm -rf build/quarkus-build/dependencies ./gradlew quarkusBuild
Defensive patterns
Strategy: retry
Validate before calling
File depDir = new File("build/quarkus-build/dependencies");
if (depDir.exists() && !depDir.canWrite())
throw new IllegalStateException("Dependency output dir not writable: " + depDir); Try / catch
try {
./gradlew quarkusBuild
} catch (GradleException e) {
if (e.message?.startsWith("Failed to copy") && e.message.contains(" to ")) {
"./gradlew --stop".execute().waitFor();
deleteDir(new File("build/quarkus-build/dependencies")); retry();
} else { throw e; }
} Prevention
- Stop dev-mode processes before rebuilding
- Check free disk space before large builds
- Keep the local repo writable and unfragmented
- Run one Gradle invocation at a time (no parallel daemons)
When it happens
Trigger: Files.copy(p, target, COPY_ATTRIBUTES) throws IOException while copying a dependency jar into the build dependency directory during fast-jar/legacy-jar dependency assembly.
Common situations: Jar locked by a running dev-mode process or IDE (Windows); read-only local repository or output directory; disk full; source jar deleted by a concurrent Gradle daemon build.
Related errors
- Unable to copy extension file for: ${extension}
- Failed to load extension description + path
- Failed to create directories in %s
- Failed to load + pomPropsPath + from the classpath
- Failed to locate io.quarkus:quarkus-core-deployment on the a
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/e73395548604f2fd.
Report an issue: GitHub.