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 14f7158b339b99..b636f3c06ab919 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 @@ -7,9 +7,9 @@ import org.jboss.logging.Logger; -import io.quarkus.bootstrap.BootstrapException; import io.quarkus.bootstrap.app.CuratedApplication; import io.quarkus.bootstrap.model.AppArtifactKey; +import io.quarkus.bootstrap.resolver.maven.BootstrapMavenException; import io.quarkus.bootstrap.resolver.maven.workspace.LocalProject; @SuppressWarnings("unused") @@ -32,7 +32,7 @@ public void accept(CuratedApplication curatedApplication, Map st } devModeContext.getAdditionalModules().add(toModule(module.getValue())); } - } catch (BootstrapException e) { + } catch (BootstrapMavenException e) { log.error("Failed to load workspace, hot reload will not be available", e); } diff --git a/core/runtime/pom.xml b/core/runtime/pom.xml index cd4fe010f2b8c7..a393a932f14e2b 100644 --- a/core/runtime/pom.xml +++ b/core/runtime/pom.xml @@ -123,6 +123,7 @@ org.graalvm.nativeimage:svm io.quarkus:quarkus-bootstrap-core io.quarkus:quarkus-development-mode-spi + io.quarkus:quarkus-bootstrap-app-model org.jboss.logmanager:jboss-logmanager-embedded org.jboss.logging:jboss-logging org.ow2.asm:asm diff --git a/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java index b560894b9ac450..2b5cbf79d7064e 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java @@ -44,7 +44,6 @@ import org.eclipse.aether.repository.RemoteRepository; import org.fusesource.jansi.Ansi; -import io.quarkus.bootstrap.resolver.AppModelResolverException; import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver; import io.quarkus.cli.commands.AddExtensions; import io.quarkus.cli.commands.CreateProject; @@ -144,7 +143,7 @@ public void execute() throws MojoExecutionException { .setRepositorySystem(repoSystem) .setRepositorySystemSession(repoSession) .setRemoteRepositories(repos).build(); - } catch (AppModelResolverException e1) { + } catch (Exception e1) { throw new MojoExecutionException("Failed to initialize Maven artifact resolver", e1); } final QuarkusPlatformDescriptor platform = CreateUtils.resolvePlatformDescriptor(bomGroupId, bomArtifactId, bomVersion, diff --git a/devtools/maven/src/main/java/io/quarkus/maven/GenerateConfigMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/GenerateConfigMojo.java index 05a32a49ff4aaa..376b11989d4c1c 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/GenerateConfigMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/GenerateConfigMojo.java @@ -26,7 +26,6 @@ import io.quarkus.bootstrap.app.CuratedApplication; import io.quarkus.bootstrap.app.QuarkusBootstrap; import io.quarkus.bootstrap.model.AppArtifact; -import io.quarkus.bootstrap.resolver.AppModelResolverException; import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver; import io.quarkus.runner.bootstrap.GenerateConfigTask; @@ -148,12 +147,9 @@ public void execute() throws MojoExecutionException { Path configFile = new File(target, name).toPath(); curatedApplication.runInAugmentClassLoader(GenerateConfigTask.class.getName(), Collections.singletonMap(GenerateConfigTask.CONFIG_FILE, configFile)); - - } catch (Exception e) { - throw new MojoExecutionException("Failed to generate config file", e); } - } catch (AppModelResolverException e) { - throw new RuntimeException(e); + } catch (Exception e) { + throw new MojoExecutionException("Failed to generate config file", e); } } } diff --git a/devtools/platform-descriptor-json-plugin/src/main/java/io/quarkus/maven/ValidateExtensionsJsonMojo.java b/devtools/platform-descriptor-json-plugin/src/main/java/io/quarkus/maven/ValidateExtensionsJsonMojo.java index e13645aad89f49..c7e0df7f7d33a7 100644 --- a/devtools/platform-descriptor-json-plugin/src/main/java/io/quarkus/maven/ValidateExtensionsJsonMojo.java +++ b/devtools/platform-descriptor-json-plugin/src/main/java/io/quarkus/maven/ValidateExtensionsJsonMojo.java @@ -26,7 +26,6 @@ import org.eclipse.aether.repository.RemoteRepository; import io.quarkus.bootstrap.BootstrapConstants; -import io.quarkus.bootstrap.resolver.AppModelResolverException; import io.quarkus.bootstrap.resolver.BootstrapAppModelResolver; import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver; import io.quarkus.dependencies.Extension; @@ -84,7 +83,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { .setRepositorySystemSession(repoSession) .setRemoteRepositories(repos) .build(); - } catch (AppModelResolverException e) { + } catch (Exception e) { throw new MojoExecutionException("Failed to initialize maven artifact resolver", e); } @@ -135,7 +134,7 @@ private Map collectBomExtensions(MavenArtifactResolver mvn, fi final List bomDeps; try { bomDeps = mvn.resolveDescriptor(platformBom).getManagedDependencies(); - } catch (AppModelResolverException e) { + } catch (Exception e) { throw new MojoExecutionException("Failed to resolve platform BOM " + platformBom, e); } @@ -151,7 +150,7 @@ private Map collectBomExtensions(MavenArtifactResolver mvn, fi } try { analyzeArtifact(mvn.resolve(artifact).getArtifact(), bomExtensions); - } catch (AppModelResolverException e) { + } catch (Exception e) { getLog().warn("Failed to resolve " + artifact + " from managed dependencies of BOM " + platformBom); } } diff --git a/docs/src/main/java/io/quarkus/docs/generation/AllConfigGenerator.java b/docs/src/main/java/io/quarkus/docs/generation/AllConfigGenerator.java index 89731ccc5f82df..f82e376e3f8e08 100644 --- a/docs/src/main/java/io/quarkus/docs/generation/AllConfigGenerator.java +++ b/docs/src/main/java/io/quarkus/docs/generation/AllConfigGenerator.java @@ -31,12 +31,12 @@ import io.quarkus.annotation.processor.generate_doc.ConfigDocSection; import io.quarkus.annotation.processor.generate_doc.ConfigDocWriter; import io.quarkus.annotation.processor.generate_doc.DocGeneratorUtil; -import io.quarkus.bootstrap.resolver.AppModelResolverException; +import io.quarkus.bootstrap.resolver.maven.BootstrapMavenException; import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver; import io.quarkus.docs.generation.ExtensionJson.Extension; public class AllConfigGenerator { - public static void main(String[] args) throws AppModelResolverException, IOException { + public static void main(String[] args) throws BootstrapMavenException, IOException { if (args.length != 2) { // exit 1 will break Maven throw new IllegalArgumentException("Usage: "); diff --git a/independent-projects/bootstrap/app-model/pom.xml b/independent-projects/bootstrap/app-model/pom.xml new file mode 100644 index 00000000000000..0dc319ac188eaf --- /dev/null +++ b/independent-projects/bootstrap/app-model/pom.xml @@ -0,0 +1,28 @@ + + + + quarkus-bootstrap-parent + io.quarkus + 999-SNAPSHOT + ../pom.xml + + 4.0.0 + + quarkus-bootstrap-app-model + Quarkus - Bootstrap - App Model + + + + org.jboss.logging + jboss-logging + + + org.jboss.logging + commons-logging-jboss-logging + runtime + + + + diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppArtifact.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifact.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppArtifact.java rename to independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifact.java diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppArtifactCoords.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifactCoords.java similarity index 94% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppArtifactCoords.java rename to independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifactCoords.java index d6d4f7d7c34064..d27aa8730845aa 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppArtifactCoords.java +++ b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifactCoords.java @@ -1,6 +1,5 @@ package io.quarkus.bootstrap.model; -import io.quarkus.bootstrap.BootstrapConstants; import java.io.Serializable; /** @@ -10,8 +9,8 @@ */ public class AppArtifactCoords implements Serializable { - public static final String TYPE_JAR = BootstrapConstants.JAR; - public static final String TYPE_POM = BootstrapConstants.POM; + public static final String TYPE_JAR = "jar"; + public static final String TYPE_POM = "pom"; public static AppArtifactCoords fromString(String str) { return new AppArtifactCoords(split(str, new String[5])); @@ -44,7 +43,7 @@ protected AppArtifactCoords(String[] parts) { } public AppArtifactCoords(String groupId, String artifactId, String version) { - this(groupId, artifactId, BootstrapConstants.EMPTY, TYPE_JAR, version); + this(groupId, artifactId, "", TYPE_JAR, version); } public AppArtifactCoords(String groupId, String artifactId, String type, String version) { diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppArtifactKey.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifactKey.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppArtifactKey.java rename to independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifactKey.java diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppDependency.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppDependency.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppDependency.java rename to independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppDependency.java diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppModel.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppModel.java similarity index 94% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppModel.java rename to independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppModel.java index 7c1fab6fc8f3eb..c3e842dd78adfc 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppModel.java +++ b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppModel.java @@ -1,6 +1,5 @@ package io.quarkus.bootstrap.model; -import io.quarkus.bootstrap.BootstrapConstants; import java.io.Serializable; import java.util.ArrayList; import java.util.HashSet; @@ -18,6 +17,10 @@ */ public class AppModel implements Serializable { + public static final String PARENT_FIRST_ARTIFACTS = "parent-first-artifacts"; + public static final String EXCLUDED_ARTIFACTS = "excluded-artifacts"; + public static final String LESSER_PRIORITY_ARTIFACTS = "lesser-priority-artifacts"; + private static final Logger log = Logger.getLogger(AppModel.class); private final AppArtifact appArtifact; @@ -177,14 +180,14 @@ public Builder addLesserPriorityArtifacts(List deps) { * @param props The quarkus-extension.properties file */ public void handleExtensionProperties(Properties props, String extension) { - String parentFirst = props.getProperty(BootstrapConstants.PARENT_FIRST_ARTIFACTS); + String parentFirst = props.getProperty(PARENT_FIRST_ARTIFACTS); if (parentFirst != null) { String[] artifacts = parentFirst.split(","); for (String artifact : artifacts) { parentFirstArtifacts.add(new AppArtifactKey(artifact.split(":"))); } } - String excluded = props.getProperty(BootstrapConstants.EXCLUDED_ARTIFACTS); + String excluded = props.getProperty(EXCLUDED_ARTIFACTS); if (excluded != null) { String[] artifacts = excluded.split(","); for (String artifact : artifacts) { @@ -192,7 +195,7 @@ public void handleExtensionProperties(Properties props, String extension) { log.debugf("Extension %s is excluding %s", extension, artifact); } } - String lesserPriority = props.getProperty(BootstrapConstants.LESSER_PRIORITY_ARTIFACTS); + String lesserPriority = props.getProperty(LESSER_PRIORITY_ARTIFACTS); if (lesserPriority != null) { String[] artifacts = lesserPriority.split(","); for (String artifact : artifacts) { diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/PathsCollection.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/PathsCollection.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/PathsCollection.java rename to independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/PathsCollection.java diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/PersistentAppModel.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/PersistentAppModel.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/PersistentAppModel.java rename to independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/PersistentAppModel.java diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/AppModelResolver.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/resolver/AppModelResolver.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/AppModelResolver.java rename to independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/resolver/AppModelResolver.java diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/AppModelResolverException.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/resolver/AppModelResolverException.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/AppModelResolverException.java rename to independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/resolver/AppModelResolverException.java diff --git a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/resolver/workspace/BuildOutcome.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/resolver/workspace/BuildOutcome.java new file mode 100644 index 00000000000000..5bed76494b45b6 --- /dev/null +++ b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/resolver/workspace/BuildOutcome.java @@ -0,0 +1,16 @@ +package io.quarkus.bootstrap.resolver.workspace; + +import io.quarkus.bootstrap.model.PathsCollection; +import java.nio.file.Path; + +/** + * Represents an outcome of the build for a specific set of sources and resources. + */ +public interface BuildOutcome { + + Path getOutputDir(); + + PathsCollection getSourcesDirs(); + + PathsCollection getResourcesDirs(); +} diff --git a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/resolver/workspace/Workspace.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/resolver/workspace/Workspace.java new file mode 100644 index 00000000000000..a30391262ddc94 --- /dev/null +++ b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/resolver/workspace/Workspace.java @@ -0,0 +1,15 @@ +package io.quarkus.bootstrap.resolver.workspace; + +import io.quarkus.bootstrap.model.AppArtifactKey; +import java.util.Collection; + +public interface Workspace { + + default M getProject(String groupId, String artifactId) { + return getProject(new AppArtifactKey(groupId, artifactId)); + } + + M getProject(AppArtifactKey key); + + Collection getAllProjects(); +} diff --git a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/resolver/workspace/WorkspaceProject.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/resolver/workspace/WorkspaceProject.java new file mode 100644 index 00000000000000..3167ace019df77 --- /dev/null +++ b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/resolver/workspace/WorkspaceProject.java @@ -0,0 +1,56 @@ +package io.quarkus.bootstrap.resolver.workspace; + +import io.quarkus.bootstrap.model.AppArtifact; +import io.quarkus.bootstrap.model.AppArtifactKey; +import java.nio.file.Path; +import java.util.Collection; + +/** + * Represents a project in a workspace + */ +public interface WorkspaceProject { + + String getGroupId(); + + String getArtifactId(); + + String getVersion(); + + /** + * Project location on the filesystem + * + * @return project location + */ + Path getDir(); + + /** + * Project's key consisting of its group and artifact IDs + * + * @return project's key + */ + AppArtifactKey getKey(); + + /** + * Where the main build outcome can be located and from which + * sources and resources it was produced + * + * @return main build outcome + */ + Collection getMainOutcome(); + + /** + * Where the test build outcome can be located and from which + * sources and resources it was produced + * + * @return test build outcome + */ + Collection getTestOutcome(); + + default AppArtifact getAppArtifact(String extension) { + return getAppArtifact("", extension); + } + + default AppArtifact getAppArtifact(String classifier, String extension) { + return new AppArtifact(getGroupId(), getArtifactId(), classifier, extension, getVersion()); + } +} diff --git a/independent-projects/bootstrap/core/pom.xml b/independent-projects/bootstrap/core/pom.xml index da52c0c4f5a5cd..ea96784d00c534 100644 --- a/independent-projects/bootstrap/core/pom.xml +++ b/independent-projects/bootstrap/core/pom.xml @@ -15,71 +15,8 @@ - org.ow2.asm - asm - - - org.apache.maven - maven-embedder - - - org.eclipse.sisu - org.eclipse.sisu.plexus - - - org.apache.maven - maven-settings-builder - - - org.apache.maven - maven-resolver-provider - - - org.apache.maven.resolver - maven-resolver-connector-basic - - - org.apache.maven.resolver - maven-resolver-transport-wagon - - - org.apache.maven.wagon - wagon-provider-api - - - - - org.apache.maven.wagon - wagon-http - - - org.slf4j - jcl-over-slf4j - - - org.slf4j - slf4j-simple - - - - - org.apache.maven.wagon - wagon-file - - - org.slf4j - slf4j-simple - - - - - org.jboss.logging - jboss-logging - - - org.jboss.logging - commons-logging-jboss-logging - runtime + io.quarkus + quarkus-bootstrap-maven-resolver org.junit.jupiter @@ -95,12 +32,6 @@ - - - src/main/resources - true - - org.apache.maven.plugins diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java index 73932e4aae1461..b1b70a80f78fe6 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java @@ -10,6 +10,7 @@ import io.quarkus.bootstrap.resolver.BootstrapAppModelResolver; import io.quarkus.bootstrap.resolver.maven.BootstrapMavenContext; import io.quarkus.bootstrap.resolver.maven.BootstrapMavenContextConfig; +import io.quarkus.bootstrap.resolver.maven.BootstrapMavenException; import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver; import io.quarkus.bootstrap.resolver.maven.workspace.LocalProject; import io.quarkus.bootstrap.resolver.maven.workspace.LocalWorkspace; @@ -200,7 +201,11 @@ private BootstrapMavenContext createBootstrapMavenContext() throws AppModelResol config.setCurrentProject(projectRoot.toString()); } config.setWorkspaceDiscovery(isWorkspaceDiscoveryEnabled()); - return mvnContext = new BootstrapMavenContext(config); + try { + return mvnContext = new BootstrapMavenContext(config); + } catch (BootstrapMavenException e) { + throw new AppModelResolverException("Failed to initialize bootstrap Maven context", e); + } } public CurationResult resolveAppModel() throws BootstrapException { diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapConstants.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapConstants.java index 256464ac0044c2..79c9c5d61a1eeb 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapConstants.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapConstants.java @@ -1,5 +1,7 @@ package io.quarkus.bootstrap; +import io.quarkus.bootstrap.model.AppArtifactCoords; + /** * * @author Alexey Loubyansky @@ -24,6 +26,6 @@ public interface BootstrapConstants { String LESSER_PRIORITY_ARTIFACTS = "lesser-priority-artifacts"; String EMPTY = ""; - String JAR = "jar"; - String POM = "pom"; + String JAR = AppArtifactCoords.TYPE_JAR; + String POM = AppArtifactCoords.TYPE_POM; } diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java index e0e0ecc292d036..f2b975867ed20d 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java @@ -6,6 +6,7 @@ import io.quarkus.bootstrap.model.AppDependency; import io.quarkus.bootstrap.model.AppModel; import io.quarkus.bootstrap.model.PathsCollection; +import io.quarkus.bootstrap.resolver.maven.BootstrapMavenException; import io.quarkus.bootstrap.resolver.maven.BuildDependencyGraphVisitor; import io.quarkus.bootstrap.resolver.maven.DeploymentInjectingDependencyVisitor; import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver; @@ -91,7 +92,12 @@ public Path resolve(AppArtifact artifact) throws AppModelResolverException { if (artifact.isResolved()) { return artifact.getPaths().iterator().next(); } - final Path path = mvn.resolve(toAetherArtifact(artifact)).getArtifact().getFile().toPath(); + Path path; + try { + path = mvn.resolve(toAetherArtifact(artifact)).getArtifact().getFile().toPath(); + } catch (BootstrapMavenException e) { + throw new AppModelResolverException("Failed to resolve " + artifact, e); + } artifact.setPaths(PathsCollection.of(path)); return path; } @@ -124,7 +130,11 @@ public boolean visitLeave(DependencyNode node) { return true; } }); - mvn.resolveDependencies(toAetherArtifact(appArtifact), mvnDeps).getRoot().accept(visitor); + try { + mvn.resolveDependencies(toAetherArtifact(appArtifact), mvnDeps).getRoot().accept(visitor); + } catch (BootstrapMavenException e) { + throw new AppModelResolverException("Failed to resolve user configured dependencies of " + appArtifact, e); + } return result; } @@ -155,7 +165,13 @@ private AppModel doResolveModel(AppArtifact appArtifact, List direct List managedDeps = Collections.emptyList(); List managedRepos = Collections.emptyList(); if (managingProject != null) { - final ArtifactDescriptorResult managingDescr = mvn.resolveDescriptor(toAetherArtifact(managingProject)); + ArtifactDescriptorResult managingDescr; + try { + managingDescr = mvn.resolveDescriptor(toAetherArtifact(managingProject)); + } catch (BootstrapMavenException e) { + throw new AppModelResolverException( + "Failed to resolve the descriptor of " + managingProject + " as the managing project", e); + } managedDeps = managingDescr.getManagedDependencies(); managedRepos = mvn.newResolutionRepositories(managingDescr.getRepositories()); } @@ -168,14 +184,24 @@ private AppModel doResolveModel(AppArtifact appArtifact, List direct } if (!appArtifact.isResolved()) { - final ArtifactResult resolveResult = mvn.resolve(mvnArtifact, managedRepos); + ArtifactResult resolveResult; + try { + resolveResult = mvn.resolve(mvnArtifact, managedRepos); + } catch (BootstrapMavenException e) { + throw new AppModelResolverException("Failed to resolve the application root artifact " + mvnArtifact, e); + } appArtifact.setPaths(PathsCollection.of(resolveResult.getArtifact().getFile().toPath())); } final Set appDeps = new HashSet<>(); final List userDeps = new ArrayList<>(); - DependencyNode resolvedDeps = mvn.resolveManagedDependencies(mvnArtifact, - directMvnDeps, managedDeps, managedRepos, excludedScopes.toArray(new String[0])).getRoot(); + DependencyNode resolvedDeps; + try { + resolvedDeps = mvn.resolveManagedDependencies(mvnArtifact, + directMvnDeps, managedDeps, managedRepos, excludedScopes.toArray(new String[0])).getRoot(); + } catch (BootstrapMavenException e) { + throw new AppModelResolverException("Failed to resolve " + mvnArtifact + " dependencies", e); + } final TreeDependencyVisitor visitor = new TreeDependencyVisitor(new DependencyVisitor() { @Override @@ -198,7 +224,12 @@ public boolean visitLeave(DependencyNode node) { child.accept(visitor); } - final ArtifactDescriptorResult appArtifactDescr = mvn.resolveDescriptor(toAetherArtifact(appArtifact)); + ArtifactDescriptorResult appArtifactDescr; + try { + appArtifactDescr = mvn.resolveDescriptor(toAetherArtifact(appArtifact)); + } catch (BootstrapMavenException e) { + throw new AppModelResolverException("Failed to resolve "); + } if (managingProject == null) { managedDeps = appArtifactDescr.getManagedDependencies(); } else { @@ -245,7 +276,12 @@ public boolean visitLeave(DependencyNode node) { buildDepsVisitor.visit(resolvedDeps); final List requests = buildDepsVisitor.getArtifactRequests(); if (!requests.isEmpty()) { - final List results = mvn.resolve(requests); + List results; + try { + results = mvn.resolve(requests); + } catch (BootstrapMavenException e) { + throw new AppModelResolverException("Failed to resolve build dependencies of " + mvnArtifact, e); + } // update the artifacts in the graph for (ArtifactResult result : results) { final Artifact artifact = result.getArtifact(); @@ -309,12 +345,20 @@ public String getLatestVersionFromRange(AppArtifact appArtifact, String range) t } public List resolveArtifactRepos(AppArtifact appArtifact) throws AppModelResolverException { - return mvn.resolveDescriptor(toAetherArtifact(appArtifact)).getRepositories(); + try { + return mvn.resolveDescriptor(toAetherArtifact(appArtifact)).getRepositories(); + } catch (BootstrapMavenException e) { + throw new AppModelResolverException("Failed to resolve repositories for " + appArtifact, e); + } } public void install(AppArtifact appArtifact, Path localPath) throws AppModelResolverException { - mvn.install(new DefaultArtifact(appArtifact.getGroupId(), appArtifact.getArtifactId(), appArtifact.getClassifier(), - appArtifact.getType(), appArtifact.getVersion(), Collections.emptyMap(), localPath.toFile())); + try { + mvn.install(new DefaultArtifact(appArtifact.getGroupId(), appArtifact.getArtifactId(), appArtifact.getClassifier(), + appArtifact.getType(), appArtifact.getVersion(), Collections.emptyMap(), localPath.toFile())); + } catch (BootstrapMavenException e) { + throw new AppModelResolverException("Failed to install " + localPath + " as " + appArtifact, e); + } } private AppArtifactKey getKey(final Artifact artifact) { @@ -363,8 +407,12 @@ private VersionRangeResult resolveVersionRangeResult(AppArtifact appArtifact, St private VersionRangeResult resolveVersionRangeResult(AppArtifact appArtifact, String range) throws AppModelResolverException { - return mvn.resolveVersionRange(new DefaultArtifact(appArtifact.getGroupId(), - appArtifact.getArtifactId(), appArtifact.getType(), range)); + try { + return mvn.resolveVersionRange(new DefaultArtifact(appArtifact.getGroupId(), + appArtifact.getArtifactId(), appArtifact.getType(), range)); + } catch (BootstrapMavenException e) { + throw new AppModelResolverException("Failed to resolve version range " + range + " for " + appArtifact, e); + } } static List toAppDepList(DependencyNode rootNode) { diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/DeploymentInjectingDependencyVisitor.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/DeploymentInjectingDependencyVisitor.java index 2619a0d806cb5c..a5aa7028b1274d 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/DeploymentInjectingDependencyVisitor.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/DeploymentInjectingDependencyVisitor.java @@ -3,7 +3,6 @@ import io.quarkus.bootstrap.BootstrapConstants; import io.quarkus.bootstrap.BootstrapDependencyProcessingException; import io.quarkus.bootstrap.model.AppModel; -import io.quarkus.bootstrap.resolver.AppModelResolverException; import io.quarkus.bootstrap.util.ZipUtils; import java.io.BufferedReader; import java.io.File; @@ -159,7 +158,7 @@ private DependencyNode collectDependencies(Artifact artifact) throws BootstrapDe .collectManagedDependencies(artifact, Collections.emptyList(), managedDeps, mainRepos, "test", "provided") .getRoot(); - } catch (AppModelResolverException e) { + } catch (BootstrapMavenException e) { throw new DeploymentInjectionException(e); } } @@ -171,7 +170,7 @@ private Path resolve(Artifact artifact) { } try { return resolver.resolve(artifact).getArtifact().getFile().toPath(); - } catch (AppModelResolverException e) { + } catch (BootstrapMavenException e) { throw new DeploymentInjectionException(e); } } diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenRepoInitializer.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenRepoInitializer.java deleted file mode 100644 index d0b15919fce6db..00000000000000 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenRepoInitializer.java +++ /dev/null @@ -1,508 +0,0 @@ -package io.quarkus.bootstrap.resolver.maven; - -import io.quarkus.bootstrap.resolver.AppModelResolverException; -import io.quarkus.bootstrap.resolver.maven.options.BootstrapMavenOptions; -import io.quarkus.bootstrap.util.PropertyUtils; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import org.apache.maven.model.building.ModelBuilder; -import org.apache.maven.model.building.ModelProblemCollector; -import org.apache.maven.model.building.ModelProblemCollectorRequest; -import org.apache.maven.model.path.DefaultPathTranslator; -import org.apache.maven.model.profile.DefaultProfileActivationContext; -import org.apache.maven.model.profile.DefaultProfileSelector; -import org.apache.maven.model.profile.activation.FileProfileActivator; -import org.apache.maven.model.profile.activation.JdkVersionProfileActivator; -import org.apache.maven.model.profile.activation.OperatingSystemProfileActivator; -import org.apache.maven.model.profile.activation.PropertyProfileActivator; -import org.apache.maven.model.resolution.WorkspaceModelResolver; -import org.apache.maven.repository.internal.MavenRepositorySystemUtils; -import org.apache.maven.settings.Mirror; -import org.apache.maven.settings.Profile; -import org.apache.maven.settings.Server; -import org.apache.maven.settings.Settings; -import org.apache.maven.settings.SettingsUtils; -import org.apache.maven.settings.building.DefaultSettingsBuilderFactory; -import org.apache.maven.settings.building.DefaultSettingsBuildingRequest; -import org.apache.maven.settings.building.SettingsBuildingException; -import org.apache.maven.settings.building.SettingsBuildingResult; -import org.apache.maven.settings.building.SettingsProblem; -import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest; -import org.apache.maven.settings.crypto.SettingsDecryptionResult; -import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; -import org.codehaus.plexus.util.xml.Xpp3Dom; -import org.eclipse.aether.ConfigurationProperties; -import org.eclipse.aether.DefaultRepositorySystemSession; -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory; -import org.eclipse.aether.impl.DefaultServiceLocator; -import org.eclipse.aether.repository.ArtifactRepository; -import org.eclipse.aether.repository.Authentication; -import org.eclipse.aether.repository.LocalRepository; -import org.eclipse.aether.repository.Proxy; -import org.eclipse.aether.repository.RemoteRepository; -import org.eclipse.aether.repository.RepositoryPolicy; -import org.eclipse.aether.spi.connector.RepositoryConnectorFactory; -import org.eclipse.aether.spi.connector.transport.TransporterFactory; -import org.eclipse.aether.transport.wagon.WagonProvider; -import org.eclipse.aether.transport.wagon.WagonTransporterFactory; -import org.eclipse.aether.util.repository.AuthenticationBuilder; -import org.eclipse.aether.util.repository.DefaultAuthenticationSelector; -import org.eclipse.aether.util.repository.DefaultMirrorSelector; -import org.eclipse.aether.util.repository.DefaultProxySelector; -import org.jboss.logging.Logger; - -/** - * @deprecated in favor of {@link io.quarkus.bootstrap.resolver.maven.BootstrapMavenContext} - * - * @author Alexey Loubyansky - */ -@Deprecated -public class MavenRepoInitializer { - - private static final String DEFAULT_REMOTE_REPO_ID = "central"; - private static final String DEFAULT_REMOTE_REPO_URL = "https://repo.maven.apache.org/maven2"; - - private static final String BASEDIR = "basedir"; - private static final String DOT_M2 = ".m2"; - private static final String MAVEN_DOT_HOME = "maven.home"; - private static final String MAVEN_HOME = "MAVEN_HOME"; - private static final String SETTINGS_XML = "settings.xml"; - - private static final String userHome = PropertyUtils.getUserHome(); - private static final File userMavenConfigurationHome = new File(userHome, DOT_M2); - private static final String envM2Home = System.getenv(MAVEN_HOME); - private static final File USER_SETTINGS_FILE; - private static final File GLOBAL_SETTINGS_FILE; - - private static final String ALTERNATE_USER_SETTINGS = "s"; - private static final String ALTERNATE_GLOBAL_SETTINGS = "gs"; - private static final String ALTERNATE_POM_FILE = "f"; - private static final String OFFLINE = "o"; - private static final String SUPRESS_SNAPSHOT_UPDATES = "nsu"; - private static final String UPDATE_SNAPSHOTS = "U"; - private static final String CHECKSUM_FAILURE_POLICY = "C"; - private static final String CHECKSUM_WARNING_POLICY = "c"; - - private static final BootstrapMavenOptions mvnArgs; - - static { - mvnArgs = BootstrapMavenOptions.newInstance(); - final String userSettings = mvnArgs.getOptionValue(ALTERNATE_USER_SETTINGS); - final String globalSettings = mvnArgs.getOptionValue(ALTERNATE_GLOBAL_SETTINGS); - - File f = userSettings != null ? resolveUserSettings(userSettings) : new File(userMavenConfigurationHome, SETTINGS_XML); - USER_SETTINGS_FILE = f != null && f.exists() ? f : null; - - f = globalSettings != null ? resolveUserSettings(globalSettings) - : new File(PropertyUtils.getProperty(MAVEN_DOT_HOME, envM2Home != null ? envM2Home : ""), "conf/settings.xml"); - GLOBAL_SETTINGS_FILE = f != null && f.exists() ? f : null; - } - - private static File resolveUserSettings(String settingsArg) { - File userSettings = new File(settingsArg); - if (userSettings.exists()) { - return userSettings; - } - String base = System.getenv("MAVEN_PROJECTBASEDIR"); // Root project base dir - if (base != null) { - userSettings = new File(base, settingsArg); - if (userSettings.exists()) { - return userSettings; - } - } - base = PropertyUtils.getProperty(BASEDIR); // current module project base dir - if (base != null) { - userSettings = new File(base, settingsArg); - if (userSettings.exists()) { - return userSettings; - } - } - userSettings = new File(userHome, settingsArg); - if (userSettings.exists()) { - return userSettings; - } - return null; - } - - private static Settings settings; - - private static final Logger log = Logger.getLogger(MavenRepoInitializer.class); - - public static RepositorySystem getRepositorySystem() { - return getRepositorySystem(false, null); - } - - /** - * Parsed Maven command line options obtained from the value of MAVEN_CMD_LINE_ARGS environment - * variable which is usually set by the Maven CLI. - * - * @return parsed Maven command line arguments - */ - public static BootstrapMavenOptions getBootstrapMavenOptions() { - return mvnArgs; - } - - public static RepositorySystem getRepositorySystem(boolean offline, WorkspaceModelResolver wsModelResolver) { - final DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator(); - if (!offline) { - locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class); - locator.addService(TransporterFactory.class, WagonTransporterFactory.class); - locator.setServices(WagonProvider.class, new BootstrapWagonProvider()); - } - try { - locator.setServices(ModelBuilder.class, new MavenModelBuilder(wsModelResolver, mvnArgs, - wsModelResolver == null ? Collections.emptyList() : getActiveSettingsProfiles())); - } catch (AppModelResolverException e) { - throw new IllegalStateException("Failed to resolve active settings profiles", e); - } - locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() { - @Override - public void serviceCreationFailed(Class type, Class impl, Throwable exception) { - log.error("Failed to initialize " + impl.getName() + " as a service implementing " + type.getName(), exception); - } - }); - return locator.getService(RepositorySystem.class); - } - - public static DefaultRepositorySystemSession newSession(RepositorySystem system) throws AppModelResolverException { - return newSession(system, getSettings()); - } - - public static DefaultRepositorySystemSession newSession(RepositorySystem system, Settings settings) { - final DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession(); - - final List mirrors = settings.getMirrors(); - if (mirrors != null && !mirrors.isEmpty()) { - final DefaultMirrorSelector ms = new DefaultMirrorSelector(); - for (Mirror m : mirrors) { - ms.add(m.getId(), m.getUrl(), m.getLayout(), false, m.getMirrorOf(), m.getMirrorOfLayouts()); - } - session.setMirrorSelector(ms); - } - final String localRepoPath = getLocalRepo(settings); - session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, new LocalRepository(localRepoPath))); - - session.setOffline(settings.isOffline()); - - if (!mvnArgs.isEmpty()) { - if (!session.isOffline() && mvnArgs.hasOption(OFFLINE)) { - session.setOffline(true); - } - if (mvnArgs.hasOption(SUPRESS_SNAPSHOT_UPDATES)) { - session.setUpdatePolicy(RepositoryPolicy.UPDATE_POLICY_NEVER); - } else if (mvnArgs.hasOption(UPDATE_SNAPSHOTS)) { - session.setUpdatePolicy(RepositoryPolicy.UPDATE_POLICY_ALWAYS); - } - if (mvnArgs.hasOption(CHECKSUM_FAILURE_POLICY)) { - session.setChecksumPolicy(RepositoryPolicy.CHECKSUM_POLICY_FAIL); - } else if (mvnArgs.hasOption(CHECKSUM_WARNING_POLICY)) { - session.setChecksumPolicy(RepositoryPolicy.CHECKSUM_POLICY_WARN); - } - } - - final DefaultSettingsDecryptionRequest decrypt = new DefaultSettingsDecryptionRequest(); - decrypt.setProxies(settings.getProxies()); - decrypt.setServers(settings.getServers()); - final SettingsDecryptionResult decrypted = new SettingsDecrypterImpl().decrypt(decrypt); - if (!decrypted.getProblems().isEmpty() && log.isDebugEnabled()) { - // this is how maven handles these - for (SettingsProblem p : decrypted.getProblems()) { - log.debug(p.getMessage(), p.getException()); - } - } - - final DefaultProxySelector proxySelector = new DefaultProxySelector(); - for (org.apache.maven.settings.Proxy p : decrypted.getProxies()) { - proxySelector.add(toAetherProxy(p), p.getNonProxyHosts()); - } - session.setProxySelector(proxySelector); - - final Map configProps = new LinkedHashMap<>(); - configProps.put(ConfigurationProperties.USER_AGENT, getUserAgent()); - configProps.put(ConfigurationProperties.INTERACTIVE, settings.isInteractiveMode()); - configProps.putAll(System.getProperties()); - - final DefaultAuthenticationSelector authSelector = new DefaultAuthenticationSelector(); - for (Server server : decrypted.getServers()) { - AuthenticationBuilder authBuilder = new AuthenticationBuilder(); - authBuilder.addUsername(server.getUsername()).addPassword(server.getPassword()); - authBuilder.addPrivateKey(server.getPrivateKey(), server.getPassphrase()); - authSelector.add(server.getId(), authBuilder.build()); - - if (server.getConfiguration() != null) { - Xpp3Dom dom = (Xpp3Dom) server.getConfiguration(); - for (int i = dom.getChildCount() - 1; i >= 0; i--) { - Xpp3Dom child = dom.getChild(i); - if ("wagonProvider".equals(child.getName())) { - dom.removeChild(i); - } - } - XmlPlexusConfiguration config = new XmlPlexusConfiguration(dom); - configProps.put("aether.connector.wagon.config." + server.getId(), config); - } - configProps.put("aether.connector.perms.fileMode." + server.getId(), server.getFilePermissions()); - configProps.put("aether.connector.perms.dirMode." + server.getId(), server.getDirectoryPermissions()); - } - session.setAuthenticationSelector(authSelector); - - session.setConfigProperties(configProps); - - return session; - } - - public static List getRemoteRepos(RepositorySystem repoSystem, RepositorySystemSession repoSession) - throws AppModelResolverException { - return Collections.unmodifiableList(getRemoteRepos(getSettings(), repoSystem, repoSession)); - } - - public static List getRemoteRepos(Settings settings) throws AppModelResolverException { - final RepositorySystem system = getRepositorySystem(); - return getRemoteRepos(settings, system, newSession(system, settings)); - } - - public static List getRemoteRepos(Settings settings, RepositorySystem repoSystem, - RepositorySystemSession repoSession) throws AppModelResolverException { - List remotes = new ArrayList<>(); - - final int profilesTotal = settings.getProfiles().size(); - if (profilesTotal > 0) { - for (org.apache.maven.model.Profile modelProfile : getActiveSettingsProfiles(settings)) { - addProfileRepos(modelProfile, remotes); - } - } - - // central must be there - if (remotes.isEmpty() || !includesDefaultRepo(remotes)) { - remotes.add(new RemoteRepository.Builder(DEFAULT_REMOTE_REPO_ID, "default", DEFAULT_REMOTE_REPO_URL) - .setReleasePolicy(new RepositoryPolicy(true, RepositoryPolicy.UPDATE_POLICY_DAILY, - RepositoryPolicy.CHECKSUM_POLICY_WARN)) - .setSnapshotPolicy(new RepositoryPolicy(false, RepositoryPolicy.UPDATE_POLICY_DAILY, - RepositoryPolicy.CHECKSUM_POLICY_WARN)) - .build()); - } - - return repoSystem.newResolutionRepositories(repoSession, remotes); - } - - public static List getActiveSettingsProfiles() throws AppModelResolverException { - return getActiveSettingsProfiles(getSettings()); - } - - public static List getActiveSettingsProfiles(Settings settings) - throws AppModelResolverException { - final int profilesTotal = settings.getProfiles().size(); - if (profilesTotal == 0) { - return Collections.emptyList(); - } - List modelProfiles = new ArrayList<>(profilesTotal); - for (Profile profile : settings.getProfiles()) { - modelProfiles.add(SettingsUtils.convertFromSettingsProfile(profile)); - } - - List activeProfiles = mvnArgs.getActiveProfileIds(); - final List inactiveProfiles = mvnArgs.getInactiveProfileIds(); - - final Path currentPom = getCurrentProjectPomOrNull(); - final DefaultProfileActivationContext context = new DefaultProfileActivationContext() - .setActiveProfileIds(activeProfiles) - .setInactiveProfileIds(inactiveProfiles) - .setSystemProperties(System.getProperties()) - .setProjectDirectory(currentPom == null ? getCurrentDir().toFile() : currentPom.getParent().toFile()); - final DefaultProfileSelector profileSelector = new DefaultProfileSelector() - .addProfileActivator(new PropertyProfileActivator()) - .addProfileActivator(new JdkVersionProfileActivator()) - .addProfileActivator(new OperatingSystemProfileActivator()) - .addProfileActivator(new FileProfileActivator().setPathTranslator(new DefaultPathTranslator())); - modelProfiles = profileSelector.getActiveProfiles(modelProfiles, context, new ModelProblemCollector() { - public void add(ModelProblemCollectorRequest req) { - log.error("Failed to activate a Maven profile: " + req.getMessage()); - } - }); - - activeProfiles = settings.getActiveProfiles(); - if (!activeProfiles.isEmpty()) { - for (String profileName : activeProfiles) { - final Profile profile = getProfile(profileName, settings); - if (profile != null) { - modelProfiles.add(SettingsUtils.convertFromSettingsProfile(profile)); - } - } - } - - return modelProfiles; - } - - static Path getCurrentProjectPomOrNull() { - String pomName = mvnArgs.getOptionValue(ALTERNATE_POM_FILE); - if (pomName == null) { - pomName = "pom.xml"; - } - Path pom = Paths.get(pomName); - if (!pom.isAbsolute()) { - pom = getCurrentDir().resolve(pom); - } - if (Files.isDirectory(pom)) { - pom = pom.resolve("pom.xml"); - } - return Files.exists(pom) ? pom : null; - } - - private static Path getCurrentDir() { - final String basedirProp = PropertyUtils.getProperty(BASEDIR); - return basedirProp == null ? Paths.get("").normalize().toAbsolutePath() : Paths.get(basedirProp); - } - - /** - * Convert a {@link org.apache.maven.settings.Proxy} to a {@link Proxy}. - * - * @param proxy Maven proxy settings, may be {@code null}. - * @return Aether repository proxy or {@code null} if given {@link org.apache.maven.settings.Proxy} is {@code null}. - */ - private static Proxy toAetherProxy(org.apache.maven.settings.Proxy proxy) { - if (proxy == null) { - return null; - } - Authentication auth = null; - if (proxy.getUsername() != null) { - auth = new AuthenticationBuilder() - .addUsername(proxy.getUsername()) - .addPassword(proxy.getPassword()) - .build(); - } - return new Proxy(proxy.getProtocol(), proxy.getHost(), proxy.getPort(), auth); - } - - private static Profile getProfile(String name, Settings settings) throws AppModelResolverException { - final Profile profile = settings.getProfilesAsMap().get(name); - if (profile == null) { - unrecognizedProfile(name, true); - } - return profile; - } - - private static void unrecognizedProfile(String name, boolean activate) { - final StringBuilder buf = new StringBuilder(); - buf.append("The requested Maven profile \"").append(name).append("\" could not be "); - if (!activate) { - buf.append("de"); - } - buf.append("activated because it does not exist."); - log.warn(buf.toString()); - } - - private static void addProfileRepos(final org.apache.maven.model.Profile profile, final List all) { - final List repositories = profile.getRepositories(); - for (org.apache.maven.model.Repository repo : repositories) { - final RemoteRepository.Builder repoBuilder = new RemoteRepository.Builder(repo.getId(), repo.getLayout(), - repo.getUrl()); - org.apache.maven.model.RepositoryPolicy policy = repo.getReleases(); - if (policy != null) { - repoBuilder.setReleasePolicy(toAetherRepoPolicy(policy)); - } - policy = repo.getSnapshots(); - if (policy != null) { - repoBuilder.setSnapshotPolicy(toAetherRepoPolicy(policy)); - } - all.add(repoBuilder.build()); - } - } - - public static Settings getSettings() throws AppModelResolverException { - if (settings != null) { - return settings; - } - final Settings effectiveSettings; - try { - final SettingsBuildingResult result = new DefaultSettingsBuilderFactory() - .newInstance().build(new DefaultSettingsBuildingRequest() - .setSystemProperties(System.getProperties()) - .setUserSettingsFile(USER_SETTINGS_FILE) - .setGlobalSettingsFile(GLOBAL_SETTINGS_FILE)); - final List problems = result.getProblems(); - if (!problems.isEmpty()) { - for (SettingsProblem problem : problems) { - switch (problem.getSeverity()) { - case ERROR: - case FATAL: - throw new AppModelResolverException("Settings problem encountered at " + problem.getLocation(), - problem.getException()); - default: - log.warn("Settings problem encountered at " + problem.getLocation(), problem.getException()); - } - } - } - effectiveSettings = result.getEffectiveSettings(); - } catch (SettingsBuildingException e) { - throw new AppModelResolverException("Failed to initialize Maven repository settings", e); - } - - return settings = effectiveSettings; - } - - public static String getLocalRepo(Settings settings) { - String localRepo = System.getenv("QUARKUS_LOCAL_REPO"); - if (localRepo != null) { - return localRepo; - } - localRepo = PropertyUtils.getProperty("maven.repo.local"); - if (localRepo != null) { - return localRepo; - } - localRepo = settings.getLocalRepository(); - return localRepo == null ? getDefaultLocalRepo() : localRepo; - } - - private static String getDefaultLocalRepo() { - return new File(userMavenConfigurationHome, "repository").getAbsolutePath(); - } - - private static boolean includesDefaultRepo(List repositories) { - for (ArtifactRepository repository : repositories) { - if (repository.getId().equals(DEFAULT_REMOTE_REPO_ID)) { - return true; - } - } - return false; - } - - private static RepositoryPolicy toAetherRepoPolicy(org.apache.maven.model.RepositoryPolicy modelPolicy) { - return new RepositoryPolicy(modelPolicy.isEnabled(), - isEmpty(modelPolicy.getUpdatePolicy()) ? RepositoryPolicy.UPDATE_POLICY_DAILY : modelPolicy.getUpdatePolicy(), - isEmpty(modelPolicy.getChecksumPolicy()) ? RepositoryPolicy.CHECKSUM_POLICY_WARN - : modelPolicy.getChecksumPolicy()); - } - - private static boolean isEmpty(String str) { - return str == null || str.isEmpty(); - } - - private static String getUserAgent() { - return "Apache-Maven/" + getMavenVersion() + " (Java " + PropertyUtils.getProperty("java.version") + "; " - + PropertyUtils.getProperty("os.name") + " " + PropertyUtils.getProperty("os.version") + ")"; - } - - private static String getMavenVersion() { - final Properties props = new Properties(); - try (InputStream is = MavenRepoInitializer.class.getResourceAsStream( - "/META-INF/maven/org.apache.maven/maven-core/pom.properties")) { - if (is != null) { - props.load(is); - } - } catch (IOException e) { - log.debug("Failed to read Maven version", e); - } - return props.getProperty("version", "unknown-version"); - } -} 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 554308ba313470..0c0ce539333513 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 @@ -56,7 +56,7 @@ protected boolean cleanWorkDir() { return true; } - protected BootstrapAppModelResolver initResolver(LocalProject currentProject) throws AppModelResolverException { + protected BootstrapAppModelResolver initResolver(LocalProject currentProject) throws Exception { return new BootstrapAppModelResolver(MavenArtifactResolver.builder() .setRepoHome(repoHome) .setOffline(true) diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/graph/parser/test/DependencyGraphParserTestCase.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/graph/parser/test/DependencyGraphParserTestCase.java deleted file mode 100644 index 0a86813e812587..00000000000000 --- a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/graph/parser/test/DependencyGraphParserTestCase.java +++ /dev/null @@ -1,12 +0,0 @@ -/** - * - */ -package io.quarkus.bootstrap.resolver.graph.parser.test; - -/** - * - * @author Alexey Loubyansky - */ -public class DependencyGraphParserTestCase { - -} diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/MavenRepoInitializerTest.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/MavenRepoInitializerTest.java deleted file mode 100644 index 5e3730fa91f7f1..00000000000000 --- a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/MavenRepoInitializerTest.java +++ /dev/null @@ -1,150 +0,0 @@ -package io.quarkus.bootstrap.resolver.maven.test; - -import static org.eclipse.aether.repository.RepositoryPolicy.CHECKSUM_POLICY_WARN; -import static org.eclipse.aether.repository.RepositoryPolicy.UPDATE_POLICY_DAILY; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import io.quarkus.bootstrap.resolver.AppModelResolverException; -import io.quarkus.bootstrap.resolver.maven.MavenRepoInitializer; -import java.util.Arrays; -import java.util.List; -import org.apache.maven.settings.Mirror; -import org.apache.maven.settings.Profile; -import org.apache.maven.settings.Proxy; -import org.apache.maven.settings.Repository; -import org.apache.maven.settings.RepositoryPolicy; -import org.apache.maven.settings.Settings; -import org.eclipse.aether.repository.RemoteRepository; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -class MavenRepoInitializerTest { - private static Mirror mirrorA; - private static Proxy localProxy; - private static Settings baseSettings; - - @BeforeAll - static void init() { - baseSettings = new Settings(); - - baseSettings.setInteractiveMode(true); - baseSettings.setUsePluginRegistry(false); - baseSettings.setOffline(false); - - final Profile profile = new Profile(); - profile.setId("foo-profile"); - - final RepositoryPolicy releasesPolicy = new RepositoryPolicy(); - releasesPolicy.setEnabled(true); - releasesPolicy.setUpdatePolicy(null); - releasesPolicy.setChecksumPolicy(CHECKSUM_POLICY_WARN); - - final RepositoryPolicy snapshotsPolicy = new RepositoryPolicy(); - snapshotsPolicy.setEnabled(true); - snapshotsPolicy.setUpdatePolicy(UPDATE_POLICY_DAILY); - snapshotsPolicy.setChecksumPolicy(CHECKSUM_POLICY_WARN); - - final RepositoryPolicy noSnapshotsPolicy = new RepositoryPolicy(); - noSnapshotsPolicy.setEnabled(false); - - final Repository customRepository = new Repository(); - customRepository.setId("custom-repo"); - customRepository.setUrl("https://foo.repo/artifact/content/groups/foo/"); - customRepository.setReleases(releasesPolicy); - customRepository.setSnapshots(snapshotsPolicy); - profile.addRepository(customRepository); - - final Repository jbossRepository = new Repository(); - jbossRepository.setId("jboss-public-repository"); - jbossRepository.setUrl("https://repository.jboss.org/nexus/content/repositories/releases/"); - jbossRepository.setReleases(releasesPolicy); - jbossRepository.setSnapshots(noSnapshotsPolicy); - profile.addRepository(jbossRepository); - - final Repository springRepository = new Repository(); - springRepository.setId("spring-public-repository"); - springRepository.setUrl("http://repo.spring.io/libs-release/"); - springRepository.setReleases(releasesPolicy); - springRepository.setSnapshots(noSnapshotsPolicy); - profile.addRepository(springRepository); - - baseSettings.addProfile(profile); - baseSettings.addActiveProfile("foo-profile"); - - localProxy = new Proxy(); - localProxy.setActive(true); - localProxy.setProtocol("http"); - localProxy.setUsername(null); - localProxy.setPassword(null); - localProxy.setPort(8888); - localProxy.setHost("localhost"); - localProxy.setNonProxyHosts("localhost"); - localProxy.setId("local-proxy-http"); - - mirrorA = new Mirror(); - mirrorA.setMirrorOf("central,jboss-public-repository,spring-public-repository"); - mirrorA.setUrl("https://mirror.com/artifact/content/groups/public/"); - mirrorA.setId("mirror-A"); - } - - @Test - void getRemoteRepoFromSettingsWithNeitherProxyNorMirror() throws AppModelResolverException { - final Settings settings = baseSettings.clone(); - - List repos = MavenRepoInitializer.getRemoteRepos(settings); - assertEquals(4, repos.size()); - - assertEquals("custom-repo", repos.get(0).getId()); - assertNull(repos.get(0).getProxy()); - assertTrue(repos.get(0).getMirroredRepositories().isEmpty()); - - final RemoteRepository centralRepo = repos.get(repos.size() - 1); - assertEquals("central", centralRepo.getId()); - assertNull(centralRepo.getProxy()); - assertTrue(centralRepo.getMirroredRepositories().isEmpty()); - } - - @Test - void getRemoteRepoFromSettingsWithProxyButWithoutMirror() throws AppModelResolverException { - final Settings settings = baseSettings.clone(); - settings.addProxy(localProxy); - - List repos = MavenRepoInitializer.getRemoteRepos(settings); - assertEquals(4, repos.size()); - - assertEquals("custom-repo", repos.get(0).getId()); - assertNotNull(repos.get(0).getProxy()); - assertNotNull(repos.get(0).getMirroredRepositories()); - - final RemoteRepository centralRepo = repos.get(repos.size() - 1); - assertEquals("central", centralRepo.getId(), "central repo must be added as default repository"); - assertNotNull(centralRepo.getProxy()); - assertTrue(centralRepo.getMirroredRepositories().isEmpty()); - } - - @Test - void getRemoteRepoFromSettingsWithProxyAndMirror() throws AppModelResolverException { - final Settings settings = baseSettings.clone(); - settings.addProxy(localProxy); - settings.addMirror(mirrorA); - - List repos = MavenRepoInitializer.getRemoteRepos(settings); - assertEquals(2, repos.size()); - - assertEquals("custom-repo", repos.get(0).getId()); - assertNotNull(repos.get(0).getProxy()); - assertNotNull(repos.get(0).getMirroredRepositories()); - - final RemoteRepository centralRepo = repos.get(repos.size() - 1); - assertEquals("mirror-A", centralRepo.getId(), "Central repo must be substitute by mirror"); - assertNotNull(centralRepo.getProxy()); - assertEquals(3, centralRepo.getMirroredRepositories().size()); - final List mirrored = Arrays.asList("central", "jboss-public-repository", "spring-public-repository"); - for (RemoteRepository repo : centralRepo.getMirroredRepositories()) { - assertTrue(mirrored.contains(repo.getId())); - } - } -} diff --git a/independent-projects/bootstrap/maven-plugin/src/main/java/io/quarkus/maven/AbstractTreeMojo.java b/independent-projects/bootstrap/maven-plugin/src/main/java/io/quarkus/maven/AbstractTreeMojo.java index 036e693c1c83bd..829b84cb12a285 100644 --- a/independent-projects/bootstrap/maven-plugin/src/main/java/io/quarkus/maven/AbstractTreeMojo.java +++ b/independent-projects/bootstrap/maven-plugin/src/main/java/io/quarkus/maven/AbstractTreeMojo.java @@ -1,7 +1,6 @@ package io.quarkus.maven; import io.quarkus.bootstrap.model.AppArtifact; -import io.quarkus.bootstrap.resolver.AppModelResolverException; import io.quarkus.bootstrap.resolver.BootstrapAppModelResolver; import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver; import java.util.List; @@ -59,7 +58,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { setupResolver(modelResolver); modelResolver.setBuildTreeLogger(s -> getLog().info(s)); modelResolver.resolveModel(appArtifact); - } catch (AppModelResolverException e) { + } catch (Exception e) { throw new MojoExecutionException("Failed to resolve application model " + appArtifact + " dependencies", e); } } diff --git a/independent-projects/bootstrap/maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java b/independent-projects/bootstrap/maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java index 75f2582608f962..a40a53fe28110c 100644 --- a/independent-projects/bootstrap/maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java +++ b/independent-projects/bootstrap/maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java @@ -10,6 +10,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import io.quarkus.bootstrap.BootstrapConstants; +import io.quarkus.bootstrap.model.AppModel; import java.io.BufferedWriter; import java.io.File; import java.io.IOException; @@ -128,17 +129,17 @@ public void execute() throws MojoExecutionException { if (parentFirstArtifacts != null && !parentFirstArtifacts.isEmpty()) { String val = String.join(",", parentFirstArtifacts); - props.put(BootstrapConstants.PARENT_FIRST_ARTIFACTS, val); + props.put(AppModel.PARENT_FIRST_ARTIFACTS, val); } if (excludedArtifacts != null && !excludedArtifacts.isEmpty()) { String val = String.join(",", excludedArtifacts); - props.put(BootstrapConstants.EXCLUDED_ARTIFACTS, val); + props.put(AppModel.EXCLUDED_ARTIFACTS, val); } if (lesserPriorityArtifacts != null && !lesserPriorityArtifacts.isEmpty()) { String val = String.join(",", lesserPriorityArtifacts); - props.put(BootstrapConstants.LESSER_PRIORITY_ARTIFACTS, val); + props.put(AppModel.LESSER_PRIORITY_ARTIFACTS, val); } try { @@ -283,7 +284,7 @@ private void transformLegacyToNew(final Path output, ObjectNode extObject, Objec /** * parse yaml or json and then return jackson JSonNode for furhter processing - * + * ***/ private ObjectNode processPlatformArtifact(Path descriptor, ObjectMapper mapper) throws IOException { diff --git a/independent-projects/bootstrap/maven-resolver/pom.xml b/independent-projects/bootstrap/maven-resolver/pom.xml new file mode 100644 index 00000000000000..fe2b7c931c8eff --- /dev/null +++ b/independent-projects/bootstrap/maven-resolver/pom.xml @@ -0,0 +1,113 @@ + + + + quarkus-bootstrap-parent + io.quarkus + 999-SNAPSHOT + ../pom.xml + + 4.0.0 + + quarkus-bootstrap-maven-resolver + Quarkus - Bootstrap - Maven Resolver + + + + io.quarkus + quarkus-bootstrap-app-model + + + org.ow2.asm + asm + + + org.apache.maven + maven-embedder + + + org.eclipse.sisu + org.eclipse.sisu.plexus + + + org.apache.maven + maven-settings-builder + + + org.apache.maven + maven-resolver-provider + + + org.apache.maven.resolver + maven-resolver-connector-basic + + + org.apache.maven.resolver + maven-resolver-transport-wagon + + + org.apache.maven.wagon + wagon-provider-api + + + + + org.apache.maven.wagon + wagon-http + + + org.slf4j + jcl-over-slf4j + + + org.slf4j + slf4j-simple + + + + + org.apache.maven.wagon + wagon-file + + + org.slf4j + slf4j-simple + + + + + org.junit.jupiter + junit-jupiter + test + + + org.jboss.shrinkwrap + shrinkwrap-depchain + pom + test + + + + + + + src/main/resources + true + + + + + diff --git a/independent-projects/bootstrap/core/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 similarity index 94% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java rename to independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java index 6fd7eaedf0b70a..2cf247abb166e7 100644 --- a/independent-projects/bootstrap/core/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 @@ -1,8 +1,6 @@ package io.quarkus.bootstrap.resolver.maven; -import io.quarkus.bootstrap.BootstrapException; import io.quarkus.bootstrap.model.AppArtifact; -import io.quarkus.bootstrap.resolver.AppModelResolverException; import io.quarkus.bootstrap.resolver.maven.options.BootstrapMavenOptions; import io.quarkus.bootstrap.resolver.maven.workspace.LocalProject; import io.quarkus.bootstrap.resolver.maven.workspace.LocalWorkspace; @@ -116,12 +114,12 @@ public static BootstrapMavenContextConfig config() { return new BootstrapMavenContextConfig<>(); } - public BootstrapMavenContext() throws AppModelResolverException { + public BootstrapMavenContext() throws BootstrapMavenException { this(new BootstrapMavenContextConfig<>()); } public BootstrapMavenContext(BootstrapMavenContextConfig config) - throws AppModelResolverException { + throws BootstrapMavenException { /* * WARNING: this constructor calls instance method as part of the initialization. * This means the values that are available in the config should be set before @@ -154,7 +152,7 @@ public BootstrapMavenContext(BootstrapMavenContextConfig config) }); } - public AppArtifact getCurrentProjectArtifact(String extension) throws AppModelResolverException { + public AppArtifact getCurrentProjectArtifact(String extension) throws BootstrapMavenException { if (currentProject != null) { return currentProject.getAppArtifact(extension); } @@ -186,25 +184,25 @@ public File getGlobalSettings() { return globalSettings; } - public boolean isOffline() throws AppModelResolverException { + public boolean isOffline() throws BootstrapMavenException { return offline == null ? offline = (getCliOptions().hasOption(BootstrapMavenOptions.OFFLINE) || getEffectiveSettings().isOffline()) : offline; } - public RepositorySystem getRepositorySystem() throws AppModelResolverException { + public RepositorySystem getRepositorySystem() throws BootstrapMavenException { return repoSystem == null ? repoSystem = newRepositorySystem() : repoSystem; } - public RepositorySystemSession getRepositorySystemSession() throws AppModelResolverException { + public RepositorySystemSession getRepositorySystemSession() throws BootstrapMavenException { return repoSession == null ? repoSession = newRepositorySystemSession() : repoSession; } - public List getRemoteRepositories() throws AppModelResolverException { + public List getRemoteRepositories() throws BootstrapMavenException { return remoteRepos == null ? remoteRepos = resolveRemoteRepos() : remoteRepos; } - public Settings getEffectiveSettings() throws AppModelResolverException { + public Settings getEffectiveSettings() throws BootstrapMavenException { if (settings != null) { return settings; } @@ -222,7 +220,7 @@ public Settings getEffectiveSettings() throws AppModelResolverException { switch (problem.getSeverity()) { case ERROR: case FATAL: - throw new AppModelResolverException("Settings problem encountered at " + problem.getLocation(), + throw new BootstrapMavenException("Settings problem encountered at " + problem.getLocation(), problem.getException()); default: log.warn("Settings problem encountered at " + problem.getLocation(), problem.getException()); @@ -231,20 +229,20 @@ public Settings getEffectiveSettings() throws AppModelResolverException { } effectiveSettings = result.getEffectiveSettings(); } catch (SettingsBuildingException e) { - throw new AppModelResolverException("Failed to initialize Maven repository settings", e); + throw new BootstrapMavenException("Failed to initialize Maven repository settings", e); } return settings = effectiveSettings; } - public String getLocalRepo() throws AppModelResolverException { + public String getLocalRepo() throws BootstrapMavenException { return localRepo == null ? localRepo = resolveLocalRepo(getEffectiveSettings()) : localRepo; } - private LocalProject resolveCurrentProject() throws AppModelResolverException { + private LocalProject resolveCurrentProject() throws BootstrapMavenException { try { return LocalProject.loadWorkspace(this); - } catch (BootstrapException e) { - throw new AppModelResolverException("Failed to load current project at " + getCurrentProjectPomOrNull(), e); + } catch (Exception e) { + throw new BootstrapMavenException("Failed to load current project at " + getCurrentProjectPomOrNull(), e); } } @@ -291,7 +289,7 @@ private static File resolveSettingsFile(String settingsArg, Supplier suppl return userSettings.exists() ? userSettings : null; } - private DefaultRepositorySystemSession newRepositorySystemSession() throws AppModelResolverException { + private DefaultRepositorySystemSession newRepositorySystemSession() throws BootstrapMavenException { final DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession(); final Settings settings = getEffectiveSettings(); @@ -384,7 +382,7 @@ private DefaultRepositorySystemSession newRepositorySystemSession() throws AppMo return session; } - private List resolveRemoteRepos() throws AppModelResolverException { + private List resolveRemoteRepos() throws BootstrapMavenException { final List rawRepos = new ArrayList<>(); getActiveSettingsProfiles().forEach(p -> addProfileRepos(p, rawRepos)); @@ -408,7 +406,7 @@ public static RemoteRepository newDefaultRepository() { .build(); } - private Model loadCurrentProjectModel() throws AppModelResolverException { + private Model loadCurrentProjectModel() throws BootstrapMavenException { final Path pom = getCurrentProjectPomOrNull(); if (pom == null) { return null; @@ -416,12 +414,12 @@ private Model loadCurrentProjectModel() throws AppModelResolverException { try { return ModelUtils.readModel(pom); } catch (IOException e) { - throw new AppModelResolverException("Failed to parse " + pom, e); + throw new BootstrapMavenException("Failed to parse " + pom, e); } } private List resolveCurrentProjectRepos(List repos) - throws AppModelResolverException { + throws BootstrapMavenException { final Model model = loadCurrentProjectModel(); if (model == null) { return repos; @@ -436,13 +434,13 @@ private List resolveCurrentProjectRepos(List .setRepositories(repos)) .getRepositories(); } catch (ArtifactDescriptorException e) { - throw new AppModelResolverException("Failed to read artifact descriptor for " + projectArtifact, e); + throw new BootstrapMavenException("Failed to read artifact descriptor for " + projectArtifact, e); } return getRepositorySystem().newResolutionRepositories(getRepositorySystemSession(), rawRepos); } public List getActiveSettingsProfiles() - throws AppModelResolverException { + throws BootstrapMavenException { if (activeSettingsProfiles != null) { return activeSettingsProfiles; } @@ -491,7 +489,7 @@ public void add(ModelProblemCollectorRequest req) { return activeSettingsProfiles = modelProfiles; } - private static Profile getProfile(String name, Settings settings) throws AppModelResolverException { + private static Profile getProfile(String name, Settings settings) throws BootstrapMavenException { final Profile profile = settings.getProfilesAsMap().get(name); if (profile == null) { unrecognizedProfile(name, true); @@ -563,7 +561,7 @@ private static Proxy toAetherProxy(org.apache.maven.settings.Proxy proxy) { return new Proxy(proxy.getProtocol(), proxy.getHost(), proxy.getPort(), auth); } - private RepositorySystem newRepositorySystem() throws AppModelResolverException { + private RepositorySystem newRepositorySystem() throws BootstrapMavenException { final DefaultServiceLocator locator = getServiceLocator(); if (!isOffline()) { locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class); diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContextConfig.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContextConfig.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContextConfig.java rename to independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContextConfig.java diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenException.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenException.java new file mode 100644 index 00000000000000..712f7d6064e45e --- /dev/null +++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenException.java @@ -0,0 +1,13 @@ +package io.quarkus.bootstrap.resolver.maven; + +@SuppressWarnings("serial") +public class BootstrapMavenException extends Exception { + + public BootstrapMavenException(String message, Throwable cause) { + super(message, cause); + } + + public BootstrapMavenException(String message) { + super(message); + } +} diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapModelBuilderFactory.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapModelBuilderFactory.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapModelBuilderFactory.java rename to independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapModelBuilderFactory.java diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapWagonConfigurator.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapWagonConfigurator.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapWagonConfigurator.java rename to independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapWagonConfigurator.java diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapWagonProvider.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapWagonProvider.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapWagonProvider.java rename to independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapWagonProvider.java diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java similarity index 88% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java rename to independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java index 6f098ea931b6f4..c02f3119c9d8ed 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java +++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java @@ -4,7 +4,6 @@ package io.quarkus.bootstrap.resolver.maven; import io.quarkus.bootstrap.model.AppArtifactKey; -import io.quarkus.bootstrap.resolver.AppModelResolverException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; @@ -85,7 +84,7 @@ public Builder setRepoHome(Path home) { return this; } - public MavenArtifactResolver build() throws AppModelResolverException { + public MavenArtifactResolver build() throws BootstrapMavenException { return new MavenArtifactResolver(this); } } @@ -100,7 +99,7 @@ public static Builder builder() { protected final MavenLocalRepositoryManager localRepoManager; protected final RemoteRepositoryManager remoteRepoManager; - private MavenArtifactResolver(Builder builder) throws AppModelResolverException { + private MavenArtifactResolver(Builder builder) throws BootstrapMavenException { final BootstrapMavenContext mvnSettings = new BootstrapMavenContext(builder); this.repoSystem = mvnSettings.getRepositorySystem(); @@ -119,7 +118,7 @@ private MavenArtifactResolver(Builder builder) throws AppModelResolverException this.remoteRepoManager = mvnSettings.getRemoteRepositoryManager(); } - public MavenArtifactResolver(BootstrapMavenContext mvnSettings) throws AppModelResolverException { + public MavenArtifactResolver(BootstrapMavenContext mvnSettings) throws BootstrapMavenException { this.repoSystem = mvnSettings.getRepositorySystem(); this.repoSession = mvnSettings.getRepositorySystemSession(); localRepoManager = null; @@ -147,46 +146,46 @@ public void addRemoteRepositories(List repos) { remoteRepos.addAll(repos); } - public ArtifactResult resolve(Artifact artifact) throws AppModelResolverException { + public ArtifactResult resolve(Artifact artifact) throws BootstrapMavenException { return resolveInternal(artifact, remoteRepos); } - public ArtifactResult resolve(Artifact artifact, List mainRepos) throws AppModelResolverException { + public ArtifactResult resolve(Artifact artifact, List mainRepos) throws BootstrapMavenException { return resolveInternal(artifact, aggregateRepositories(mainRepos, remoteRepos)); } private ArtifactResult resolveInternal(Artifact artifact, List aggregatedRepos) - throws AppModelResolverException { + throws BootstrapMavenException { try { return repoSystem.resolveArtifact(repoSession, new ArtifactRequest() .setArtifact(artifact) .setRepositories(aggregatedRepos)); } catch (ArtifactResolutionException e) { - throw new AppModelResolverException("Failed to resolve artifact " + artifact, e); + throw new BootstrapMavenException("Failed to resolve artifact " + artifact, e); } } - public List resolve(List artifacts) throws AppModelResolverException { + public List resolve(List artifacts) throws BootstrapMavenException { try { return repoSystem.resolveArtifacts(repoSession, artifacts); } catch (ArtifactResolutionException e) { - throw new AppModelResolverException("Failed to resolve artifacts", e); + throw new BootstrapMavenException("Failed to resolve artifacts", e); } } public ArtifactDescriptorResult resolveDescriptor(final Artifact artifact) - throws AppModelResolverException { + throws BootstrapMavenException { return resolveDescriptorInternal(artifact, remoteRepos); } public ArtifactDescriptorResult resolveDescriptor(final Artifact artifact, List mainRepos) - throws AppModelResolverException { + throws BootstrapMavenException { return resolveDescriptorInternal(artifact, aggregateRepositories(mainRepos, remoteRepos)); } private ArtifactDescriptorResult resolveDescriptorInternal(final Artifact artifact, List aggregatedRepos) - throws AppModelResolverException { + throws BootstrapMavenException { try { return repoSystem.readArtifactDescriptor(repoSession, new ArtifactDescriptorRequest() @@ -194,60 +193,60 @@ private ArtifactDescriptorResult resolveDescriptorInternal(final Artifact artifa .setRepositories( aggregatedRepos)); } catch (ArtifactDescriptorException e) { - throw new AppModelResolverException("Failed to read descriptor of " + artifact, e); + throw new BootstrapMavenException("Failed to read descriptor of " + artifact, e); } } - public VersionRangeResult resolveVersionRange(Artifact artifact) throws AppModelResolverException { + public VersionRangeResult resolveVersionRange(Artifact artifact) throws BootstrapMavenException { try { return repoSystem.resolveVersionRange(repoSession, new VersionRangeRequest() .setArtifact(artifact) .setRepositories(remoteRepos)); } catch (VersionRangeResolutionException ex) { - throw new AppModelResolverException("Failed to resolve version range for " + artifact, ex); + throw new BootstrapMavenException("Failed to resolve version range for " + artifact, ex); } } - public CollectResult collectDependencies(Artifact artifact, List deps) throws AppModelResolverException { + public CollectResult collectDependencies(Artifact artifact, List deps) throws BootstrapMavenException { return collectDependencies(artifact, deps, Collections.emptyList()); } public CollectResult collectDependencies(Artifact artifact, List deps, List mainRepos) - throws AppModelResolverException { + throws BootstrapMavenException { final CollectRequest request = newCollectRequest(artifact, mainRepos); request.setDependencies(deps); try { return repoSystem.collectDependencies(repoSession, request); } catch (DependencyCollectionException e) { - throw new AppModelResolverException("Failed to collect dependencies for " + artifact, e); + throw new BootstrapMavenException("Failed to collect dependencies for " + artifact, e); } } - public DependencyResult resolveDependencies(Artifact artifact, List deps) throws AppModelResolverException { + public DependencyResult resolveDependencies(Artifact artifact, List deps) throws BootstrapMavenException { return resolveDependencies(artifact, deps, Collections.emptyList()); } public DependencyResult resolveDependencies(Artifact artifact, List deps, List mainRepos) - throws AppModelResolverException { + throws BootstrapMavenException { final CollectRequest request = newCollectRequest(artifact, mainRepos); request.setDependencies(deps); try { return repoSystem.resolveDependencies(repoSession, new DependencyRequest().setCollectRequest(request)); } catch (DependencyResolutionException e) { - throw new AppModelResolverException("Failed to resolve dependencies for " + artifact, e); + throw new BootstrapMavenException("Failed to resolve dependencies for " + artifact, e); } } public DependencyResult resolveManagedDependencies(Artifact artifact, List deps, List managedDeps, - List mainRepos, String... excludedScopes) throws AppModelResolverException { + List mainRepos, String... excludedScopes) throws BootstrapMavenException { try { return repoSystem.resolveDependencies(repoSession, new DependencyRequest().setCollectRequest( newCollectManagedRequest(artifact, deps, managedDeps, mainRepos, excludedScopes))); } catch (DependencyResolutionException e) { - throw new AppModelResolverException("Failed to resolve dependencies for " + artifact, e); + throw new BootstrapMavenException("Failed to resolve dependencies for " + artifact, e); } } @@ -255,7 +254,7 @@ public DependencyResult resolveManagedDependencies(Artifact artifact, List deps, List mainRepos) - throws AppModelResolverException { + throws BootstrapMavenException { DependencyResult result = new DependencyResult( new DependencyRequest().setCollectRequest(new CollectRequest(deps, Collections.emptyList(), mainRepos))); DefaultDependencyNode root = new DefaultDependencyNode((Dependency) null); @@ -275,17 +274,17 @@ public DependencyResult toDependencyTree(List deps, List deps, List managedDeps, - List mainRepos, String... excludedScopes) throws AppModelResolverException { + List mainRepos, String... excludedScopes) throws BootstrapMavenException { try { return repoSystem.collectDependencies(repoSession, newCollectManagedRequest(artifact, deps, managedDeps, mainRepos, excludedScopes)); } catch (DependencyCollectionException e) { - throw new AppModelResolverException("Failed to collect dependencies for " + artifact, e); + throw new BootstrapMavenException("Failed to collect dependencies for " + artifact, e); } } private CollectRequest newCollectManagedRequest(Artifact artifact, List deps, List managedDeps, - List mainRepos, String... excludedScopes) throws AppModelResolverException { + List mainRepos, String... excludedScopes) throws BootstrapMavenException { final List aggregatedRepos = aggregateRepositories(mainRepos, remoteRepos); final ArtifactDescriptorResult descr = resolveDescriptorInternal(artifact, aggregatedRepos); Collection excluded; @@ -342,16 +341,16 @@ public List aggregateRepositories(List domin : remoteRepoManager.aggregateRepositories(repoSession, dominant, recessive, false); } - public void install(Artifact artifact) throws AppModelResolverException { + public void install(Artifact artifact) throws BootstrapMavenException { try { repoSystem.install(repoSession, new InstallRequest().addArtifact(artifact)); } catch (InstallationException ex) { - throw new AppModelResolverException("Failed to install " + artifact, ex); + throw new BootstrapMavenException("Failed to install " + artifact, ex); } } private CollectRequest newCollectRequest(Artifact artifact, List mainRepos) - throws AppModelResolverException { + throws BootstrapMavenException { return new CollectRequest() .setRoot(new Dependency(artifact, JavaScopes.RUNTIME)) .setRepositories(aggregateRepositories(mainRepos, remoteRepos)); diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenLocalRepositoryManager.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenLocalRepositoryManager.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenLocalRepositoryManager.java rename to independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenLocalRepositoryManager.java diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenModelBuilder.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenModelBuilder.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenModelBuilder.java rename to independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenModelBuilder.java diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/SecDispatcherImpl.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/SecDispatcherImpl.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/SecDispatcherImpl.java rename to independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/SecDispatcherImpl.java diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/SettingsDecrypterImpl.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/SettingsDecrypterImpl.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/SettingsDecrypterImpl.java rename to independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/SettingsDecrypterImpl.java diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/SettingsDecryptionResultImpl.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/SettingsDecryptionResultImpl.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/SettingsDecryptionResultImpl.java rename to independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/SettingsDecryptionResultImpl.java diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/SimpleDependencyGraphTransformationContext.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/SimpleDependencyGraphTransformationContext.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/SimpleDependencyGraphTransformationContext.java rename to independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/SimpleDependencyGraphTransformationContext.java diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/options/BootstrapMavenOptions.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/options/BootstrapMavenOptions.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/options/BootstrapMavenOptions.java rename to independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/options/BootstrapMavenOptions.java diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/options/BootstrapMavenOptionsParser.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/options/BootstrapMavenOptionsParser.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/options/BootstrapMavenOptionsParser.java rename to independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/options/BootstrapMavenOptionsParser.java diff --git a/independent-projects/bootstrap/core/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 similarity index 92% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java rename to independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java index 5aae74a4a15cdb..11754193ca94be 100644 --- a/independent-projects/bootstrap/core/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 @@ -1,10 +1,11 @@ package io.quarkus.bootstrap.resolver.maven.workspace; -import io.quarkus.bootstrap.BootstrapConstants; -import io.quarkus.bootstrap.BootstrapException; +// import io.quarkus.bootstrap.BootstrapConstants; +// import io.quarkus.bootstrap.BootstrapConstants; import io.quarkus.bootstrap.model.AppArtifact; import io.quarkus.bootstrap.model.AppArtifactKey; import io.quarkus.bootstrap.resolver.maven.BootstrapMavenContext; +import io.quarkus.bootstrap.resolver.maven.BootstrapMavenException; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -29,11 +30,11 @@ public class LocalProject { private static final String PROJECT_BASEDIR = "${project.basedir}"; private static final String POM_XML = "pom.xml"; - public static LocalProject load(Path path) throws BootstrapException { + public static LocalProject load(Path path) throws BootstrapMavenException { return load(path, true); } - public static LocalProject load(Path path, boolean required) throws BootstrapException { + public static LocalProject load(Path path, boolean required) throws BootstrapMavenException { final Path pom = locateCurrentProjectPom(path, required); if (pom == null) { return null; @@ -46,11 +47,11 @@ public static LocalProject load(Path path, boolean required) throws BootstrapExc } } - public static LocalProject loadWorkspace(Path path) throws BootstrapException { + public static LocalProject loadWorkspace(Path path) throws BootstrapMavenException { return loadWorkspace(path, true); } - public static LocalProject loadWorkspace(Path path, boolean required) throws BootstrapException { + public static LocalProject loadWorkspace(Path path, boolean required) throws BootstrapMavenException { path = path.normalize().toAbsolutePath(); Path currentProjectPom = null; Model rootModel = null; @@ -61,7 +62,7 @@ public static LocalProject loadWorkspace(Path path, boolean required) throws Boo if (rootModel != null) { currentProjectPom = path; } - } catch (BootstrapException e) { + } catch (BootstrapMavenException e) { // ignore, it's not a POM file, we'll be looking for the POM later } } @@ -81,9 +82,9 @@ public static LocalProject loadWorkspace(Path path, boolean required) throws Boo * * @param ctx bootstrap maven context * @return current project with the workspace or null in case the current project could not be resolved - * @throws BootstrapException in case of an error + * @throws BootstrapMavenException in case of an error */ - public static LocalProject loadWorkspace(BootstrapMavenContext ctx) throws BootstrapException { + public static LocalProject loadWorkspace(BootstrapMavenContext ctx) throws BootstrapMavenException { final Path currentProjectPom = ctx.getCurrentProjectPomOrNull(); if (currentProjectPom == null) { return null; @@ -97,7 +98,7 @@ public static LocalProject loadWorkspace(BootstrapMavenContext ctx) throws Boots return lp; } - private static LocalProject loadWorkspace(Path currentProjectPom, Model rootModel) throws BootstrapException { + private static LocalProject loadWorkspace(Path currentProjectPom, Model rootModel) throws BootstrapMavenException { final LocalWorkspace ws = new LocalWorkspace(); LocalProject project = load(ws, null, rootModel, currentProjectPom.getParent()); if (project == null) { @@ -108,7 +109,7 @@ private static LocalProject loadWorkspace(Path currentProjectPom, Model rootMode } private static LocalProject load(LocalWorkspace workspace, LocalProject parent, Model model, Path currentProjectDir) - throws BootstrapException { + throws BootstrapMavenException { final LocalProject project = new LocalProject(model, workspace); if (parent != null) { parent.modules.add(project); @@ -129,7 +130,7 @@ private static LocalProject load(LocalWorkspace workspace, LocalProject parent, return result; } - private static Model loadRootModel(Path pomXml) throws BootstrapException { + private static Model loadRootModel(Path pomXml) throws BootstrapMavenException { Model model = null; while (pomXml != null && Files.exists(pomXml)) { model = readModel(pomXml); @@ -149,17 +150,17 @@ private static Model loadRootModel(Path pomXml) throws BootstrapException { return model; } - private static final Model readModel(Path pom) throws BootstrapException { + private static final Model readModel(Path pom) throws BootstrapMavenException { try { final Model model = ModelUtils.readModel(pom); model.setPomFile(pom.toFile()); return model; } catch (IOException e) { - throw new BootstrapException("Failed to read " + pom, e); + throw new BootstrapMavenException("Failed to read " + pom, e); } } - private static Path locateCurrentProjectPom(Path path, boolean required) throws BootstrapException { + private static Path locateCurrentProjectPom(Path path, boolean required) throws BootstrapMavenException { Path p = path; while (p != null) { final Path pom = p.resolve(POM_XML); @@ -169,7 +170,7 @@ private static Path locateCurrentProjectPom(Path path, boolean required) throws p = p.getParent(); } if (required) { - throw new BootstrapException("Failed to locate project pom.xml for " + path); + throw new BootstrapMavenException("Failed to locate project pom.xml for " + path); } return null; } @@ -183,7 +184,7 @@ private static Path locateCurrentProjectPom(Path path, boolean required) throws private final List modules = new ArrayList<>(0); private AppArtifactKey key; - private LocalProject(Model rawModel, LocalWorkspace workspace) throws BootstrapException { + private LocalProject(Model rawModel, LocalWorkspace workspace) throws BootstrapMavenException { this.rawModel = rawModel; this.dir = rawModel.getProjectDirectory().toPath(); this.workspace = workspace; @@ -273,7 +274,7 @@ public AppArtifact getAppArtifact() { } public AppArtifact getAppArtifact(String extension) { - return new AppArtifact(groupId, artifactId, BootstrapConstants.EMPTY, extension, version); + return new AppArtifact(groupId, artifactId, "", extension, version); } public List getSelfWithLocalDeps() { diff --git a/independent-projects/bootstrap/core/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 similarity index 98% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java rename to independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java index 6f9f7bf2293e57..1c86986a3e3302 100644 --- a/independent-projects/bootstrap/core/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 @@ -2,8 +2,8 @@ import io.quarkus.bootstrap.model.AppArtifactCoords; import io.quarkus.bootstrap.model.AppArtifactKey; -import io.quarkus.bootstrap.resolver.AppModelResolverException; import io.quarkus.bootstrap.resolver.maven.BootstrapMavenContext; +import io.quarkus.bootstrap.resolver.maven.BootstrapMavenException; import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -186,7 +186,7 @@ private String getLocalRepo() { return (mvnCtx == null ? mvnCtx = new BootstrapMavenContext(BootstrapMavenContext.config().setCurrentProject(currentProject)) : mvnCtx).getLocalRepo(); - } catch (AppModelResolverException e) { + } catch (BootstrapMavenException e) { return null; } } diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtils.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtils.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtils.java rename to independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtils.java diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/UnresolvedVersionException.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/UnresolvedVersionException.java similarity index 82% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/UnresolvedVersionException.java rename to independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/UnresolvedVersionException.java index 8cb8ad4ab6eedd..fd2213462c93f9 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/UnresolvedVersionException.java +++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/UnresolvedVersionException.java @@ -1,13 +1,13 @@ package io.quarkus.bootstrap.resolver.maven.workspace; -import io.quarkus.bootstrap.BootstrapException; +import io.quarkus.bootstrap.resolver.maven.BootstrapMavenException; /** * Thrown if a "Maven CI Friendly Versions" property in the version could not be resolved. * * @see Maven CI Friendly Versions (maven.apache.org) */ -public class UnresolvedVersionException extends BootstrapException { +public class UnresolvedVersionException extends BootstrapMavenException { private static final long serialVersionUID = 1L; diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/IoUtils.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/util/IoUtils.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/IoUtils.java rename to independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/util/IoUtils.java diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/PropertyUtils.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/util/PropertyUtils.java similarity index 100% rename from independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/PropertyUtils.java rename to independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/util/PropertyUtils.java diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/BasicPomReposEffectivePomTest.java b/independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/BasicPomReposEffectivePomTest.java similarity index 100% rename from independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/BasicPomReposEffectivePomTest.java rename to independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/BasicPomReposEffectivePomTest.java diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/BootstrapMavenContextTestBase.java b/independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/BootstrapMavenContextTestBase.java similarity index 100% rename from independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/BootstrapMavenContextTestBase.java rename to independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/BootstrapMavenContextTestBase.java diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/BootstrapMavenOptionsTest.java b/independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/BootstrapMavenOptionsTest.java similarity index 100% rename from independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/BootstrapMavenOptionsTest.java rename to independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/BootstrapMavenOptionsTest.java diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/CentralRepoOverridesEffectivePomTest.java b/independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/CentralRepoOverridesEffectivePomTest.java similarity index 100% rename from independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/CentralRepoOverridesEffectivePomTest.java rename to independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/CentralRepoOverridesEffectivePomTest.java diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/NoProxyNoMirrorSettingsReposTest.java b/independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/NoProxyNoMirrorSettingsReposTest.java similarity index 100% rename from independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/NoProxyNoMirrorSettingsReposTest.java rename to independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/NoProxyNoMirrorSettingsReposTest.java diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/PomProfileReposEffectivePomTest.java b/independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/PomProfileReposEffectivePomTest.java similarity index 100% rename from independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/PomProfileReposEffectivePomTest.java rename to independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/PomProfileReposEffectivePomTest.java diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/PomReposMirroredTest.java b/independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/PomReposMirroredTest.java similarity index 100% rename from independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/PomReposMirroredTest.java rename to independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/PomReposMirroredTest.java diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/ProxyAndMirrorSettingsReposTest.java b/independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/ProxyAndMirrorSettingsReposTest.java similarity index 100% rename from independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/ProxyAndMirrorSettingsReposTest.java rename to independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/ProxyAndMirrorSettingsReposTest.java diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/ProxyNoMirrorSettingsReposTest.java b/independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/ProxyNoMirrorSettingsReposTest.java similarity index 100% rename from independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/ProxyNoMirrorSettingsReposTest.java rename to independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/ProxyNoMirrorSettingsReposTest.java diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/ResolveEmptyJarProjectArtifactTest.java b/independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/ResolveEmptyJarProjectArtifactTest.java similarity index 100% rename from independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/ResolveEmptyJarProjectArtifactTest.java rename to independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/ResolveEmptyJarProjectArtifactTest.java diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/SettingsProfileReposAndPomReposEffectivePomTest.java b/independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/SettingsProfileReposAndPomReposEffectivePomTest.java similarity index 100% rename from independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/SettingsProfileReposAndPomReposEffectivePomTest.java rename to independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/SettingsProfileReposAndPomReposEffectivePomTest.java diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/SubmodulePomReposEffectivePomTest.java b/independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/SubmodulePomReposEffectivePomTest.java similarity index 100% rename from independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/maven/test/SubmodulePomReposEffectivePomTest.java rename to independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/resolver/maven/test/SubmodulePomReposEffectivePomTest.java diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/workspace/test/LocalWorkspaceDiscoveryTest.java b/independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/workspace/test/LocalWorkspaceDiscoveryTest.java similarity index 98% rename from independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/workspace/test/LocalWorkspaceDiscoveryTest.java rename to independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/workspace/test/LocalWorkspaceDiscoveryTest.java index 654d03819e1995..caa50b66f5e634 100644 --- a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/workspace/test/LocalWorkspaceDiscoveryTest.java +++ b/independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/workspace/test/LocalWorkspaceDiscoveryTest.java @@ -8,13 +8,11 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; -import io.quarkus.bootstrap.BootstrapException; import io.quarkus.bootstrap.model.AppArtifactKey; import io.quarkus.bootstrap.resolver.maven.workspace.LocalProject; import io.quarkus.bootstrap.resolver.maven.workspace.LocalWorkspace; import io.quarkus.bootstrap.util.IoUtils; import java.io.File; -import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; @@ -294,7 +292,7 @@ public void testVersionMultiplePropertiesOverridenWithSystemProperty() throws Ex } private void testMavenCiFriendlyVersion(String placeholder, String testResourceDirName, String expectedResolvedVersion, - boolean resolvesFromWorkspace) throws BootstrapException, URISyntaxException { + boolean resolvesFromWorkspace) throws Exception { final URL module1Url = Thread.currentThread().getContextClassLoader() .getResource(testResourceDirName + "/root/module1"); assertNotNull(module1Url); diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/workspace/test/MvnProjectBuilder.java b/independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/workspace/test/MvnProjectBuilder.java similarity index 100% rename from independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/workspace/test/MvnProjectBuilder.java rename to independent-projects/bootstrap/maven-resolver/src/test/java/io/quarkus/bootstrap/workspace/test/MvnProjectBuilder.java diff --git a/independent-projects/bootstrap/core/src/test/resources/custom-settings/no-proxy-no-mirror/settings.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/custom-settings/no-proxy-no-mirror/settings.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/custom-settings/no-proxy-no-mirror/settings.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/custom-settings/no-proxy-no-mirror/settings.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/custom-settings/pom-repos-mirrored/pom.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/custom-settings/pom-repos-mirrored/pom.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/custom-settings/pom-repos-mirrored/pom.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/custom-settings/pom-repos-mirrored/pom.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/custom-settings/pom-repos-mirrored/settings.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/custom-settings/pom-repos-mirrored/settings.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/custom-settings/pom-repos-mirrored/settings.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/custom-settings/pom-repos-mirrored/settings.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/custom-settings/proxy-and-mirror/settings.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/custom-settings/proxy-and-mirror/settings.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/custom-settings/proxy-and-mirror/settings.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/custom-settings/proxy-and-mirror/settings.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/custom-settings/proxy-no-mirror/settings.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/custom-settings/proxy-no-mirror/settings.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/custom-settings/proxy-no-mirror/settings.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/custom-settings/proxy-no-mirror/settings.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/effective-pom/basic-pom-repos/pom.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/basic-pom-repos/pom.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/effective-pom/basic-pom-repos/pom.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/basic-pom-repos/pom.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/effective-pom/basic-pom-repos/settings.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/basic-pom-repos/settings.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/effective-pom/basic-pom-repos/settings.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/basic-pom-repos/settings.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/effective-pom/central-repo-overrides/pom.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/central-repo-overrides/pom.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/effective-pom/central-repo-overrides/pom.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/central-repo-overrides/pom.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/effective-pom/central-repo-overrides/settings.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/central-repo-overrides/settings.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/effective-pom/central-repo-overrides/settings.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/central-repo-overrides/settings.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/effective-pom/pom-profile-repos/pom.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/pom-profile-repos/pom.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/effective-pom/pom-profile-repos/pom.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/pom-profile-repos/pom.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/effective-pom/pom-profile-repos/settings.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/pom-profile-repos/settings.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/effective-pom/pom-profile-repos/settings.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/pom-profile-repos/settings.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/effective-pom/settings-profile-and-pom-repos/pom.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/settings-profile-and-pom-repos/pom.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/effective-pom/settings-profile-and-pom-repos/pom.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/settings-profile-and-pom-repos/pom.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/effective-pom/settings-profile-and-pom-repos/settings.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/settings-profile-and-pom-repos/settings.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/effective-pom/settings-profile-and-pom-repos/settings.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/settings-profile-and-pom-repos/settings.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/effective-pom/submodule-repos/module/pom.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/submodule-repos/module/pom.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/effective-pom/submodule-repos/module/pom.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/submodule-repos/module/pom.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/effective-pom/submodule-repos/module/settings.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/submodule-repos/module/settings.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/effective-pom/submodule-repos/module/settings.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/submodule-repos/module/settings.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/effective-pom/submodule-repos/pom.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/submodule-repos/pom.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/effective-pom/submodule-repos/pom.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/effective-pom/submodule-repos/pom.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/empty-jar/root/pom.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/empty-jar/root/pom.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/empty-jar/root/pom.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/empty-jar/root/pom.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/workspace-changelist/root/module1/pom.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/workspace-changelist/root/module1/pom.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/workspace-changelist/root/module1/pom.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/workspace-changelist/root/module1/pom.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/workspace-changelist/root/pom.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/workspace-changelist/root/pom.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/workspace-changelist/root/pom.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/workspace-changelist/root/pom.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/workspace-multiple/root/module1/pom.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/workspace-multiple/root/module1/pom.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/workspace-multiple/root/module1/pom.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/workspace-multiple/root/module1/pom.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/workspace-multiple/root/pom.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/workspace-multiple/root/pom.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/workspace-multiple/root/pom.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/workspace-multiple/root/pom.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/workspace-revision/root/module1/pom.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/workspace-revision/root/module1/pom.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/workspace-revision/root/module1/pom.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/workspace-revision/root/module1/pom.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/workspace-revision/root/pom.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/workspace-revision/root/pom.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/workspace-revision/root/pom.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/workspace-revision/root/pom.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/workspace-sha1/root/module1/pom.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/workspace-sha1/root/module1/pom.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/workspace-sha1/root/module1/pom.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/workspace-sha1/root/module1/pom.xml diff --git a/independent-projects/bootstrap/core/src/test/resources/workspace-sha1/root/pom.xml b/independent-projects/bootstrap/maven-resolver/src/test/resources/workspace-sha1/root/pom.xml similarity index 100% rename from independent-projects/bootstrap/core/src/test/resources/workspace-sha1/root/pom.xml rename to independent-projects/bootstrap/maven-resolver/src/test/resources/workspace-sha1/root/pom.xml diff --git a/independent-projects/bootstrap/pom.xml b/independent-projects/bootstrap/pom.xml index 560a2586505630..8be4d3d7351f37 100644 --- a/independent-projects/bootstrap/pom.xml +++ b/independent-projects/bootstrap/pom.xml @@ -48,6 +48,8 @@ 2.6.0 + app-model + maven-resolver core maven-plugin runner @@ -81,6 +83,16 @@ test-jar test + + io.quarkus + quarkus-bootstrap-app-model + ${project.version} + + + io.quarkus + quarkus-bootstrap-maven-resolver + ${project.version} + io.quarkus quarkus-bootstrap-maven-plugin diff --git a/independent-projects/tools/platform-descriptor-resolver-json/src/main/java/io/quarkus/platform/descriptor/resolver/json/QuarkusJsonPlatformDescriptorResolver.java b/independent-projects/tools/platform-descriptor-resolver-json/src/main/java/io/quarkus/platform/descriptor/resolver/json/QuarkusJsonPlatformDescriptorResolver.java index 4ff705dfe8d784..75ea6527ce5ef3 100644 --- a/independent-projects/tools/platform-descriptor-resolver-json/src/main/java/io/quarkus/platform/descriptor/resolver/json/QuarkusJsonPlatformDescriptorResolver.java +++ b/independent-projects/tools/platform-descriptor-resolver-json/src/main/java/io/quarkus/platform/descriptor/resolver/json/QuarkusJsonPlatformDescriptorResolver.java @@ -146,7 +146,7 @@ public QuarkusPlatformDescriptor resolve() { if (artifactResolver == null) { try { artifactResolver = new BootstrapAppModelResolver(MavenArtifactResolver.builder().build()); - } catch (AppModelResolverException e) { + } catch (Exception e) { throw new IllegalStateException("Failed to initialize the Maven artifact resolver", e); } } diff --git a/tcks/microprofile-health/pom.xml b/tcks/microprofile-health/pom.xml index 4ce608cc60fa8c..cf1dfac68889ef 100644 --- a/tcks/microprofile-health/pom.xml +++ b/tcks/microprofile-health/pom.xml @@ -65,6 +65,10 @@ javax.activation activation + + org.checkerframework + checker-qual +