diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeContext.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeContext.java index 4d7815910fac7b..0ebb11ce4f6bac 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeContext.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeContext.java @@ -242,11 +242,12 @@ public static class ModuleInfo implements Serializable { this.appArtifactKey = builder.appArtifactKey; this.name = builder.name; this.projectDirectory = builder.projectDirectory; - this.main = new CompilationUnit(new LinkedHashSet<>(builder.sourcePaths), builder.classesPath, builder.resourcePath, + this.main = new CompilationUnit(new LinkedHashSet<>(builder.sourcePaths), builder.classesPath, + builder.resourcePaths, builder.resourcesOutputPath); if (builder.testClassesPath != null) { this.test = new CompilationUnit(new LinkedHashSet<>(builder.testSourcePaths), - builder.testClassesPath, builder.testResourcePath, builder.testResourcesOutputPath); + builder.testClassesPath, builder.testResourcePaths, builder.testResourcesOutputPath); } else { this.test = null; } @@ -301,7 +302,7 @@ public static class Builder { private String projectDirectory; private Set sourcePaths = Collections.emptySet(); private String classesPath; - private String resourcePath; + private Set resourcePaths = Collections.emptySet(); private String resourcesOutputPath; private String preBuildOutputDir; @@ -310,7 +311,7 @@ public static class Builder { private Set testSourcePaths = Collections.emptySet(); private String testClassesPath; - private String testResourcePath; + private Set testResourcePaths = Collections.emptySet(); private String testResourcesOutputPath; public Builder setAppArtifactKey(AppArtifactKey appArtifactKey) { @@ -338,8 +339,8 @@ public Builder setClassesPath(String classesPath) { return this; } - public Builder setResourcePath(String resourcePath) { - this.resourcePath = resourcePath; + public Builder setResourcePaths(Set resourcePaths) { + this.resourcePaths = resourcePaths; return this; } @@ -373,8 +374,8 @@ public Builder setTestClassesPath(String testClassesPath) { return this; } - public Builder setTestResourcePath(String testResourcePath) { - this.testResourcePath = testResourcePath; + public Builder setTestResourcePaths(Set testResourcePaths) { + this.testResourcePaths = testResourcePaths; return this; } @@ -392,13 +393,14 @@ public ModuleInfo build() { public static class CompilationUnit implements Serializable { private final Set sourcePaths; private final String classesPath; - private final String resourcePath; + private final Set resourcePaths; private final String resourcesOutputPath; - public CompilationUnit(Set sourcePaths, String classesPath, String resourcePath, String resourcesOutputPath) { + public CompilationUnit(Set sourcePaths, String classesPath, Set resourcePaths, + String resourcesOutputPath) { this.sourcePaths = sourcePaths; this.classesPath = classesPath; - this.resourcePath = resourcePath; + this.resourcePaths = resourcePaths; this.resourcesOutputPath = resourcesOutputPath; } @@ -410,8 +412,8 @@ public String getClassesPath() { return classesPath; } - public String getResourcePath() { - return resourcePath; + public Set getResourcePaths() { + return resourcePaths; } public String getResourcesOutputPath() { diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/IDEDevModeMain.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/IDEDevModeMain.java index 26682bd9fe7a5c..e274bd57ebf175 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/IDEDevModeMain.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/IDEDevModeMain.java @@ -8,6 +8,7 @@ import java.util.Map; import java.util.Set; import java.util.function.BiConsumer; +import java.util.stream.Collectors; import org.jboss.logging.Logger; @@ -102,8 +103,9 @@ private DevModeContext.ModuleInfo toModule(WorkspaceModule module) throws Bootst sourceParents.add(srcDir.getParent()); } String resourceDirectory = null; - if (module.getSourceSet().getResourceDirectory() != null) { - resourceDirectory = module.getSourceSet().getResourceDirectory().getPath(); + if (!module.getSourceSet().getResourceDirectories().isEmpty()) { + // Peek the first one as we assume that it is the primary + resourceDirectory = module.getSourceSet().getResourceDirectories().iterator().next().getPath(); } return new DevModeContext.ModuleInfo.Builder() .setAppArtifactKey(key) @@ -111,7 +113,8 @@ private DevModeContext.ModuleInfo toModule(WorkspaceModule module) throws Bootst .setProjectDirectory(module.getProjectRoot().getPath()) .setSourcePaths(sourceDirectories) .setClassesPath(QuarkusModelHelper.getClassPath(module).toAbsolutePath().toString()) - .setResourcePath(module.getSourceSourceSet().getResourceDirectory().toString()) + .setResourcePaths(module.getSourceSourceSet().getResourceDirectories().stream().map(Object::toString) + .collect(Collectors.toSet())) .setResourcesOutputPath(resourceDirectory) .setSourceParents(sourceParents) .setPreBuildOutputDir(module.getBuildDir().toPath().resolve("generated-sources").toAbsolutePath().toString()) @@ -127,9 +130,12 @@ private DevModeContext.ModuleInfo toModule(LocalProject project) { .setSourcePaths(Collections.singleton(project.getSourcesSourcesDir().toAbsolutePath().toString())) .setClassesPath(project.getClassesDir().toAbsolutePath().toString()) .setResourcesOutputPath(project.getClassesDir().toAbsolutePath().toString()) - .setResourcePath(project.getResourcesSourcesDir().toAbsolutePath().toString()) + .setResourcePaths( + project.getResourcesSourcesDirs().stream() + .map(resourcesSourcesDir -> resourcesSourcesDir.toAbsolutePath().toString()) + .collect(Collectors.toSet())) .setSourceParents(Collections.singleton(project.getSourcesDir().toString())) .setPreBuildOutputDir(project.getCodeGenOutputDir().toString()) .setTargetDir(project.getOutputDir().toString()).build(); } -} \ No newline at end of file +} diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java index 214b957d38dbff..f295b873a50dde 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java @@ -294,8 +294,10 @@ private ClassScanResult compileTestClasses() { public List getResourcesDir() { List ret = new ArrayList<>(); for (DevModeContext.ModuleInfo i : context.getAllModules()) { - if (i.getMain().getResourcePath() != null) { - ret.add(Paths.get(i.getMain().getResourcePath())); + if (!i.getMain().getResourcePaths().isEmpty()) { + for (String path : i.getMain().getResourcePaths()) { + ret.add(Paths.get(path)); + } } else if (i.getMain().getResourcesOutputPath() != null) { ret.add(Paths.get(i.getMain().getResourcesOutputPath())); } @@ -698,55 +700,61 @@ Set checkForFileChange(Function moduleResources = correspondingResources.computeIfAbsent(module.getName(), m -> Collections.newSetFromMap(new ConcurrentHashMap<>())); boolean doCopy = true; - String rootPath = cuf.apply(module).getResourcePath(); + Set rootPaths = cuf.apply(module).getResourcePaths(); String outputPath = cuf.apply(module).getResourcesOutputPath(); - if (rootPath == null) { - rootPath = cuf.apply(module).getClassesPath(); + if (rootPaths.isEmpty()) { + String rootPath = cuf.apply(module).getClassesPath(); + if (rootPath != null) { + rootPaths = Collections.singleton(rootPath); + } outputPath = rootPath; doCopy = false; } - if (rootPath == null || outputPath == null) { - continue; - } - Path root = Paths.get(rootPath); - if (!Files.exists(root) || !Files.isReadable(root)) { + if (rootPaths.isEmpty() || outputPath == null) { continue; } - Path outputDir = Paths.get(outputPath); + final List roots = rootPaths.stream() + .map(Paths::get) + .filter(Files::exists) + .filter(Files::isReadable) + .collect(Collectors.toList()); //copy all modified non hot deployment files over if (doCopy) { + final Set seen = new HashSet<>(moduleResources); try { - final Set seen = new HashSet<>(moduleResources); - //since the stream is Closeable, use a try with resources so the underlying iterator is closed - try (final Stream walk = Files.walk(root)) { - walk.forEach(path -> { - try { - Path relative = root.relativize(path); - Path target = outputDir.resolve(relative); - seen.remove(target); - if (!timestampSet.watchedFileTimestamps.containsKey(path)) { - moduleResources.add(target); - if (!Files.exists(target) || Files.getLastModifiedTime(target).toMillis() < Files - .getLastModifiedTime(path).toMillis()) { - if (Files.isDirectory(path)) { - Files.createDirectories(target); - } else { - Files.createDirectories(target.getParent()); - ret.add(relative.toString()); - byte[] data = Files.readAllBytes(path); - try (FileOutputStream out = new FileOutputStream(target.toFile())) { - out.write(data); - } - if (copyResourceNotification != null) { - copyResourceNotification.accept(module, relative.toString()); + for (Path root : roots) { + Path outputDir = Paths.get(outputPath); + //since the stream is Closeable, use a try with resources so the underlying iterator is closed + try (final Stream walk = Files.walk(root)) { + walk.forEach(path -> { + try { + Path relative = root.relativize(path); + Path target = outputDir.resolve(relative); + seen.remove(target); + if (!timestampSet.watchedFileTimestamps.containsKey(path)) { + moduleResources.add(target); + if (!Files.exists(target) || Files.getLastModifiedTime(target).toMillis() < Files + .getLastModifiedTime(path).toMillis()) { + if (Files.isDirectory(path)) { + Files.createDirectories(target); + } else { + Files.createDirectories(target.getParent()); + ret.add(relative.toString()); + byte[] data = Files.readAllBytes(path); + try (FileOutputStream out = new FileOutputStream(target.toFile())) { + out.write(data); + } + if (copyResourceNotification != null) { + copyResourceNotification.accept(module, relative.toString()); + } } } } + } catch (Exception e) { + log.error("Failed to copy resources", e); } - } catch (Exception e) { - log.error("Failed to copy resources", e); - } - }); + }); + } } for (Path i : seen) { moduleResources.remove(i); @@ -759,34 +767,37 @@ Set checkForFileChange(Function existing) { - ret.add(path); - log.infof("File change detected: %s", file); - if (doCopy && !Files.isDirectory(file)) { - Path target = outputDir.resolve(path); - byte[] data = Files.readAllBytes(file); - try (FileOutputStream out = new FileOutputStream(target.toFile())) { - out.write(data); + for (Path root : roots) { + Path outputDir = Paths.get(outputPath); + for (String path : watchedFilePaths.keySet()) { + Path file = root.resolve(path); + if (file.toFile().exists()) { + try { + long value = Files.getLastModifiedTime(file).toMillis(); + Long existing = timestampSet.watchedFileTimestamps.get(file); + if (value > existing) { + ret.add(path); + log.infof("File change detected: %s", file); + if (doCopy && !Files.isDirectory(file)) { + Path target = outputDir.resolve(path); + byte[] data = Files.readAllBytes(file); + try (FileOutputStream out = new FileOutputStream(target.toFile())) { + out.write(data); + } } + timestampSet.watchedFileTimestamps.put(file, value); } - timestampSet.watchedFileTimestamps.put(file, value); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } else { + timestampSet.watchedFileTimestamps.put(file, 0L); + Path target = outputDir.resolve(path); + try { + FileUtil.deleteDirectory(target); + } catch (IOException e) { + throw new UncheckedIOException(e); } - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } else { - timestampSet.watchedFileTimestamps.put(file, 0L); - Path target = outputDir.resolve(path); - try { - FileUtil.deleteDirectory(target); - } catch (IOException e) { - throw new UncheckedIOException(e); } } } @@ -856,38 +867,40 @@ public RuntimeUpdatesProcessor setWatchedFilePaths(Map watchedF main.watchedFileTimestamps.clear(); Map extraWatchedFilePaths = new HashMap<>(); for (DevModeContext.ModuleInfo module : context.getAllModules()) { - String rootPath = module.getMain().getResourcePath(); - - if (rootPath == null) { - rootPath = module.getMain().getClassesPath(); - } - if (rootPath == null) { - continue; + Set rootPaths = module.getMain().getResourcePaths(); + if (rootPaths.isEmpty()) { + String rootPath = module.getMain().getClassesPath(); + if (rootPath == null) { + continue; + } + rootPaths = Collections.singleton(rootPath); } - Path root = Paths.get(rootPath); - for (String path : watchedFilePaths.keySet()) { - Path config = root.resolve(path); - if (config.toFile().exists()) { - try { - FileTime lastModifiedTime = Files.getLastModifiedTime(config); - main.watchedFileTimestamps.put(config, lastModifiedTime.toMillis()); + for (String rootPath : rootPaths) { + Path root = Paths.get(rootPath); + for (String path : watchedFilePaths.keySet()) { + Path config = root.resolve(path); + if (config.toFile().exists()) { + try { + FileTime lastModifiedTime = Files.getLastModifiedTime(config); + main.watchedFileTimestamps.put(config, lastModifiedTime.toMillis()); + if (includeTest) { + test.watchedFileTimestamps.put(config, lastModifiedTime.toMillis()); + } + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } else { + main.watchedFileTimestamps.put(config, 0L); + Map extraWatchedFileTimestamps = expandGlobPattern(root, config); + main.watchedFileTimestamps.putAll(extraWatchedFileTimestamps); + for (Path extraPath : extraWatchedFileTimestamps.keySet()) { + extraWatchedFilePaths.put(root.relativize(extraPath).toString(), this.watchedFilePaths.get(path)); + } if (includeTest) { - test.watchedFileTimestamps.put(config, lastModifiedTime.toMillis()); + test.watchedFileTimestamps.put(config, 0L); } - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } else { - main.watchedFileTimestamps.put(config, 0L); - Map extraWatchedFileTimestamps = expandGlobPattern(root, config); - main.watchedFileTimestamps.putAll(extraWatchedFileTimestamps); - for (Path extraPath : extraWatchedFileTimestamps.keySet()) { - extraWatchedFilePaths.put(root.relativize(extraPath).toString(), this.watchedFilePaths.get(path)); - } - if (includeTest) { - test.watchedFileTimestamps.put(config, 0L); + main.watchedFileTimestamps.putAll(extraWatchedFileTimestamps); } - main.watchedFileTimestamps.putAll(extraWatchedFileTimestamps); } } } diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java b/devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java index 203f410d53518e..12a7c4369dc3fc 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java @@ -12,6 +12,7 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; @@ -479,14 +480,14 @@ private SourceSetImpl convert(SourceSet sourceSet) { if (sourceSet.getOutput().getResourcesDir().exists()) { return new SourceSetImpl( existingSrcDirs, - sourceSet.getOutput().getResourcesDir()); + Collections.singleton(sourceSet.getOutput().getResourcesDir())); } return new SourceSetImpl(existingSrcDirs); } private io.quarkus.bootstrap.resolver.model.SourceSet getSourceSourceSet(SourceSet sourceSet) { return new SourceSetImpl(sourceSet.getAllJava().getSrcDirs(), - sourceSet.getResources().getSourceDirectories().getSingleFile()); + sourceSet.getResources().getSourceDirectories().getFiles()); } private static boolean isDependency(ResolvedArtifact a) { diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java index f49b481eb38ad7..83809c6a733265 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java @@ -369,8 +369,10 @@ private void addLocalProject(Project project, GradleDevModeLauncher.Builder buil sourceParentPaths.add(sourceDir.toPath().getParent().toAbsolutePath().toString()); } } - //TODO: multiple resource directories - final File resourcesSrcDir = mainSourceSet.getResources().getSourceDirectories().getSingleFile(); + final Set resourcesSrcDirs = new HashSet<>(); + for (File resourcesSrcDir : mainSourceSet.getResources().getSourceDirectories().getFiles()) { + resourcesSrcDirs.add(resourcesSrcDir.getAbsolutePath()); + } // resourcesSrcDir may exist but if it's empty the resources output dir won't be created final File resourcesOutputDir = mainSourceSet.getOutput().getResourcesDir(); @@ -405,7 +407,7 @@ private void addLocalProject(Project project, GradleDevModeLauncher.Builder buil .setProjectDirectory(project.getProjectDir().getAbsolutePath()) .setSourcePaths(sourcePaths) .setClassesPath(classesDir) - .setResourcePath(resourcesSrcDir.getAbsolutePath()) + .setResourcePaths(resourcesSrcDirs) .setResourcesOutputPath(resourcesOutputPath) .setSourceParents(sourceParentPaths) .setPreBuildOutputDir(project.getBuildDir().toPath().resolve("generated-sources").toAbsolutePath().toString()) @@ -423,8 +425,10 @@ private void addLocalProject(Project project, GradleDevModeLauncher.Builder buil testSourceParentPaths.add(sourceDir.toPath().getParent().toAbsolutePath().toString()); } } - //TODO: multiple resource directories - final File testResourcesSrcDir = testSourceSet.getResources().getSourceDirectories().getSingleFile(); + final Set testResourcesSrcDirs = new HashSet<>(); + for (File testResourcesSrcDir : testSourceSet.getResources().getSourceDirectories().getFiles()) { + testResourcesSrcDirs.add(testResourcesSrcDir.getAbsolutePath()); + } // resourcesSrcDir may exist but if it's empty the resources output dir won't be created final File testResourcesOutputDir = testSourceSet.getOutput().getResourcesDir(); @@ -446,7 +450,7 @@ private void addLocalProject(Project project, GradleDevModeLauncher.Builder buil } moduleBuilder.setTestSourcePaths(testSourcePaths) .setTestClassesPath(testClassesDir) - .setTestResourcePath(testResourcesSrcDir.getAbsolutePath()) + .setTestResourcePaths(testResourcesSrcDirs) .setTestResourcesOutputPath(testResourcesOutputPath); } } diff --git a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java index 5bebabca2fe6de..4219974ccd789e 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java @@ -37,9 +37,11 @@ import org.aesh.terminal.utils.ANSI; import org.apache.maven.artifact.Artifact; import org.apache.maven.execution.MavenSession; +import org.apache.maven.model.BuildBase; import org.apache.maven.model.Dependency; import org.apache.maven.model.Plugin; import org.apache.maven.model.PluginExecution; +import org.apache.maven.model.Profile; import org.apache.maven.model.Resource; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.BuildPluginManager; @@ -578,10 +580,11 @@ private void addProject(MavenDevModeLauncher.Builder builder, LocalProject local String projectDirectory = null; Set sourcePaths = null; String classesPath = null; - String resourcePath = null; + Set resourcePaths; Set testSourcePaths = null; String testClassesPath = null; - String testResourcePath = null; + Set testResourcePaths; + List activeProfiles = Collections.emptyList(); final MavenProject mavenProject = session.getProjectMap().get( String.format("%s:%s:%s", localProject.getGroupId(), localProject.getArtifactId(), localProject.getVersion())); @@ -613,6 +616,7 @@ private void addProject(MavenDevModeLauncher.Builder builder, LocalProject local .filter(Files::isDirectory) .map(src -> src.toAbsolutePath().toString()) .collect(Collectors.toSet()); + activeProfiles = mavenProject.getActiveProfiles(); } Path sourceParent = localProject.getSourcesDir().toAbsolutePath(); @@ -624,16 +628,34 @@ private void addProject(MavenDevModeLauncher.Builder builder, LocalProject local if (Files.isDirectory(testClassesDir)) { testClassesPath = testClassesDir.toAbsolutePath().toString(); } - Path resourcesSourcesDir = localProject.getResourcesSourcesDir(); - if (Files.isDirectory(resourcesSourcesDir)) { - resourcePath = resourcesSourcesDir.toAbsolutePath().toString(); - } - Path testResourcesSourcesDir = localProject.getTestResourcesSourcesDir(); - if (Files.isDirectory(testResourcesSourcesDir)) { - testResourcePath = testResourcesSourcesDir.toAbsolutePath().toString(); + resourcePaths = localProject.getResourcesSourcesDirs().stream() + .filter(Files::isDirectory) + .map(resourcesSourcesDir -> resourcesSourcesDir.toAbsolutePath().toString()) + .collect(Collectors.toSet()); + testResourcePaths = localProject.getTestResourcesSourcesDirs().stream() + .filter(Files::isDirectory) + .map(resourcesSourcesDir -> resourcesSourcesDir.toAbsolutePath().toString()) + .collect(Collectors.toSet()); + // Add the resources and test resources from the profiles + for (Profile profile : activeProfiles) { + final BuildBase build = profile.getBuild(); + if (build != null) { + resourcePaths.addAll( + build.getResources().stream() + .map(Resource::getDirectory) + .map(localProject::resolveRelativeToBaseDir) + .map(resourcesSourcesDir -> resourcesSourcesDir.toAbsolutePath().toString()) + .collect(Collectors.toList())); + testResourcePaths.addAll( + build.getTestResources().stream() + .map(Resource::getDirectory) + .map(localProject::resolveRelativeToBaseDir) + .map(resourcesSourcesDir -> resourcesSourcesDir.toAbsolutePath().toString()) + .collect(Collectors.toList())); + } } - if (classesPath == null && (!sourcePaths.isEmpty() || resourcePath != null)) { + if (classesPath == null && (!sourcePaths.isEmpty() || !resourcePaths.isEmpty())) { throw new MojoExecutionException("Hot reloadable dependency " + localProject.getAppArtifact() + " has not been compiled yet (the classes directory " + classesDir + " does not exist)"); } @@ -646,13 +668,13 @@ private void addProject(MavenDevModeLauncher.Builder builder, LocalProject local .setSourcePaths(sourcePaths) .setClassesPath(classesPath) .setResourcesOutputPath(classesPath) - .setResourcePath(resourcePath) + .setResourcePaths(resourcePaths) .setSourceParents(Collections.singleton(sourceParent.toAbsolutePath().toString())) .setPreBuildOutputDir(targetDir.resolve("generated-sources").toAbsolutePath().toString()) .setTargetDir(targetDir.toAbsolutePath().toString()) .setTestSourcePaths(testSourcePaths) .setTestClassesPath(testClassesPath) - .setTestResourcePath(testResourcePath) + .setTestResourcePaths(testResourcePaths) .build(); if (root) { diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/IDELauncherImpl.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/IDELauncherImpl.java index 8a549683d15e6c..8c1014ac87ffcf 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/IDELauncherImpl.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/IDELauncherImpl.java @@ -55,7 +55,8 @@ public static Closeable launch(Path classesDir, Map context) { QuarkusModelHelper.toPathsCollection(additionalModule.getSourceSet().getSourceDirectories()), true, false)); builder.addAdditionalApplicationArchive(new AdditionalDependency( - additionalModule.getSourceSet().getResourceDirectory().toPath(), true, false)); + QuarkusModelHelper.toPathsCollection(additionalModule.getSourceSet().getResourceDirectories()), + true, false)); } } } else { diff --git a/independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/resolver/model/SourceSet.java b/independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/resolver/model/SourceSet.java index c90d35a06f23ed..c2034cf2fb5d34 100644 --- a/independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/resolver/model/SourceSet.java +++ b/independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/resolver/model/SourceSet.java @@ -7,5 +7,5 @@ public interface SourceSet { Set getSourceDirectories(); - File getResourceDirectory(); + Set getResourceDirectories(); } diff --git a/independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/resolver/model/impl/SourceSetImpl.java b/independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/resolver/model/impl/SourceSetImpl.java index acb4d5e3723454..166995474d2c4b 100644 --- a/independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/resolver/model/impl/SourceSetImpl.java +++ b/independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/resolver/model/impl/SourceSetImpl.java @@ -4,17 +4,19 @@ import java.io.File; import java.io.Serializable; import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.Set; import java.util.stream.Collectors; public class SourceSetImpl implements SourceSet, Serializable { - private Set sourceDirectories = new HashSet<>(); - private File resourceDirectory; + private final Set sourceDirectories = new HashSet<>(); + // Use a LinkedHashSet to keep the original order + private final Set resourceDirectories = new LinkedHashSet<>(); - public SourceSetImpl(Set sourceDirectories, File resourceDirectory) { + public SourceSetImpl(Set sourceDirectories, Set resourceDirectories) { this.sourceDirectories.addAll(sourceDirectories); - this.resourceDirectory = resourceDirectory; + this.resourceDirectories.addAll(resourceDirectories); } public SourceSetImpl(Set sourceDirectories) { @@ -31,15 +33,15 @@ public Set getSourceDirectories() { } @Override - public File getResourceDirectory() { - return resourceDirectory; + public Set getResourceDirectories() { + return resourceDirectories; } @Override public String toString() { return "SourceSetImpl{" + "sourceDirectories=" + sourceDirectories.stream().map(File::getPath).collect(Collectors.joining(":")) + - ", resourceDirectory=" + resourceDirectory + + ", resourceDirectories=" + resourceDirectories.stream().map(File::getPath).collect(Collectors.joining(":")) + '}'; } } diff --git a/independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/util/QuarkusModelHelper.java b/independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/util/QuarkusModelHelper.java index e8a3585bd59d05..d128d659119688 100644 --- a/independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/util/QuarkusModelHelper.java +++ b/independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/util/QuarkusModelHelper.java @@ -145,9 +145,10 @@ public static AppModel convert(QuarkusModel model, AppArtifact appArtifact) thro WorkspaceModule module = model.getWorkspace().getMainModule(); module.getSourceSet().getSourceDirectories().stream().filter(File::exists).map(File::toPath) .forEach(paths::add); - File resourceDirectory = module.getSourceSet().getResourceDirectory(); - if (resourceDirectory != null && resourceDirectory.exists()) { - paths.add(resourceDirectory.toPath()); + for (File resourceDirectory : module.getSourceSet().getResourceDirectories()) { + if (resourceDirectory.exists()) { + paths.add(resourceDirectory.toPath()); + } } appArtifact.setPaths(paths.build()); } diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java index e98875ef5d8c89..82cf271df6798f 100644 --- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java +++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java @@ -11,7 +11,9 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Set; import java.util.function.Function; +import java.util.stream.Collectors; import org.apache.maven.model.Build; import org.apache.maven.model.Model; import org.apache.maven.model.Parent; @@ -228,20 +230,28 @@ public Path getSourcesDir() { return getSourcesSourcesDir().getParent(); } - public Path getResourcesSourcesDir() { + public Set getResourcesSourcesDirs() { final List resources = rawModel.getBuild() == null ? Collections.emptyList() : rawModel.getBuild().getResources(); - //todo: support multiple resources dirs for config hot deployment - final String resourcesDir = resources.isEmpty() ? null : resources.get(0).getDirectory(); - return resolveRelativeToBaseDir(resourcesDir, "src/main/resources"); + if (resources.isEmpty()) { + return Collections.singleton(resolveRelativeToBaseDir(null, "src/main/resources")); + } + return resources.stream() + .map(Resource::getDirectory) + .map(resourcesDir -> resolveRelativeToBaseDir(resourcesDir, "src/main/resources")) + .collect(Collectors.toSet()); } - public Path getTestResourcesSourcesDir() { + public Set getTestResourcesSourcesDirs() { final List resources = rawModel.getBuild() == null ? Collections.emptyList() : rawModel.getBuild().getTestResources(); - //todo: support multiple resources dirs for config hot deployment - final String resourcesDir = resources.isEmpty() ? null : resources.get(0).getDirectory(); - return resolveRelativeToBaseDir(resourcesDir, "src/test/resources"); + if (resources.isEmpty()) { + return Collections.singleton(resolveRelativeToBaseDir(null, "src/test/resources")); + } + return resources.stream() + .map(Resource::getDirectory) + .map(resourcesDir -> resolveRelativeToBaseDir(resourcesDir, "src/test/resources")) + .collect(Collectors.toSet()); } public ModelBuildingResult getModelBuildingResult() { @@ -269,6 +279,10 @@ public AppArtifact getAppArtifact(String extension) { return new AppArtifact(groupId, artifactId, "", extension, getVersion()); } + public Path resolveRelativeToBaseDir(String path) { + return resolveRelativeToBaseDir(path, null); + } + private Path resolveRelativeToBaseDir(String path, String defaultPath) { return dir.resolve(path == null ? defaultPath : stripProjectBasedirPrefix(path, PROJECT_BASEDIR)); } diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java index 9f0b853297e0bf..b9ddb97b814ae2 100644 --- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java +++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java @@ -161,7 +161,7 @@ private Path emptyJarOutput(LocalProject lp, Artifact artifact) { // so the Maven resolver will succeed resolving it from the repo. // If the artifact does not exist in the local repo, we are creating an empty classes directory in the target directory. if (!Files.exists(lp.getSourcesSourcesDir()) - && !Files.exists(lp.getResourcesSourcesDir()) + && lp.getResourcesSourcesDirs().stream().noneMatch(Files::exists) && !isFoundInLocalRepo(artifact)) { try { final Path classesDir = lp.getClassesDir(); diff --git a/integration-tests/gradle/src/test/java/io/quarkus/gradle/builder/QuarkusModelBuilderTest.java b/integration-tests/gradle/src/test/java/io/quarkus/gradle/builder/QuarkusModelBuilderTest.java index 251bcb0baaac34..04d247926a63db 100644 --- a/integration-tests/gradle/src/test/java/io/quarkus/gradle/builder/QuarkusModelBuilderTest.java +++ b/integration-tests/gradle/src/test/java/io/quarkus/gradle/builder/QuarkusModelBuilderTest.java @@ -72,11 +72,11 @@ private void assertWorkspace(WorkspaceModule workspaceModule, File projectDir) { assertEquals(new File(projectDir, "build"), workspaceModule.getBuildDir()); final SourceSet sourceSet = workspaceModule.getSourceSet(); assertNotNull(sourceSet); - assertNull(sourceSet.getResourceDirectory()); + assertTrue(sourceSet.getResourceDirectories().isEmpty()); assertThat(sourceSet.getSourceDirectories()).containsAnyOf(new File(projectDir, "build/classes/java/main"), new File(projectDir, "build/classes/java/test")); final SourceSet sourceSourceSet = workspaceModule.getSourceSourceSet(); - assertEquals(new File(projectDir, "src/main/resources"), sourceSourceSet.getResourceDirectory()); + assertThat(sourceSourceSet.getResourceDirectories()).containsAnyOf(new File(projectDir, "src/main/resources")); assertEquals(5, sourceSourceSet.getSourceDirectories().size()); assertThat(sourceSourceSet.getSourceDirectories()).contains(new File(projectDir, "src/main/java")); } diff --git a/integration-tests/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java b/integration-tests/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java index 4378313242414d..bb52046339973d 100644 --- a/integration-tests/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java +++ b/integration-tests/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java @@ -848,6 +848,51 @@ public void testThatNewResourcesAreServed() throws MavenInvocationException, IOE .until(() -> DevModeTestUtils.getHttpResponse("/lorem.txt", 404)); } + @Test + public void testThatMultipleResourceDirectoriesAreSupported() throws MavenInvocationException, IOException { + testDir = initProject("projects/dev-mode-multiple-resource-dirs"); + testMultipleResourceDirectories(); + } + + @Test + public void testThatMultipleResourceDirectoriesAreSupportedWithProfile() throws MavenInvocationException, IOException { + testDir = initProject("projects/dev-mode-multiple-resource-dirs-with-profile"); + testMultipleResourceDirectories(); + } + + private void testMultipleResourceDirectories() throws MavenInvocationException, IOException { + runAndCheck(); + await() + .pollDelay(100, TimeUnit.MILLISECONDS) + .atMost(1, TimeUnit.MINUTES) + .until(() -> DevModeTestUtils.getHttpResponse("/app/hello/greetings").contains("Bonjour/Other")); + + // Update the application.properties + File source = new File(testDir, "src/main/resources-primary/application.properties"); + FileUtils.write(source, "greeting=Salut", "UTF-8"); + await() + .pollDelay(100, TimeUnit.MILLISECONDS) + .atMost(1, TimeUnit.MINUTES) + .until(() -> DevModeTestUtils.getHttpResponse("/app/hello/greetings").contains("Salut/Other")); + + // Add the application.yaml + source = new File(testDir, "src/main/resources-secondary/application.yaml"); + FileUtils.write(source, "other:\n" + + " greeting: Buenos dias", "UTF-8"); + await() + .pollDelay(100, TimeUnit.MILLISECONDS) + .atMost(1, TimeUnit.MINUTES) + .until(() -> DevModeTestUtils.getHttpResponse("/app/hello/greetings").contains("Salut/Buenos dias")); + + // Update the application.yaml + FileUtils.write(source, "other:\n" + + " greeting: Hola", "UTF-8"); + await() + .pollDelay(100, TimeUnit.MILLISECONDS) + .atMost(1, TimeUnit.MINUTES) + .until(() -> DevModeTestUtils.getHttpResponse("/app/hello/greetings").contains("Salut/Hola")); + } + @Test public void testThatApplicationRecoversCompilationIssue() throws MavenInvocationException, IOException { testDir = initProject("projects/classic", "projects/project-classic-run-compilation-issue"); diff --git a/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs-with-profile/pom.xml b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs-with-profile/pom.xml new file mode 100644 index 00000000000000..2cea4535deb146 --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs-with-profile/pom.xml @@ -0,0 +1,88 @@ + + + 4.0.0 + org.acme + acme + 1.0-SNAPSHOT + + io.quarkus + quarkus-bom + @project.version@ + @project.version@ + 11 + UTF-8 + 11 + + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + + io.quarkus + quarkus-resteasy + + + io.quarkus + quarkus-config-yaml + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + + + + src/main/resources-primary + + + + + io.quarkus + quarkus-maven-plugin + ${quarkus-plugin.version} + + + + generate-code + generate-code-tests + build + + + + + + + + + add-secondary + + true + + + + + src/main/resources-secondary + + + + + + diff --git a/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs-with-profile/src/main/java/org/acme/HelloResource.java b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs-with-profile/src/main/java/org/acme/HelloResource.java new file mode 100644 index 00000000000000..3dc7e048691f43 --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs-with-profile/src/main/java/org/acme/HelloResource.java @@ -0,0 +1,31 @@ +package org.acme; + +import org.eclipse.microprofile.config.inject.ConfigProperty; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Path("/hello") +public class HelloResource { + + @ConfigProperty(name = "greeting") + String greeting; + + @ConfigProperty(name = "other.greeting", defaultValue = "Other") + String otherGreeting; + + @GET + @Produces(MediaType.TEXT_PLAIN) + public String hello() { + return "hello"; + } + + @GET + @Path("/greetings") + @Produces(MediaType.TEXT_PLAIN) + public String greetings() { + return greeting + "/" + otherGreeting; + } +} diff --git a/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs-with-profile/src/main/java/org/acme/MyApplication.java b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs-with-profile/src/main/java/org/acme/MyApplication.java new file mode 100644 index 00000000000000..2b41cd0385afb8 --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs-with-profile/src/main/java/org/acme/MyApplication.java @@ -0,0 +1,9 @@ +package org.acme; + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; + +@ApplicationPath("/app") +public class MyApplication extends Application { + +} diff --git a/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs-with-profile/src/main/resources-primary/META-INF/resources/index.html b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs-with-profile/src/main/resources-primary/META-INF/resources/index.html new file mode 100644 index 00000000000000..c09bb5c96b8694 --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs-with-profile/src/main/resources-primary/META-INF/resources/index.html @@ -0,0 +1,156 @@ + + + + + acme - 1.0-SNAPSHOT + + + + + + +
+
+

Congratulations, you have created a new Quarkus application.

+ +

Why do you see this?

+ +

This page is served by Quarkus. The source is in + src/main/resources/META-INF/resources/index.html.

+ +

What can I do from here?

+ +

If not already done, run the application in dev mode using: mvn compile quarkus:dev. +

+
    +
  • Add REST resources, Servlets, functions and other services in src/main/java.
  • +
  • Your static assets are located in src/main/resources/META-INF/resources.
  • +
  • Configure your application in src/main/resources/application.properties. +
  • +
+ +

Do you like Quarkus?

+

Go give it a star on GitHub.

+ +

How do I get rid of this page?

+

Just delete the src/main/resources/META-INF/resources/index.html file.

+
+
+
+

Application

+
    +
  • GroupId: org.acme
  • +
  • ArtifactId: acme
  • +
  • Version: 1.0-SNAPSHOT
  • +
  • Quarkus Version: 999-SNAPSHOT
  • +
+
+
+

Next steps

+ +
+
+
+ + + + \ No newline at end of file diff --git a/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs-with-profile/src/main/resources-primary/application.properties b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs-with-profile/src/main/resources-primary/application.properties new file mode 100644 index 00000000000000..acb0268bff21d8 --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs-with-profile/src/main/resources-primary/application.properties @@ -0,0 +1,2 @@ +# Configuration file +greeting=Bonjour diff --git a/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs/pom.xml b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs/pom.xml new file mode 100644 index 00000000000000..b30df964c899ba --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs/pom.xml @@ -0,0 +1,76 @@ + + + 4.0.0 + org.acme + acme + 1.0-SNAPSHOT + + io.quarkus + quarkus-bom + @project.version@ + @project.version@ + 11 + UTF-8 + 11 + + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + + io.quarkus + quarkus-resteasy + + + io.quarkus + quarkus-config-yaml + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + + + + src/main/resources-primary + + + src/main/resources-secondary + + + + + io.quarkus + quarkus-maven-plugin + ${quarkus-plugin.version} + + + + generate-code + generate-code-tests + build + + + + + + + diff --git a/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs/src/main/java/org/acme/HelloResource.java b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs/src/main/java/org/acme/HelloResource.java new file mode 100644 index 00000000000000..3dc7e048691f43 --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs/src/main/java/org/acme/HelloResource.java @@ -0,0 +1,31 @@ +package org.acme; + +import org.eclipse.microprofile.config.inject.ConfigProperty; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Path("/hello") +public class HelloResource { + + @ConfigProperty(name = "greeting") + String greeting; + + @ConfigProperty(name = "other.greeting", defaultValue = "Other") + String otherGreeting; + + @GET + @Produces(MediaType.TEXT_PLAIN) + public String hello() { + return "hello"; + } + + @GET + @Path("/greetings") + @Produces(MediaType.TEXT_PLAIN) + public String greetings() { + return greeting + "/" + otherGreeting; + } +} diff --git a/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs/src/main/java/org/acme/MyApplication.java b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs/src/main/java/org/acme/MyApplication.java new file mode 100644 index 00000000000000..2b41cd0385afb8 --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs/src/main/java/org/acme/MyApplication.java @@ -0,0 +1,9 @@ +package org.acme; + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; + +@ApplicationPath("/app") +public class MyApplication extends Application { + +} diff --git a/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs/src/main/resources-primary/META-INF/resources/index.html b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs/src/main/resources-primary/META-INF/resources/index.html new file mode 100644 index 00000000000000..c09bb5c96b8694 --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs/src/main/resources-primary/META-INF/resources/index.html @@ -0,0 +1,156 @@ + + + + + acme - 1.0-SNAPSHOT + + + + + + +
+
+

Congratulations, you have created a new Quarkus application.

+ +

Why do you see this?

+ +

This page is served by Quarkus. The source is in + src/main/resources/META-INF/resources/index.html.

+ +

What can I do from here?

+ +

If not already done, run the application in dev mode using: mvn compile quarkus:dev. +

+
    +
  • Add REST resources, Servlets, functions and other services in src/main/java.
  • +
  • Your static assets are located in src/main/resources/META-INF/resources.
  • +
  • Configure your application in src/main/resources/application.properties. +
  • +
+ +

Do you like Quarkus?

+

Go give it a star on GitHub.

+ +

How do I get rid of this page?

+

Just delete the src/main/resources/META-INF/resources/index.html file.

+
+
+
+

Application

+
    +
  • GroupId: org.acme
  • +
  • ArtifactId: acme
  • +
  • Version: 1.0-SNAPSHOT
  • +
  • Quarkus Version: 999-SNAPSHOT
  • +
+
+
+

Next steps

+ +
+
+
+ + + + \ No newline at end of file diff --git a/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs/src/main/resources-primary/application.properties b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs/src/main/resources-primary/application.properties new file mode 100644 index 00000000000000..acb0268bff21d8 --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs/src/main/resources-primary/application.properties @@ -0,0 +1,2 @@ +# Configuration file +greeting=Bonjour diff --git a/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs/src/main/resources-secondary/.keep b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs/src/main/resources-secondary/.keep new file mode 100644 index 00000000000000..8a0a8385da974e --- /dev/null +++ b/integration-tests/maven/src/test/resources/projects/dev-mode-multiple-resource-dirs/src/main/resources-secondary/.keep @@ -0,0 +1 @@ +# Just to be able to commit this empty folder needed for the test diff --git a/test-framework/junit5-internal/src/main/java/io/quarkus/test/QuarkusDevModeTest.java b/test-framework/junit5-internal/src/main/java/io/quarkus/test/QuarkusDevModeTest.java index 343349e0daf061..ac3a459708b48b 100644 --- a/test-framework/junit5-internal/src/main/java/io/quarkus/test/QuarkusDevModeTest.java +++ b/test-framework/junit5-internal/src/main/java/io/quarkus/test/QuarkusDevModeTest.java @@ -337,7 +337,7 @@ private DevModeContext exportArchive(Path deploymentDir, Path testSourceDir, Pat .setProjectDirectory(deploymentDir.toAbsolutePath().toString()) .setSourcePaths(Collections.singleton(deploymentSourcePath.toAbsolutePath().toString())) .setClassesPath(classes.toAbsolutePath().toString()) - .setResourcePath(deploymentResourcePath.toAbsolutePath().toString()) + .setResourcePaths(Collections.singleton(deploymentResourcePath.toAbsolutePath().toString())) .setResourcesOutputPath(classes.toAbsolutePath().toString()) .setSourceParents(Collections.singleton(deploymentSourceParentPath.toAbsolutePath().toString())) .setPreBuildOutputDir(targetDir.resolve("generated-sources").toAbsolutePath().toString()) @@ -386,7 +386,7 @@ private DevModeContext exportArchive(Path deploymentDir, Path testSourceDir, Pat moduleBuilder .setTestSourcePaths(Collections.singleton(deploymentTestSourcePath.toAbsolutePath().toString())) .setTestClassesPath(testClasses.toAbsolutePath().toString()) - .setTestResourcePath(deploymentTestResourcePath.toAbsolutePath().toString()); + .setTestResourcePaths(Collections.singleton(deploymentTestResourcePath.toAbsolutePath().toString())); } context.setApplicationRoot(