issue-3592 Make sure the dev mode jar generated through Gradle doesn't run into issues related to "Class-Path" attribute parsing in the Manifest file of the jar

This commit is contained in:
Jaikiran Pai
2019-12-06 19:55:32 +05:30
parent f526e8c473
commit 9e4729fc0b

View File

@@ -54,7 +54,6 @@ import io.quarkus.bootstrap.model.AppDependency;
import io.quarkus.bootstrap.model.AppModel;
import io.quarkus.bootstrap.resolver.AppModelResolver;
import io.quarkus.bootstrap.resolver.AppModelResolverException;
import io.quarkus.bootstrap.util.PropertyUtils;
import io.quarkus.dev.DevModeContext;
import io.quarkus.dev.DevModeMain;
import io.quarkus.gradle.QuarkusPluginExtension;
@@ -319,6 +318,8 @@ public class QuarkusDev extends QuarkusTask {
context.setFrameworkClassesDir(wiringClassesDirectory.getAbsoluteFile());
context.setCacheDir(new File(getBuildDir(), "transformer-cache").getAbsoluteFile());
// this is the jar file we will use to launch the dev mode main class
context.setDevModeRunnerJarFile(tempFile);
try (ZipOutputStream out = new ZipOutputStream(new FileOutputStream(tempFile))) {
out.putNextEntry(new ZipEntry("META-INF/"));
Manifest manifest = new Manifest();
@@ -407,19 +408,9 @@ public class QuarkusDev extends QuarkusTask {
if (filesIncludedInClasspath.add(file)) {
getProject().getLogger().info("Adding dependency {}", file);
URI uri = file.toPath().toAbsolutePath().toUri();
String path = uri.getRawPath();
if (PropertyUtils.isWindows()) {
if (path.length() > 2 && Character.isLetter(path.charAt(0)) && path.charAt(1) == ':') {
path = "/" + path;
}
}
classPathManifest.append(path);
final URI uri = file.toPath().toAbsolutePath().toUri();
context.getClassPath().add(toUrl(uri));
if (file.isDirectory()) {
classPathManifest.append("/");
}
classPathManifest.append(" ");
classPathManifest.append(uri).append(" ");
}
}