From 1c177ac86c10a50e04ec71aec5edd0a245603cc5 Mon Sep 17 00:00:00 2001 From: Alexey Loubyansky Date: Wed, 19 Jan 2022 22:56:41 +0100 Subject: [PATCH] Set current project file when initializing the Maven resolver in the bootstrap provider --- devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java | 4 +++- .../main/java/io/quarkus/maven/QuarkusBootstrapProvider.java | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) 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 80afe9c2cb43d..9039b20dad2b4 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java @@ -955,7 +955,9 @@ private QuarkusDevModeLauncher newLauncher() throws Exception { .setRepositorySystem(repoSystem) .setRemoteRepositories(repos) .setRemoteRepositoryManager(remoteRepositoryManager) - .setWorkspaceDiscovery(true); + .setWorkspaceDiscovery(true) + .setPreferPomsFromWorkspace(true) + .setCurrentProject(project.getFile().toString()); // if it already exists, it may be a reload triggered by a change in a POM // in which case we should not be using the original Maven session diff --git a/devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapProvider.java b/devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapProvider.java index a8ef9595c6126..6f76ef070a916 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapProvider.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapProvider.java @@ -120,6 +120,7 @@ private MavenArtifactResolver artifactResolver(QuarkusBootstrapMojo mojo, Launch try { return MavenArtifactResolver.builder() .setWorkspaceDiscovery(mode == LaunchMode.DEVELOPMENT || mode == LaunchMode.TEST) + .setCurrentProject(mojo.mavenProject().getFile().toString()) .setPreferPomsFromWorkspace(mode == LaunchMode.DEVELOPMENT || mode == LaunchMode.TEST) .setRepositorySystem(repoSystem) .setRepositorySystemSession(mojo.repositorySystemSession())