Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle: package classes dir when creating dependency lib dir #33644

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.deployment.pkg.PackageConfig;
import io.quarkus.fs.util.ZipUtils;
import io.quarkus.gradle.QuarkusPlugin;
import io.quarkus.maven.dependency.ArtifactKey;
import io.quarkus.maven.dependency.DependencyFlags;
Expand Down Expand Up @@ -175,10 +176,22 @@ private void jarDependencies(Path libBoot, Path libMain) {
getLogger().debug("Dependency {} : copying {} to {}",
dep.toGACTVString(),
p, target);
try {
Files.copy(p, target);
} catch (IOException e) {
throw new GradleException(String.format("Failed to copy %s to %s", p, target), e);
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);
} catch (IOException e) {
throw new GradleException(String.format("Failed to copy %s to %s", p, target), e);
}
}
}
});
Expand Down