Skip to content

Commit

Permalink
Merge pull request quarkusio#22879 from glefloch/fix/22507
Browse files Browse the repository at this point in the history
Declare resource directories as application roots for IDE launch
  • Loading branch information
geoand authored Jan 14, 2022
2 parents 029d791 + 4602c59 commit 92be529
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import io.quarkus.bootstrap.app.CuratedApplication;
import io.quarkus.bootstrap.app.QuarkusBootstrap;
import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.bootstrap.model.PathsCollection;
import io.quarkus.bootstrap.resolver.maven.BootstrapMavenContext;
import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver;
import io.quarkus.bootstrap.util.BootstrapUtils;
Expand All @@ -15,6 +16,8 @@
import java.io.Closeable;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
Expand Down Expand Up @@ -45,12 +48,20 @@ public static Closeable launch(Path classesDir, Map<String, Object> context) {
final ApplicationModel quarkusModel = BuildToolHelper.enableGradleAppModelForDevMode(classesDir);
context.put(BootstrapConstants.SERIALIZED_APP_MODEL, BootstrapUtils.serializeAppModel(quarkusModel, false));

final Path launchingModulePath = quarkusModel.getApplicationModule().getMainSources().getSourceDirs().iterator()
ArtifactSources mainSources = quarkusModel.getApplicationModule().getMainSources();

final Path launchingModulePath = mainSources.getSourceDirs().iterator()
.next().getOutputDir();

List<Path> applicationRoots = new ArrayList<>();
applicationRoots.add(launchingModulePath);
for (SourceDir resourceDir : mainSources.getResourceDirs()) {
applicationRoots.add(resourceDir.getOutputDir());
}

// Gradle uses a different output directory for classes, we override the one used by the IDE
builder.setProjectRoot(launchingModulePath)
.setApplicationRoot(launchingModulePath)
.setApplicationRoot(PathsCollection.from(applicationRoots))
.setTargetDirectory(quarkusModel.getApplicationModule().getBuildDir().toPath());

for (ResolvedDependency dep : quarkusModel.getDependencies()) {
Expand Down

0 comments on commit 92be529

Please sign in to comment.