Repository: quarkusio/quarkus
Issue: Maven artifacts from additional repo not found during quarkus:build

### Describe the bug

Services with dependencies on Maven artifacts that are not on maven-central cannot be built if the repositories are declared only in `settings.xml` and not in the `pom.xml` project. (If the repo is entered in pom.xml, the build for repos works without credentials.)

Error message:
```
Failed to execute goal io.quarkus:quarkus-maven-plugin:2.11.0.Final:build (default) on project example-artifact: 
Failed to build quarkus application: Failed to bootstrap application in NORMAL mode:
Failed to resolve dependencies for org.acme:example-artifact:jar:999-SNAPSHOT: 
Could not find artifact io.confluent:kafka-avro-serializer:jar:7.2.1 in central (https://repo.maven.apache.org/maven2) -> [Help 1]
```


### Expected behavior

Maven artifacts from additional Maven repositories (such as confluent or private repositories) are not found when running mvn quarkus:build.

The behavior only occurs if the repositories are defined exclusively in settings.xml.

With version 2.10.3.Final, the build still worked correctly.


### Actual behavior


Plugin tries to download artifact only from "central" repository and the build breaks with "Could not find artifact" error.

Example:
```
Failed to execute goal io.quarkus:quarkus-maven-plugin:2.11.0.Final:build (default) on project example-artifact: 
Failed to build quarkus application: Failed to bootstrap application in NORMAL mode:
Failed to resolve dependencies for org.acme:example-artifact:jar:999-SNAPSHOT: 
Could not find artifact io.confluent:kafka-avro-serializer:jar:7.2.1 in central (https://repo.maven.apache.org/maven2) -> [Help 1]
```

`mvn compile` can resolve the dependency. Only the quarkus-maven-plugin isn't able to locate the jar.


### How to Reproduce?

- Add dependency to an artifact, that isn't on maven-central
- Declare the repository only in settings.xml
- run mvn quarkus:build

Repository in profile in settings.xml:
```
<profiles>
	<profile>
		<id>3rdParty-repos</id>
		<activation>
			<activeByDefault>true</activeByDefault>
		</activation>
		<repositories>
			<!-- Repository for Confluent-->
			<repository>
				<id>confluent</id>
				<url>https://packages.confluent.io/maven/</url>
				<snapshots>
					<enabled>false</enabled>
				</snapshots>
			</repository>
		</repositories>
		<pluginRepositories>
			<pluginRepository>
				<id>confluent-plugins</id>
				<url>https://packages.confluent.io/maven/</url>
				<snapshots>
					<enabled>false</enabled>
				</snapshots>
			</pluginRepository>
		</pluginRepositories>
	</profile>
</profiles>
```

### Output of `uname -a` or `ver`

_No response_

### Output of `java -version`

_No response_

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

2.11.0.Final

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

Apache Maven 3.8.5

### Additional information

Dependency loading was changed with https://github.com/quarkusio/quarkus/commit/bd30d5cfa498e908e4bea41c508a9da1a820b0b1

AppModel is built only with the `managedRepos` and the repositories of the main-artifact. Other repositories from maven are ignored.

- aggregatedRepos with `mangedRepos` and all maven repos: https://github.com/quarkusio/quarkus/blob/main/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java#L254
- Reduce aggregatedRepos to managedRepos and repositories from artifact: https://github.com/quarkusio/quarkus/blob/main/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java#L280-L281

When the reassignment of aggregatedRepos is omitted, `quarkus:build` will work again. But I cannot judge whether this restriction was made deliberately.

Changed files:
core/deployment/src/test/java/io/quarkus/deployment/runnerjar/SimpleExtAndAppCompileDepsTest.java
independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java
devtools/cli/src/test/java/io/quarkus/cli/RegistryClientBuilderTestBase.java
core/deployment/src/test/java/io/quarkus/deployment/runnerjar/BootstrapFromOriginalJarTestBase.java
independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/TsRepoBuilder.java
independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/CollectDependenciesBase.java
independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/ResolverSetupCleanup.java
independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java
devtools/maven/src/test/java/io/quarkus/maven/DependencyTreeMojoTestBase.java

diff --git a/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/BootstrapFromOriginalJarTestBase.java b/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/BootstrapFromOriginalJarTestBase.java
index c0943ba8076..0b7a3147953 100644
--- a/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/BootstrapFromOriginalJarTestBase.java
+++ b/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/BootstrapFromOriginalJarTestBase.java
@@ -26,7 +26,6 @@
 import io.quarkus.fs.util.ZipUtils;
 import io.quarkus.maven.dependency.ArtifactCoords;
 import io.quarkus.maven.dependency.ArtifactKey;
-import io.quarkus.maven.dependency.GACTV;
 
 public abstract class BootstrapFromOriginalJarTestBase extends PackageAppTestBase {
 
@@ -145,8 +144,10 @@ protected QuarkusBootstrap.Builder initBootstrapBuilder() throws Exception {
                     modulePom.setParent(parent);
                     final Path moduleDir = IoUtils.mkdirs(ws.resolve(modulePom.getArtifactId()));
                     ModelUtils.persistModel(moduleDir.resolve("pom.xml"), modulePom);
-                    final Path resolvedJar = resolver.resolve(new GACTV(modulePom.getGroupId(), modulePom.getArtifactId(),
-                            moduleDep.getClassifier(), moduleDep.getType(), modulePom.getVersion())).getResolvedPaths()
+                    final Path resolvedJar = resolver
+                            .resolve(ArtifactCoords.of(modulePom.getGroupId(), modulePom.getArtifactId(),
+                                    moduleDep.getClassifier(), moduleDep.getType(), modulePom.getVersion()))
+                            .getResolvedPaths()
                             .getSinglePath();
                     final Path moduleTargetDir = moduleDir.resolve("target");
                     ZipUtils.unzip(resolvedJar, moduleTargetDir.resolve("classes"));
@@ -160,8 +161,10 @@ protected QuarkusBootstrap.Builder initBootstrapBuilder() throws Exception {
                     modulePom.setParent(parent);
                     final Path moduleDir = IoUtils.mkdirs(ws.resolve(modulePom.getArtifactId()));
                     ModelUtils.persistModel(moduleDir.resolve("pom.xml"), modulePom);
-                    final Path resolvedJar = resolver.resolve(new GACTV(modulePom.getGroupId(), modulePom.getArtifactId(),
-                            module.getClassifier(), module.getType(), modulePom.getVersion())).getResolvedPaths()
+                    final Path resolvedJar = resolver
+                            .resolve(ArtifactCoords.of(modulePom.getGroupId(), modulePom.getArtifactId(),
+                                    module.getClassifier(), module.getType(), modulePom.getVersion()))
+                            .getResolvedPaths()
                             .getSinglePath();
                     final Path moduleTargetDir = moduleDir.resolve("target");
                     ZipUtils.unzip(resolvedJar, moduleTargetDir.resolve("classes"));
@@ -201,8 +204,10 @@ protected QuarkusBootstrap.Builder initBootstrapBuilder() throws Exception {
                         modulePom.setParent(parent);
                         final Path moduleDir = IoUtils.mkdirs(ws.resolve(modulePom.getArtifactId()));
                         ModelUtils.persistModel(moduleDir.resolve("pom.xml"), modulePom);
-                        final Path resolvedJar = resolver.resolve(new GACTV(modulePom.getGroupId(), modulePom.getArtifactId(),
-                                a.getClassifier(), a.getType(), modulePom.getVersion())).getResolvedPaths()
+                        final Path resolvedJar = resolver
+                                .resolve(ArtifactCoords.of(modulePom.getGroupId(), modulePom.getArtifactId(),
+                                        a.getClassifier(), a.getType(), modulePom.getVersion()))
+                                .getResolvedPaths()
                                 .getSinglePath();
                         final Path moduleTargetDir = moduleDir.resolve("target");
                         ZipUtils.unzip(resolvedJar, moduleTargetDir.resolve("classes"));
@@ -222,6 +227,7 @@ protected QuarkusBootstrap.Builder initBootstrapBuilder() throws Exception {
                     .setWorkspaceDiscovery(true)
                     .setWorkspaceModuleParentHierarchy(workspaceModuleParentHierarchy())
                     .setRootProjectDir(ws)
+                    .setUserSettings(getSettingsXml() == null ? null : getSettingsXml().toFile())
                     .setCurrentProject(appPomXml.toString()))
                     .getCurrentProject();
 
diff --git a/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/SimpleExtAndAppCompileDepsTest.java b/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/SimpleExtAndAppCompileDepsTest.java
index 0f6dff9e2ea..3d518736e32 100644
--- a/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/SimpleExtAndAppCompileDepsTest.java
+++ b/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/SimpleExtAndAppCompileDepsTest.java
@@ -5,6 +5,12 @@
 
 public class SimpleExtAndAppCompileDepsTest extends BootstrapFromOriginalJarTestBase {
 
+    @Override
+    protected boolean setupCustomMavenRepoInSettings() {
+        // this is to make sure repositories enabled in user settings are properly aggregated
+        return true;
+    }
+
     @Override
     protected TsArtifact composeApplication() {
 
diff --git a/devtools/cli/src/test/java/io/quarkus/cli/RegistryClientBuilderTestBase.java b/devtools/cli/src/test/java/io/quarkus/cli/RegistryClientBuilderTestBase.java
index 8553d60ce73..00a402bcda5 100644
--- a/devtools/cli/src/test/java/io/quarkus/cli/RegistryClientBuilderTestBase.java
+++ b/devtools/cli/src/test/java/io/quarkus/cli/RegistryClientBuilderTestBase.java
@@ -6,7 +6,7 @@
 import java.net.MalformedURLException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.util.Collections;
+import java.util.Map;
 
 import org.apache.maven.settings.Profile;
 import org.apache.maven.settings.Repository;
@@ -78,7 +78,7 @@ static void setup() throws Exception {
 
         settingsXml = workDir().resolve("settings.xml");
         try (BufferedWriter writer = Files.newBufferedWriter(settingsXml)) {
-            new DefaultSettingsWriter().write(writer, Collections.emptyMap(), settings);
+            new DefaultSettingsWriter().write(writer, Map.of(), settings);
         }
         testRepo = registryConfigDir.resolve("test-repo");
     }
@@ -109,7 +109,7 @@ protected static String getCurrentQuarkusVersion() {
     private static Settings getBaseMavenSettings(Path mavenSettings) throws IOException {
         if (Files.exists(mavenSettings)) {
             try (BufferedReader reader = Files.newBufferedReader(mavenSettings)) {
-                return new DefaultSettingsReader().read(reader, Collections.emptyMap());
+                return new DefaultSettingsReader().read(reader, Map.of());
             }
         }
         return new Settings();
diff --git a/devtools/maven/src/test/java/io/quarkus/maven/DependencyTreeMojoTestBase.java b/devtools/maven/src/test/java/io/quarkus/maven/DependencyTreeMojoTestBase.java
index c89f2e5f57a..1ff2aad86c4 100644
--- a/devtools/maven/src/test/java/io/quarkus/maven/DependencyTreeMojoTestBase.java
+++ b/devtools/maven/src/test/java/io/quarkus/maven/DependencyTreeMojoTestBase.java
@@ -20,7 +20,6 @@
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
-import io.quarkus.bootstrap.resolver.BootstrapAppModelResolver;
 import io.quarkus.bootstrap.resolver.TsArtifact;
 import io.quarkus.bootstrap.resolver.TsDependency;
 import io.quarkus.bootstrap.resolver.TsQuarkusExt;
@@ -48,7 +47,7 @@ public void setup() throws Exception {
                 .setRemoteRepositories(Collections.emptyList())
                 .build();
 
-        repoBuilder = TsRepoBuilder.getInstance(new BootstrapAppModelResolver(mvnResolver), workDir);
+        repoBuilder = TsRepoBuilder.getInstance(mvnResolver, workDir);
         initRepo();
     }
 
diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/CollectDependenciesBase.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/CollectDependenciesBase.java
index d939ed795b1..9217b3490e2 100644
--- a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/CollectDependenciesBase.java
+++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/CollectDependenciesBase.java
@@ -7,10 +7,10 @@
 import io.quarkus.maven.dependency.DependencyFlags;
 import java.nio.file.Path;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.stream.Collectors;
+import org.eclipse.aether.util.artifact.JavaScopes;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
@@ -21,8 +21,8 @@
 public abstract class CollectDependenciesBase extends ResolverSetupCleanup {
 
     protected TsArtifact root;
-    protected List<Dependency> expectedResult = Collections.emptyList();
-    protected List<Dependency> deploymentDeps = Collections.emptyList();
+    protected List<Dependency> expectedResult = List.of();
+    protected List<Dependency> deploymentDeps = List.of();
 
     @Override
     @BeforeEach
@@ -57,12 +57,12 @@ protected BootstrapAppModelResolver getTestResolver() throws Exception {
     }
 
     protected Path getInstallDir(TsArtifact artifact) {
-        return repoHome.resolve(artifact.getGroupId().replace('.', '/')).resolve(artifact.getArtifactId())
+        return getInstallDir().resolve(artifact.getGroupId().replace('.', '/')).resolve(artifact.getArtifactId())
                 .resolve(artifact.getVersion());
     }
 
     protected TsArtifact install(TsArtifact dep, boolean collected) {
-        return install(dep, collected ? "compile" : null);
+        return install(dep, collected ? JavaScopes.COMPILE : null);
     }
 
     protected TsArtifact install(TsArtifact dep, String collectedInScope) {
@@ -74,7 +74,7 @@ protected TsArtifact install(TsArtifact dep, String collectedInScope, boolean op
     }
 
     protected TsArtifact install(TsArtifact dep, Path p, boolean collected) {
-        return install(dep, p, collected ? "compile" : null, false);
+        return install(dep, p, collected ? JavaScopes.COMPILE : null, false);
     }
 
     protected TsArtifact install(TsArtifact dep, Path p, String collectedInScope, boolean optional) {
@@ -93,7 +93,7 @@ protected TsQuarkusExt install(TsQuarkusExt ext) {
     protected void install(TsQuarkusExt ext, boolean collected) {
         ext.install(repo);
         if (collected) {
-            addCollectedDep(ext.getRuntime(), "compile", false, DependencyFlags.RUNTIME_EXTENSION_ARTIFACT);
+            addCollectedDep(ext.getRuntime(), JavaScopes.COMPILE, false, DependencyFlags.RUNTIME_EXTENSION_ARTIFACT);
             addCollectedDeploymentDep(ext.getDeployment());
         }
     }
@@ -101,7 +101,7 @@ protected void install(TsQuarkusExt ext, boolean collected) {
     protected void installAsDep(TsQuarkusExt ext) {
         ext.install(repo);
         root.addDependency(ext);
-        addCollectedDep(ext.getRuntime(), "compile", false,
+        addCollectedDep(ext.getRuntime(), JavaScopes.COMPILE, false,
                 DependencyFlags.DIRECT | DependencyFlags.RUNTIME_EXTENSION_ARTIFACT
                         | DependencyFlags.TOP_LEVEL_RUNTIME_EXTENSION_ARTIFACT);
         addCollectedDeploymentDep(ext.getDeployment());
@@ -142,11 +142,11 @@ protected void installAsDep(TsDependency dep, Path p, boolean collected, int...
         for (int f : flags) {
             allFlags |= f;
         }
-        addCollectedDep(artifact, dep.scope == null ? "compile" : dep.scope, dep.optional, allFlags);
+        addCollectedDep(artifact, dep.scope == null ? JavaScopes.COMPILE : dep.scope, dep.optional, allFlags);
     }
 
     protected void addCollectedDep(final TsArtifact artifact, int... flags) {
-        addCollectedDep(artifact, "compile", false, flags);
+        addCollectedDep(artifact, JavaScopes.COMPILE, false, flags);
     }
 
     protected void addCollectedDep(final TsArtifact artifact, final String scope, boolean optional, int... flags) {
@@ -168,7 +168,7 @@ protected void addCollectedDeploymentDep(TsArtifact ext) {
             deploymentDeps = new ArrayList<>();
         }
         deploymentDeps
-                .add(new ArtifactDependency(ext.toArtifact(), "compile",
+                .add(new ArtifactDependency(ext.toArtifact(), JavaScopes.COMPILE,
                         DependencyFlags.DEPLOYMENT_CP));
     }
 
diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/ResolverSetupCleanup.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/ResolverSetupCleanup.java
index fe7f14a67b6..83c8da19979 100644
--- a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/ResolverSetupCleanup.java
+++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/ResolverSetupCleanup.java
@@ -4,11 +4,20 @@
 import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver;
 import io.quarkus.bootstrap.resolver.maven.workspace.LocalProject;
 import io.quarkus.bootstrap.util.IoUtils;
+import java.io.BufferedWriter;
 import java.io.IOException;
+import java.net.MalformedURLException;
+import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
+import org.apache.maven.settings.Activation;
+import org.apache.maven.settings.Profile;
+import org.apache.maven.settings.Repository;
+import org.apache.maven.settings.RepositoryPolicy;
+import org.apache.maven.settings.Settings;
+import org.apache.maven.settings.io.DefaultSettingsWriter;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 
@@ -19,7 +28,9 @@
 public class ResolverSetupCleanup {
 
     protected Path workDir;
-    protected Path repoHome;
+    private Path repoHome;
+    private Path localRepoHome;
+    private Path settingsXml;
     protected BootstrapAppModelResolver resolver;
     protected TsRepoBuilder repo;
 
@@ -30,8 +41,45 @@ public void setup() throws Exception {
         setSystemProperties();
         workDir = initWorkDir();
         repoHome = IoUtils.mkdirs(workDir.resolve("repo"));
+        if (setupCustomMavenRepoInSettings()) {
+            localRepoHome = IoUtils.mkdirs(workDir).resolve("local-repo");
+
+            final Settings settings = new Settings();
+            final Profile profile = new Profile();
+            final Activation activation = new Activation();
+            activation.setActiveByDefault(true);
+            profile.setActivation(activation);
+            final Repository repo = new Repository();
+            repo.setId("custom-repo");
+            repo.setName("Custom Test Repo");
+            repo.setLayout("default");
+            try {
+                repo.setUrl(repoHome.toUri().toURL().toExternalForm());
+            } catch (MalformedURLException e) {
+                throw new BootstrapMavenException("Failed to initialize Maven repo URL", e);
+            }
+            RepositoryPolicy policy = new RepositoryPolicy();
+            policy.setEnabled(true);
+            policy.setChecksumPolicy("ignore");
+            policy.setUpdatePolicy("never");
+            repo.setReleases(policy);
+            repo.setSnapshots(policy);
+            profile.setId("custom-repo");
+            profile.addRepository(repo);
+            settings.addProfile(profile);
+
+            settingsXml = workDir.resolve("settings.xml");
+            try (BufferedWriter writer = Files.newBufferedWriter(settingsXml)) {
+                new DefaultSettingsWriter().write(writer, Map.of(), settings);
+            } catch (IOException e) {
+                throw new BootstrapMavenException("Failed to persist settings.xml", e);
+            }
+        } else {
+            localRepoHome = repoHome;
+        }
+
         resolver = newAppModelResolver(null);
-        repo = TsRepoBuilder.getInstance(resolver, workDir);
+        repo = TsRepoBuilder.getInstance(newArtifactResolver(null, true), workDir);
     }
 
     @AfterEach
@@ -51,6 +99,22 @@ public void cleanup() {
         }
     }
 
+    protected Path getInstallDir() {
+        return repoHome;
+    }
+
+    /**
+     * Enabling this option will install all the artifacts to a Maven repo that
+     * will be enabled in the Maven settings as a remote repo for the test.
+     * Otherwise, all the artifacts will be installed in a Maven repo that will
+     * be configured as a local repo for the test.
+     *
+     * @return whether to setup a custom remote Maven repo for the test
+     */
+    protected boolean setupCustomMavenRepoInSettings() {
+        return false;
+    }
+
     protected void setSystemProperties() {
     }
 
@@ -68,6 +132,10 @@ protected Path initWorkDir() {
         return IoUtils.createRandomTmpDir();
     }
 
+    protected Path getSettingsXml() {
+        return settingsXml;
+    }
+
     protected boolean cleanWorkDir() {
         return true;
     }
@@ -85,12 +153,24 @@ protected BootstrapAppModelResolver newAppModelResolver(LocalProject currentProj
     }
 
     protected MavenArtifactResolver newArtifactResolver(LocalProject currentProject) throws BootstrapMavenException {
-        return MavenArtifactResolver.builder()
-                .setLocalRepository(repoHome.toString())
+        return newArtifactResolver(currentProject, false);
+    }
+
+    private MavenArtifactResolver newArtifactResolver(LocalProject currentProject, boolean forInstalling)
+            throws BootstrapMavenException {
+        final MavenArtifactResolver.Builder builder = MavenArtifactResolver.builder()
                 .setOffline(true)
                 .setWorkspaceDiscovery(false)
-                .setCurrentProject(currentProject)
-                .build();
+                .setCurrentProject(currentProject);
+        if (forInstalling) {
+            builder.setLocalRepository(repoHome.toString());
+        } else {
+            builder.setLocalRepository(localRepoHome.toString());
+            if (settingsXml != null) {
+                builder.setUserSettings(settingsXml.toFile()).setOffline(false);
+            }
+        }
+        return builder.build();
     }
 
     protected TsJar newJar() throws IOException {
diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/TsRepoBuilder.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/TsRepoBuilder.java
index 43b240a2c4c..2f1ff0e7b62 100644
--- a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/TsRepoBuilder.java
+++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/TsRepoBuilder.java
@@ -1,12 +1,16 @@
 package io.quarkus.bootstrap.resolver;
 
+import io.quarkus.bootstrap.resolver.maven.BootstrapMavenException;
+import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver;
 import io.quarkus.bootstrap.resolver.maven.workspace.ModelUtils;
 import io.quarkus.maven.dependency.ArtifactCoords;
 import java.io.BufferedWriter;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.util.Map;
 import java.util.UUID;
+import org.eclipse.aether.artifact.DefaultArtifact;
 
 /**
  *
@@ -18,14 +22,14 @@ private static void error(String message, Throwable t) {
         throw new IllegalStateException(message, t);
     }
 
-    public static TsRepoBuilder getInstance(BootstrapAppModelResolver resolver, Path workDir) {
+    public static TsRepoBuilder getInstance(MavenArtifactResolver resolver, Path workDir) {
         return new TsRepoBuilder(resolver, workDir);
     }
 
     protected final Path workDir;
-    private final BootstrapAppModelResolver resolver;
+    private final MavenArtifactResolver resolver;
 
-    private TsRepoBuilder(BootstrapAppModelResolver resolver, Path workDir) {
+    private TsRepoBuilder(MavenArtifactResolver resolver, Path workDir) {
         this.resolver = resolver;
         this.workDir = workDir;
     }
@@ -77,8 +81,10 @@ public void install(TsArtifact artifact, Path p) {
 
     protected void install(ArtifactCoords artifact, Path file) {
         try {
-            resolver.install(artifact, file);
-        } catch (AppModelResolverException e) {
+            resolver.install(new DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(),
+                    artifact.getType(),
+                    artifact.getVersion(), Map.of(), file.toFile()));
+        } catch (BootstrapMavenException e) {
             error("Failed to install " + artifact, e);
         }
     }
diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java
index 7f0dc13be3e..12f32324d52 100644
--- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java
+++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java
@@ -277,7 +277,7 @@ private ApplicationModel doResolveModel(ArtifactCoords coords,
 
         directMvnDeps = DependencyUtils.mergeDeps(directMvnDeps, appArtifactDescr.getDependencies(), managedVersions,
                 getExcludedScopes());
-        aggregatedRepos = mvn.aggregateRepositories(managedRepos,
+        aggregatedRepos = mvn.aggregateRepositories(aggregatedRepos,
                 mvn.newResolutionRepositories(appArtifactDescr.getRepositories()));
 
         return buildAppModel(appArtifact,
diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java
index d17c5161a23..f538d1a74d2 100644
--- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java
+++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java
@@ -148,7 +148,7 @@ public BootstrapMavenContext(BootstrapMavenContextConfig<?> config)
         if (config.rootProjectDir == null) {
             final String topLevelBaseDirStr = PropertyUtils.getProperty(MAVEN_TOP_LEVEL_PROJECT_BASEDIR);
             if (topLevelBaseDirStr != null) {
-                final Path tmp = Paths.get(topLevelBaseDirStr);
+                final Path tmp = Path.of(topLevelBaseDirStr);
                 if (!Files.exists(tmp)) {
                     throw new BootstrapMavenException("Top-level project base directory " + topLevelBaseDirStr
                             + " specified with system property " + MAVEN_TOP_LEVEL_PROJECT_BASEDIR + " does not exist");