diff --git a/bom/pom.xml b/bom/pom.xml index 688b783bd07d2..7b446df14bd2f 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -175,13 +175,11 @@ io.quarkus quarkus-core ${project.version} - provided io.quarkus quarkus-arc ${project.version} - provided @@ -190,31 +188,26 @@ io.quarkus quarkus-caffeine ${project.version} - provided io.quarkus quarkus-jaxb ${project.version} - provided io.quarkus quarkus-jsonb ${project.version} - provided io.quarkus quarkus-jsonp ${project.version} - provided io.quarkus quarkus-netty ${project.version} - provided @@ -223,37 +216,31 @@ io.quarkus quarkus-agroal ${project.version} - provided io.quarkus quarkus-camel-core ${project.version} - provided io.quarkus quarkus-camel-aws-s3 ${project.version} - provided io.quarkus quarkus-camel-salesforce ${project.version} - provided io.quarkus quarkus-camel-netty4-http ${project.version} - provided io.quarkus quarkus-camel-infinispan ${project.version} - provided io.quarkus @@ -265,193 +252,161 @@ io.quarkus quarkus-hibernate-validator ${project.version} - provided io.quarkus quarkus-infinispan-client ${project.version} - provided io.quarkus quarkus-jdbc-postgresql ${project.version} - provided io.quarkus quarkus-jdbc-h2 ${project.version} - provided io.quarkus quarkus-jdbc-mariadb ${project.version} - provided io.quarkus - quarkus-jdbc-mssql + quarkus-jdbc-mssql-deployment ${project.version} - provided io.quarkus quarkus-kafka-client ${project.version} - provided io.quarkus quarkus-smallrye-health ${project.version} - provided io.quarkus quarkus-smallrye-jwt ${project.version} - provided io.quarkus quarkus-smallrye-reactive-streams-operators ${project.version} - provided io.quarkus quarkus-smallrye-reactive-type-converters ${project.version} - provided io.quarkus quarkus-smallrye-reactive-messaging ${project.version} - provided io.quarkus quarkus-smallrye-reactive-messaging-kafka ${project.version} - provided io.quarkus quarkus-smallrye-metrics ${project.version} - provided io.quarkus quarkus-smallrye-openapi ${project.version} - provided io.quarkus quarkus-smallrye-opentracing ${project.version} - provided io.quarkus quarkus-smallrye-rest-client ${project.version} - provided io.quarkus quarkus-resteasy ${project.version} - provided io.quarkus quarkus-resteasy-jsonb ${project.version} - provided io.quarkus quarkus-jaxrs-json ${project.version} - provided io.quarkus quarkus-narayana-jta ${project.version} - provided io.quarkus quarkus-undertow ${project.version} - provided io.quarkus quarkus-hibernate-orm ${project.version} - provided io.quarkus quarkus-smallrye-fault-tolerance ${project.version} - provided io.quarkus quarkus-vertx ${project.version} - provided io.quarkus quarkus-vertx-web ${project.version} - provided io.quarkus quarkus-hibernate-orm-panache ${project.version} - provided io.quarkus quarkus-undertow-websockets ${project.version} - provided io.quarkus quarkus-scheduler ${project.version} - provided io.quarkus quarkus-spring-di ${project.version} - provided io.quarkus quarkus-kotlin ${project.version} - provided io.quarkus quarkus-amazon-lambda ${project.version} - provided @@ -551,6 +506,10 @@ jboss-logmanager-embedded ${jboss-logmanager.version} + + com.oracle.substratevm + svm + org.jboss.modules jboss-modules @@ -1296,7 +1255,7 @@ io.quarkus.arc - arc-runtime + arc ${project.version} diff --git a/build-parent/pom.xml b/build-parent/pom.xml index e8c8817231f84..cde573e3f1f07 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -69,6 +69,11 @@ + + io.quarkus.bootstrap + bootstrap-core + ${project.version} + io.quarkus quarkus-builder @@ -81,7 +86,7 @@ io.quarkus - quarkus-core-runtime + quarkus-core-deployment ${project.version} @@ -91,7 +96,7 @@ io.quarkus - quarkus-arc-runtime + quarkus-arc-deployment ${project.version} @@ -127,7 +132,7 @@ io.quarkus - quarkus-caffeine-runtime + quarkus-caffeine-deployment ${project.version} @@ -137,7 +142,7 @@ io.quarkus - quarkus-jaxb-runtime + quarkus-jaxb-deployment ${project.version} @@ -147,7 +152,7 @@ io.quarkus - quarkus-jsonb-runtime + quarkus-jsonb-deployment ${project.version} @@ -157,7 +162,7 @@ io.quarkus - quarkus-jsonp-runtime + quarkus-jsonp-deployment ${project.version} @@ -167,7 +172,7 @@ io.quarkus - quarkus-netty-runtime + quarkus-netty-deployment ${project.version} @@ -180,7 +185,7 @@ io.quarkus - quarkus-agroal-runtime + quarkus-agroal-deployment ${project.version} @@ -190,7 +195,7 @@ io.quarkus - quarkus-hibernate-validator-runtime + quarkus-hibernate-validator-deployment ${project.version} @@ -200,7 +205,7 @@ io.quarkus - quarkus-camel-core-runtime + quarkus-camel-core-deployment ${project.version} @@ -210,7 +215,7 @@ io.quarkus - quarkus-camel-aws-s3-runtime + quarkus-camel-aws-s3-deployment ${project.version} @@ -220,7 +225,7 @@ io.quarkus - quarkus-camel-salesforce-runtime + quarkus-camel-salesforce-deployment ${project.version} @@ -230,7 +235,7 @@ io.quarkus - quarkus-camel-netty4-http-runtime + quarkus-camel-netty4-http-deployment ${project.version} @@ -240,7 +245,7 @@ io.quarkus - quarkus-camel-infinispan-runtime + quarkus-camel-infinispan-deployment ${project.version} @@ -250,7 +255,7 @@ io.quarkus - quarkus-jdbc-postgresql-runtime + quarkus-jdbc-postgresql-deployment ${project.version} @@ -260,7 +265,7 @@ io.quarkus - quarkus-jdbc-h2-runtime + quarkus-jdbc-h2-deployment ${project.version} @@ -270,17 +275,17 @@ io.quarkus - quarkus-jdbc-mariadb-runtime + quarkus-jdbc-mariadb-deployment ${project.version} io.quarkus - quarkus-jdbc-mssql + quarkus-jdbc-mssql-deployment ${project.version} io.quarkus - quarkus-jdbc-mssql-runtime + quarkus-jdbc-mssql ${project.version} @@ -290,7 +295,7 @@ io.quarkus - quarkus-kafka-client-runtime + quarkus-kafka-client-deployment ${project.version} @@ -300,7 +305,7 @@ io.quarkus - quarkus-smallrye-reactive-streams-operators-runtime + quarkus-smallrye-reactive-streams-operators-deployment ${project.version} @@ -310,7 +315,7 @@ io.quarkus - quarkus-smallrye-reactive-type-converters-runtime + quarkus-smallrye-reactive-type-converters-deployment ${project.version} @@ -320,7 +325,7 @@ io.quarkus - quarkus-smallrye-fault-tolerance-runtime + quarkus-smallrye-fault-tolerance-deployment ${project.version} @@ -330,7 +335,7 @@ io.quarkus - quarkus-smallrye-health-runtime + quarkus-smallrye-health-deployment ${project.version} @@ -340,7 +345,7 @@ io.quarkus - quarkus-smallrye-metrics-runtime + quarkus-smallrye-metrics-deployment ${project.version} @@ -350,7 +355,7 @@ io.quarkus - quarkus-smallrye-openapi-runtime + quarkus-smallrye-openapi-deployment ${project.version} @@ -360,7 +365,7 @@ io.quarkus - quarkus-smallrye-opentracing-runtime + quarkus-smallrye-opentracing-deployment ${project.version} @@ -370,7 +375,7 @@ io.quarkus - quarkus-smallrye-rest-client-runtime + quarkus-smallrye-rest-client-deployment ${project.version} @@ -380,7 +385,7 @@ io.quarkus - quarkus-jaeger-runtime + quarkus-jaeger-deployment ${project.version} @@ -390,7 +395,7 @@ io.quarkus - quarkus-resteasy-runtime + quarkus-resteasy-deployment ${project.version} @@ -400,7 +405,7 @@ io.quarkus - quarkus-resteasy-jsonb-runtime + quarkus-resteasy-jsonb-deployment ${project.version} @@ -410,7 +415,7 @@ io.quarkus - quarkus-smallrye-jwt-runtime + quarkus-smallrye-jwt-deployment ${project.version} @@ -420,7 +425,7 @@ io.quarkus - quarkus-rest-client-runtime + quarkus-rest-client-deployment ${project.version} @@ -430,7 +435,7 @@ io.quarkus - quarkus-resteasy-common-runtime + quarkus-resteasy-common-deployment ${project.version} @@ -440,7 +445,7 @@ io.quarkus - quarkus-narayana-jta-runtime + quarkus-narayana-jta-deployment ${project.version} @@ -450,7 +455,7 @@ io.quarkus - quarkus-undertow-runtime + quarkus-undertow-deployment ${project.version} @@ -460,7 +465,7 @@ io.quarkus - quarkus-hibernate-orm-runtime + quarkus-hibernate-orm-deployment ${project.version} @@ -470,12 +475,17 @@ io.quarkus - quarkus-hibernate-orm-panache-runtime + quarkus-hibernate-orm-panache-deployment + ${project.version} + + + io.quarkus + quarkus-panache-common ${project.version} io.quarkus - quarkus-panache-common-runtime + quarkus-panache-common-deployment ${project.version} @@ -485,7 +495,7 @@ io.quarkus - quarkus-vertx-runtime + quarkus-vertx-deployment ${project.version} @@ -495,7 +505,7 @@ io.quarkus - quarkus-vertx-web-runtime + quarkus-vertx-web-deployment ${project.version} @@ -505,7 +515,7 @@ io.quarkus - quarkus-undertow-websockets-runtime + quarkus-undertow-websockets-deployment ${project.version} @@ -515,7 +525,7 @@ io.quarkus - quarkus-scheduler-runtime + quarkus-scheduler-deployment ${project.version} @@ -525,7 +535,7 @@ io.quarkus - quarkus-smallrye-reactive-messaging-runtime + quarkus-smallrye-reactive-messaging-deployment ${project.version} @@ -535,7 +545,7 @@ io.quarkus - quarkus-smallrye-reactive-messaging-kafka-runtime + quarkus-smallrye-reactive-messaging-kafka-deployment ${project.version} @@ -550,12 +560,12 @@ io.quarkus - quarkus-elytron-security-runtime + quarkus-elytron-security-deployment ${project.version} io.quarkus - quarkus-infinispan-client-runtime + quarkus-infinispan-client-deployment ${project.version} @@ -570,7 +580,7 @@ io.quarkus - quarkus-amazon-lambda-runtime + quarkus-amazon-lambda-deployment ${project.version} @@ -578,6 +588,11 @@ quarkus-kotlin ${project.version} + + io.quarkus + quarkus-kotlin-deployment + ${project.version} + @@ -652,16 +667,16 @@ ${project.version} - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin + ${project.version} - resolve + extension-descriptor - compile - true - ${project.build.outputDirectory}/dependencies.runtime + ${project.groupId}:${project.artifactId}-deployment:${project.version} diff --git a/core/creator/pom.xml b/core/creator/pom.xml index 475152c370a47..87bd33bcb05ea 100644 --- a/core/creator/pom.xml +++ b/core/creator/pom.xml @@ -31,29 +31,13 @@ - io.quarkus - quarkus-core - - - - org.apache.maven - maven-settings-builder - - - org.apache.maven - maven-resolver-provider + io.quarkus.bootstrap + bootstrap-core + provided - org.apache.maven.resolver - maven-resolver-connector-basic - - - org.apache.maven.resolver - maven-resolver-transport-file - - - org.apache.maven.resolver - maven-resolver-transport-http + io.quarkus + quarkus-core-deployment diff --git a/core/creator/src/main/java/io/quarkus/creator/AppArtifactResolver.java b/core/creator/src/main/java/io/quarkus/creator/AppArtifactResolver.java deleted file mode 100644 index aa6be6aeb80cd..0000000000000 --- a/core/creator/src/main/java/io/quarkus/creator/AppArtifactResolver.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2018 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.quarkus.creator; - -import java.nio.file.Path; -import java.util.List; - -/** - * Artifact resolver used to resolve application and/or its dependency artifacts. - * - * @author Alexey Loubyansky - */ -public interface AppArtifactResolver { - - /** - * (Re-)links an artifact to a path. - * - * @param appArtifact an artifact to (re-)link to the path - * @param localPath local path to the artifact - * @throws AppCreatorException in case of a failure - */ - void relink(AppArtifact appArtifact, Path localPath) throws AppCreatorException; - - /** - * Resolves an artifact. - * - * @param artifact artifact to resolve - * @return local path - * @throws AppCreatorException in case of a failure - */ - Path resolve(AppArtifact artifact) throws AppCreatorException; - - /** - * Collects all the artifact dependencies. - * - * @param artifact root artifact - * @return collected dependencies - * @throws AppCreatorException in case of a failure - */ - List collectDependencies(AppArtifact artifact) throws AppCreatorException; - - /** - * Collects artifact dependencies merging the provided direct dependencies in - * - * @param root root artifact - * @param deps some or all of the direct dependencies that should be used in place of the original ones - * @return collected dependencies - * @throws AppCreatorException in case of a failure - */ - List collectDependencies(AppArtifact root, List deps) throws AppCreatorException; - - /** - * Lists versions released later than the version of the artifact up to the version - * specified or all the later versions in case the up-to-version is not provided. - * - * @param artifact artifact to list the versions for - * @return the list of versions released later than the version of the artifact - * @throws AppCreatorException in case of a failure - */ - List listLaterVersions(AppArtifact artifact, String upToVersion, boolean inclusive) throws AppCreatorException; - - /** - * Returns the next version for the artifact which is not later than the version specified. - * In case the next version is not available, the artifact's version is returned. - * - * @param artifact artifact - * @param upToVersion max version boundary - * @param inclusive whether the upToVersion should be included in the range or not - * @return the next version which is not later than the specified boundary - * @throws AppCreatorException in case of a failure - */ - String getNextVersion(AppArtifact artifact, String upToVersion, boolean inclusive) throws AppCreatorException; - - /** - * Returns the latest version for the artifact up to the version specified. - * In case there is no later version available, the artifact's version is returned. - * - * @param artifact artifact - * @param upToVersion max version boundary - * @param inclusive whether the upToVersion should be included in the range or not - * @return the latest version up to specified boundary - * @throws AppCreatorException in case of a failure - */ - String getLatestVersion(AppArtifact artifact, String upToVersion, boolean inclusive) throws AppCreatorException; -} diff --git a/core/creator/src/main/java/io/quarkus/creator/AppArtifactResolverBase.java b/core/creator/src/main/java/io/quarkus/creator/AppArtifactResolverBase.java deleted file mode 100644 index bc768285e5dc5..0000000000000 --- a/core/creator/src/main/java/io/quarkus/creator/AppArtifactResolverBase.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - */ -package io.quarkus.creator; - -import java.nio.file.Path; - -/** - * - * @author Alexey Loubyansky - */ -public abstract class AppArtifactResolverBase implements AppArtifactResolver { - - @Override - public Path resolve(AppArtifact artifact) throws AppCreatorException { - Path path = artifact.getPath(); - if (path != null) { - return path; - } - doResolve(artifact); - path = artifact.getPath(); - if (path == null) { - throw new AppCreatorException("Failed to resolve " + artifact); - } - return path; - } - - protected static void setPath(AppArtifact artifact, Path p) { - artifact.setPath(p); - } - - protected abstract void doResolve(AppArtifact artifact) throws AppCreatorException; -} diff --git a/core/creator/src/main/java/io/quarkus/creator/AppCreator.java b/core/creator/src/main/java/io/quarkus/creator/AppCreator.java index 57afb855235c5..26e3a1cf3f9e0 100644 --- a/core/creator/src/main/java/io/quarkus/creator/AppCreator.java +++ b/core/creator/src/main/java/io/quarkus/creator/AppCreator.java @@ -28,12 +28,13 @@ import java.util.Map; import java.util.ServiceLoader; +import io.quarkus.bootstrap.resolver.AppModelResolver; +import io.quarkus.bootstrap.util.IoUtils; import io.quarkus.creator.config.reader.MappedPropertiesHandler; import io.quarkus.creator.config.reader.PropertiesConfigReaderException; import io.quarkus.creator.config.reader.PropertiesHandler; import io.quarkus.creator.outcome.OutcomeResolver; import io.quarkus.creator.outcome.OutcomeResolverFactory; -import io.quarkus.creator.util.IoUtils; /** * @@ -47,7 +48,7 @@ public static class Builder { private List phases = Collections.emptyList(); private Path appJar; private Path workDir; - private AppArtifactResolver artifactResolver; + private AppModelResolver modelResolver; private Builder() { } @@ -94,15 +95,15 @@ public Builder setWorkDir(Path dir) { } /** - * Artifact resolver which should be used to resolve application - * dependencies. + * Application model resolver which should be used to resolve + * application dependencies. * If artifact resolver is not set by the user, the default one will be * created based on the user Maven settings.xml file. * * @param resolver artifact resolver */ - public Builder setArtifactResolver(AppArtifactResolver resolver) { - this.artifactResolver = resolver; + public Builder setModelResolver(AppModelResolver resolver) { + this.modelResolver = resolver; return this; } @@ -175,7 +176,7 @@ public AppCreator getTarget() throws PropertiesConfigReaderException { private AppCreator initAppCreator() throws AppCreatorException { final AppCreator target = new AppCreator(); target.setWorkDir(workDir); - target.artifactResolver = artifactResolver; + target.artifactResolver = modelResolver; target.appJar = appJar; return target; } @@ -191,7 +192,7 @@ public static Builder builder() { } private OutcomeResolver outcomeResolver; - private AppArtifactResolver artifactResolver; + private AppModelResolver artifactResolver; private Path appJar; private Path workDir; private boolean deleteTmpDir = true; @@ -224,7 +225,7 @@ public Path getWorkDir() { * * @return artifact resolver for application dependencies */ - public AppArtifactResolver getArtifactResolver() { + public AppModelResolver getArtifactResolver() { return artifactResolver; } diff --git a/core/creator/src/main/java/io/quarkus/creator/NoOpArtifactResolver.java b/core/creator/src/main/java/io/quarkus/creator/NoOpArtifactResolver.java deleted file mode 100644 index 8cdef81653725..0000000000000 --- a/core/creator/src/main/java/io/quarkus/creator/NoOpArtifactResolver.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2018 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.quarkus.creator; - -import java.nio.file.Path; -import java.util.List; - -/** - * - * @author Alexey Loubyansky - */ -public class NoOpArtifactResolver extends AppArtifactResolverBase { - - @Override - public void relink(AppArtifact appArtifact, Path localPath) throws AppCreatorException { - throw new UnsupportedOperationException(); - } - - @Override - public List collectDependencies(AppArtifact artifact) throws AppCreatorException { - throw new UnsupportedOperationException(); - } - - @Override - public List collectDependencies(AppArtifact root, List deps) throws AppCreatorException { - throw new UnsupportedOperationException(); - } - - @Override - public List listLaterVersions(AppArtifact artifact, String upToVersion, boolean inclusive) - throws AppCreatorException { - throw new UnsupportedOperationException(); - } - - @Override - public String getNextVersion(AppArtifact artifact, String upToVersion, boolean inclusive) throws AppCreatorException { - throw new UnsupportedOperationException(); - } - - @Override - public String getLatestVersion(AppArtifact artifact, String upToVersion, boolean inclusive) throws AppCreatorException { - throw new UnsupportedOperationException(); - } - - @Override - protected void doResolve(AppArtifact artifact) throws AppCreatorException { - throw new UnsupportedOperationException(); - } -} diff --git a/core/creator/src/main/java/io/quarkus/creator/demo/AppCreatorDemo.java b/core/creator/src/main/java/io/quarkus/creator/demo/AppCreatorDemo.java index 879248c0abc9f..c9274ca535c00 100644 --- a/core/creator/src/main/java/io/quarkus/creator/demo/AppCreatorDemo.java +++ b/core/creator/src/main/java/io/quarkus/creator/demo/AppCreatorDemo.java @@ -28,6 +28,8 @@ import java.util.List; import java.util.Set; +import io.quarkus.bootstrap.util.IoUtils; +import io.quarkus.bootstrap.util.PropertyUtils; import io.quarkus.creator.AppCreator; import io.quarkus.creator.phase.augment.AugmentPhase; import io.quarkus.creator.phase.curate.CuratePhase; @@ -35,8 +37,6 @@ import io.quarkus.creator.phase.nativeimage.NativeImagePhase; import io.quarkus.creator.phase.runnerjar.RunnerJarOutcome; import io.quarkus.creator.phase.runnerjar.RunnerJarPhase; -import io.quarkus.creator.util.IoUtils; -import io.quarkus.creator.util.PropertyUtils; /** * diff --git a/core/creator/src/main/java/io/quarkus/creator/demo/CheckUpdatesDemo.java b/core/creator/src/main/java/io/quarkus/creator/demo/CheckUpdatesDemo.java index 571a49a977802..3b616987cd51a 100644 --- a/core/creator/src/main/java/io/quarkus/creator/demo/CheckUpdatesDemo.java +++ b/core/creator/src/main/java/io/quarkus/creator/demo/CheckUpdatesDemo.java @@ -19,8 +19,8 @@ import java.util.Properties; +import io.quarkus.bootstrap.model.AppDependency; import io.quarkus.creator.AppCreator; -import io.quarkus.creator.AppDependency; import io.quarkus.creator.phase.curate.CurateOutcome; import io.quarkus.creator.phase.curate.CuratePhase; import io.quarkus.creator.phase.curate.VersionUpdate; diff --git a/core/creator/src/main/java/io/quarkus/creator/demo/ConfigDemoBase.java b/core/creator/src/main/java/io/quarkus/creator/demo/ConfigDemoBase.java index 241cc8f073e6e..43651e7a903b8 100644 --- a/core/creator/src/main/java/io/quarkus/creator/demo/ConfigDemoBase.java +++ b/core/creator/src/main/java/io/quarkus/creator/demo/ConfigDemoBase.java @@ -30,12 +30,12 @@ import java.util.Properties; import java.util.Set; +import io.quarkus.bootstrap.util.IoUtils; +import io.quarkus.bootstrap.util.PropertyUtils; import io.quarkus.creator.AppCreator; import io.quarkus.creator.config.reader.PropertiesConfigReader; import io.quarkus.creator.config.reader.PropertiesHandler; import io.quarkus.creator.phase.curate.CuratePhase; -import io.quarkus.creator.util.IoUtils; -import io.quarkus.creator.util.PropertyUtils; /** * @@ -51,7 +51,7 @@ public ConfigDemoBase() { public void run() throws Exception { - final long startTime = System.currentTimeMillis(); + //final long startTime = System.nanoTime(); final Path appJar = getAppJar(); if (!Files.exists(appJar)) { @@ -78,9 +78,7 @@ public void run() throws Exception { } } - final long time = System.currentTimeMillis() - startTime; - final long seconds = time / 1000; - System.out.println("Done in " + seconds + "." + (time - seconds * 1000) + " seconds"); + //System.out.println(IoUtils.tookTime("Demo", startTime)); } protected void demo(AppCreator creator) throws Exception { diff --git a/core/creator/src/main/java/io/quarkus/creator/demo/NativeImageOutcomeDemo.java b/core/creator/src/main/java/io/quarkus/creator/demo/NativeImageOutcomeDemo.java index 8e762bd021c91..ae51830f8d955 100644 --- a/core/creator/src/main/java/io/quarkus/creator/demo/NativeImageOutcomeDemo.java +++ b/core/creator/src/main/java/io/quarkus/creator/demo/NativeImageOutcomeDemo.java @@ -22,7 +22,7 @@ import java.util.Properties; import io.quarkus.creator.AppCreator; -import io.quarkus.creator.phase.nativeimage.NativeImageOutcome; +import io.quarkus.creator.phase.runnerjar.RunnerJarOutcome; /** * @@ -46,8 +46,14 @@ protected void initProps(Properties props) { props.setProperty("native-image.disable-reports", "true"); } + @Override + protected boolean isLogLibDiff() { + return true; + } + @Override public void demo(AppCreator creator) throws Exception { - creator.resolveOutcome(NativeImageOutcome.class); + //creator.resolveOutcome(NativeImageOutcome.class); + creator.resolveOutcome(RunnerJarOutcome.class); } } diff --git a/core/creator/src/main/java/io/quarkus/creator/phase/augment/AugmentOutcome.java b/core/creator/src/main/java/io/quarkus/creator/phase/augment/AugmentOutcome.java index 5140355568990..b0dce67f3b82c 100644 --- a/core/creator/src/main/java/io/quarkus/creator/phase/augment/AugmentOutcome.java +++ b/core/creator/src/main/java/io/quarkus/creator/phase/augment/AugmentOutcome.java @@ -19,8 +19,6 @@ import java.nio.file.Path; -import io.quarkus.creator.AppDependency; - /** * Represents an outcome of {@link AugmentPhase} * @@ -49,15 +47,4 @@ public interface AugmentOutcome { * @return directory containing generated classes */ Path getWiringClassesDir(); - - /** - * Phases that consume this outcome may check whether an application - * dependency was "whitelisted" for processing during augmentation. - *

- * The need for this method has to be further reviewed. - * - * @param dep application dependency - * @return true if the dependency was whitelisted, otherwise - false - */ - boolean isWhitelisted(AppDependency dep); } diff --git a/core/creator/src/main/java/io/quarkus/creator/phase/augment/AugmentPhase.java b/core/creator/src/main/java/io/quarkus/creator/phase/augment/AugmentPhase.java index 898b78b5a274b..02739144df0ec 100644 --- a/core/creator/src/main/java/io/quarkus/creator/phase/augment/AugmentPhase.java +++ b/core/creator/src/main/java/io/quarkus/creator/phase/augment/AugmentPhase.java @@ -17,24 +17,18 @@ package io.quarkus.creator.phase.augment; -import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; import java.io.OutputStream; import java.net.URL; import java.net.URLClassLoader; -import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentLinkedDeque; import java.util.concurrent.ExecutorService; @@ -42,8 +36,6 @@ import java.util.concurrent.Future; import java.util.function.BiFunction; import java.util.function.Consumer; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; import org.eclipse.microprofile.config.Config; import org.jboss.builder.BuildResult; @@ -52,18 +44,18 @@ import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.ClassWriter; -import io.quarkus.creator.AppArtifact; -import io.quarkus.creator.AppArtifactResolver; +import io.quarkus.bootstrap.BootstrapDependencyProcessingException; +import io.quarkus.bootstrap.model.AppDependency; +import io.quarkus.bootstrap.resolver.AppModelResolver; +import io.quarkus.bootstrap.util.IoUtils; +import io.quarkus.bootstrap.util.ZipUtils; import io.quarkus.creator.AppCreationPhase; import io.quarkus.creator.AppCreator; import io.quarkus.creator.AppCreatorException; -import io.quarkus.creator.AppDependency; import io.quarkus.creator.config.reader.MappedPropertiesHandler; import io.quarkus.creator.config.reader.PropertiesHandler; import io.quarkus.creator.outcome.OutcomeProviderRegistration; import io.quarkus.creator.phase.curate.CurateOutcome; -import io.quarkus.creator.util.IoUtils; -import io.quarkus.creator.util.ZipUtils; import io.quarkus.deployment.ClassOutput; import io.quarkus.deployment.QuarkusAugmentor; import io.quarkus.deployment.QuarkusClassWriter; @@ -81,17 +73,12 @@ */ public class AugmentPhase implements AppCreationPhase, AugmentOutcome { - private static final String DEPENDENCIES_RUNTIME = "dependencies.runtime"; - private static final String FILENAME_STEP_CLASSES = "META-INF/quarkus-build-steps.list"; - private static final String PROVIDED = "provided"; - private static final Logger log = Logger.getLogger(AugmentPhase.class); private Path outputDir; private Path appClassesDir; private Path transformedClassesDir; private Path wiringClassesDir; - private Set whitelist = new HashSet<>(); /** * Output directory for the outcome of this phase. @@ -159,11 +146,6 @@ public Path getWiringClassesDir() { return wiringClassesDir; } - @Override - public boolean isWhitelisted(AppDependency dep) { - return whitelist.contains(getDependencyConflictId(dep.getArtifact())); - } - @Override public void register(OutcomeProviderRegistration registration) throws AppCreatorException { registration.provides(AugmentOutcome.class); @@ -177,7 +159,7 @@ public void provideOutcome(AppCreator ctx) throws AppCreatorException { if (appClassesDir == null) { appClassesDir = outputDir.resolve("classes"); - final Path appJar = appState.getArtifactResolver().resolve(appState.getAppArtifact()); + Path appJar = appState.getAppArtifact().getPath(); try { ZipUtils.unzip(appJar, appClassesDir); } catch (IOException e) { @@ -215,71 +197,26 @@ private void doProcess(CurateOutcome appState) throws AppCreatorException { } } - final AppArtifactResolver depResolver = appState.getArtifactResolver(); - final List appDeps = appState.getEffectiveDeps(); - + final AppModelResolver depResolver = appState.getArtifactResolver(); + List appDeps; + try { + appDeps = appState.getEffectiveModel().getAllDependencies(); + } catch (BootstrapDependencyProcessingException e) { + throw new AppCreatorException("Failed to resolve application build classpath", e); + } URLClassLoader runnerClassLoader = null; try { // we need to make sure all the deployment artifacts are on the class path - final List cpUrls = new ArrayList<>(); + final List cpUrls = new ArrayList<>(appDeps.size() + 1); cpUrls.add(appClassesDir.toUri().toURL()); - List problems = null; for (AppDependency appDep : appDeps) { - final AppArtifact depArtifact = appDep.getArtifact(); - final Path resolvedDep = depResolver.resolve(depArtifact); + final Path resolvedDep = depResolver.resolve(appDep.getArtifact()); cpUrls.add(resolvedDep.toUri().toURL()); - - if (!"jar".equals(depArtifact.getType())) { - continue; - } - try (ZipFile zip = openZipFile(resolvedDep)) { - boolean deploymentArtifact = zip.getEntry("META-INF/quarkus-build-steps.list") != null; - if (!appDep.getScope().equals(PROVIDED) && deploymentArtifact) { - if (problems == null) { - problems = new ArrayList<>(); - } - problems.add("Artifact " + appDep - + " is a deployment artifact, however it does not have scope required. This will result in unnecessary jars being included in the final image"); - } - if (!deploymentArtifact) { - ZipEntry entry = zip.getEntry(DEPENDENCIES_RUNTIME); - if (entry != null) { - whitelist.add(getDependencyConflictId(appDep.getArtifact())); - try (InputStream in = zip.getInputStream(entry)) { - BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)); - String line; - while ((line = reader.readLine()) != null) { - String[] parts = line.trim().split(":"); - if (parts.length < 5) { - continue; - } - String scope = parts[4]; - if (scope.equals("test")) { - continue; - } - StringBuilder sb = new StringBuilder(); - //the last two bits are version and scope - //which we don't want - for (int i = 0; i < parts.length - 2; ++i) { - if (i > 0) { - sb.append(':'); - } - sb.append(parts[i]); - } - whitelist.add(sb.toString()); - } - } - } - } - } - } - if (problems != null) { - //TODO: add a config option to just log an error instead - throw new AppCreatorException(problems.toString()); } runnerClassLoader = new URLClassLoader(cpUrls.toArray(new URL[cpUrls.size()]), getClass().getClassLoader()); + final Path wiringClassesDirectory = wiringClassesDir; ClassOutput classOutput = new ClassOutput() { @Override @@ -407,31 +344,6 @@ public FutureEntry call() throws Exception { } } - private static String getDependencyConflictId(AppArtifact coords) { - StringBuilder sb = new StringBuilder(128); - sb.append(coords.getGroupId()); - sb.append(':'); - sb.append(coords.getArtifactId()); - sb.append(':'); - sb.append(coords.getType()); - if (!coords.getClassifier().isEmpty()) { - sb.append(':'); - sb.append(coords.getClassifier()); - } - return sb.toString(); - } - - private ZipFile openZipFile(Path p) { - if (!Files.isReadable(p)) { - throw new RuntimeException("File not existing or not allowed for reading: " + p); - } - try { - return new ZipFile(p.toFile()); - } catch (IOException e) { - throw new RuntimeException("Error opening zip stream from artifact: " + p, e); - } - } - private static final class FutureEntry { final byte[] data; final String location; diff --git a/core/creator/src/main/java/io/quarkus/creator/phase/curate/CurateOutcome.java b/core/creator/src/main/java/io/quarkus/creator/phase/curate/CurateOutcome.java index 0577805a90d89..0ce23bcfc0ae1 100644 --- a/core/creator/src/main/java/io/quarkus/creator/phase/curate/CurateOutcome.java +++ b/core/creator/src/main/java/io/quarkus/creator/phase/curate/CurateOutcome.java @@ -27,13 +27,15 @@ import org.apache.maven.model.Repository; import org.jboss.logging.Logger; -import io.quarkus.creator.AppArtifact; -import io.quarkus.creator.AppArtifactResolver; +import io.quarkus.bootstrap.model.AppArtifact; +import io.quarkus.bootstrap.model.AppDependency; +import io.quarkus.bootstrap.model.AppModel; +import io.quarkus.bootstrap.resolver.AppModelResolver; +import io.quarkus.bootstrap.resolver.AppModelResolverException; +import io.quarkus.bootstrap.resolver.BootstrapAppModelResolver; +import io.quarkus.bootstrap.resolver.maven.workspace.ModelUtils; import io.quarkus.creator.AppCreator; import io.quarkus.creator.AppCreatorException; -import io.quarkus.creator.AppDependency; -import io.quarkus.creator.NoOpArtifactResolver; -import io.quarkus.creator.resolver.aether.AetherArtifactResolver; /** * @@ -51,34 +53,28 @@ public class CurateOutcome { public static class Builder { - private AppArtifact appArtifact; private AppArtifact stateArtifact; - private List initialDeps = Collections.emptyList(); + private AppModel appModel; private List updatedDeps = Collections.emptyList(); - private AppArtifactResolver resolver; + private AppModelResolver resolver; private List artifactRepos = Collections.emptyList(); private boolean loadedFromState; private Builder() { } - public Builder setAppArtifact(AppArtifact appArtifact) { - this.appArtifact = appArtifact; - return this; - } - public Builder setStateArtifact(AppArtifact stateArtifact) { this.stateArtifact = stateArtifact; return this; } - public Builder setArtifactResolver(AppArtifactResolver resolver) { + public Builder setAppModelResolver(AppModelResolver resolver) { this.resolver = resolver; return this; } - public Builder setInitialDeps(List deps) { - this.initialDeps = deps; + public Builder setAppModel(AppModel appModel) { + this.appModel = appModel; return this; } @@ -104,38 +100,35 @@ public static Builder builder() { return new Builder(); } - protected final AppArtifact appArtifact; protected final AppArtifact stateArtifact; - protected final List initialDeps; + protected final AppModel initialModel; protected final List updatedDeps; - protected final AppArtifactResolver resolver; + protected final AppModelResolver resolver; protected final List artifactRepos; protected final boolean loadedFromState; - protected List effectiveDeps; + protected AppModel effectiveModel; protected boolean persisted; public CurateOutcome(Builder builder) { - this.appArtifact = builder.appArtifact; this.stateArtifact = builder.stateArtifact; - this.initialDeps = builder.initialDeps.isEmpty() ? builder.initialDeps - : Collections.unmodifiableList(builder.initialDeps); + this.initialModel = builder.appModel; this.updatedDeps = builder.updatedDeps.isEmpty() ? builder.updatedDeps : Collections.unmodifiableList(builder.updatedDeps); - this.resolver = builder.resolver == null ? new NoOpArtifactResolver() : builder.resolver; + this.resolver = builder.resolver; this.artifactRepos = builder.artifactRepos; this.loadedFromState = builder.loadedFromState; } - public AppArtifactResolver getArtifactResolver() { + public AppModelResolver getArtifactResolver() { return resolver; } public AppArtifact getAppArtifact() { - return appArtifact; + return initialModel.getAppArtifact(); } - public List getInitialDeps() { - return initialDeps; + public AppModel getInitialModel() { + return initialModel; } public boolean hasUpdatedDeps() { @@ -146,14 +139,18 @@ public List getUpdatedDeps() { return updatedDeps; } - public List getEffectiveDeps() throws AppCreatorException { - if (effectiveDeps != null) { - return effectiveDeps; + public AppModel getEffectiveModel() throws AppCreatorException { + if (effectiveModel != null) { + return effectiveModel; } if (updatedDeps.isEmpty()) { - return effectiveDeps = initialDeps; + return effectiveModel = initialModel; + } + try { + return effectiveModel = resolver.resolveModel(initialModel.getAppArtifact(), updatedDeps); + } catch (AppModelResolverException e) { + throw new AppCreatorException("Failed to resolve effective application dependencies", e); } - return effectiveDeps = resolver.collectDependencies(appArtifact, updatedDeps); } public boolean isPersisted() { @@ -170,9 +167,10 @@ public void persist(AppCreator ctx) throws AppCreatorException { final Path stateDir = ctx.createWorkDir("state"); final Path statePom = stateDir.resolve("pom.xml"); + final AppArtifact appArtifact = initialModel.getAppArtifact(); AppArtifact stateArtifact; if (this.stateArtifact == null) { - stateArtifact = Utils.getStateArtifact(appArtifact); + stateArtifact = ModelUtils.getStateArtifact(appArtifact); } else { stateArtifact = new AppArtifact(this.stateArtifact.getGroupId(), this.stateArtifact.getArtifactId(), @@ -240,9 +238,13 @@ public void persist(AppCreator ctx) throws AppCreatorException { * } * } */ - Utils.persistModel(statePom, model); - ((AetherArtifactResolver) resolver).install(stateArtifact, statePom); + try { + ModelUtils.persistModel(statePom, model); + ((BootstrapAppModelResolver) resolver).install(stateArtifact, statePom); + } catch (Exception e) { + throw new AppCreatorException("Failed to persist application state artifact", e); + } log.info("Persisted provisioning state as " + stateArtifact); //ctx.getArtifactResolver().relink(stateArtifact, statePom); diff --git a/core/creator/src/main/java/io/quarkus/creator/phase/curate/CuratePhase.java b/core/creator/src/main/java/io/quarkus/creator/phase/curate/CuratePhase.java index 8815ca6335cfa..0bd6193219d46 100644 --- a/core/creator/src/main/java/io/quarkus/creator/phase/curate/CuratePhase.java +++ b/core/creator/src/main/java/io/quarkus/creator/phase/curate/CuratePhase.java @@ -35,17 +35,22 @@ import org.eclipse.aether.repository.RepositoryPolicy; import org.jboss.logging.Logger; -import io.quarkus.creator.AppArtifact; -import io.quarkus.creator.AppArtifactResolver; +import io.quarkus.bootstrap.BootstrapDependencyProcessingException; +import io.quarkus.bootstrap.model.AppArtifact; +import io.quarkus.bootstrap.model.AppDependency; +import io.quarkus.bootstrap.model.AppModel; +import io.quarkus.bootstrap.resolver.AppModelResolver; +import io.quarkus.bootstrap.resolver.AppModelResolverException; +import io.quarkus.bootstrap.resolver.BootstrapAppModelResolver; +import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver; +import io.quarkus.bootstrap.resolver.maven.workspace.ModelUtils; import io.quarkus.creator.AppCreationPhase; import io.quarkus.creator.AppCreator; import io.quarkus.creator.AppCreatorException; -import io.quarkus.creator.AppDependency; import io.quarkus.creator.config.reader.MappedPropertiesHandler; import io.quarkus.creator.config.reader.PropertiesConfigReaderException; import io.quarkus.creator.config.reader.PropertiesHandler; import io.quarkus.creator.outcome.OutcomeProviderRegistration; -import io.quarkus.creator.resolver.aether.AetherArtifactResolver; /** * @@ -153,75 +158,82 @@ public void provideOutcome(AppCreator ctx) throws AppCreatorException { final CurateOutcome.Builder outcome = CurateOutcome.builder(); - final AppArtifact appArtifact = Utils.resolveAppArtifact(appJar); - outcome.setAppArtifact(appArtifact); + AppArtifact appArtifact; + try { + appArtifact = ModelUtils.resolveAppArtifact(appJar); + } catch (IOException e) { + throw new AppCreatorException("Failed to resolve application artifact coordindates from " + appJar, e); + } - AppArtifactResolver resolver = ctx.getArtifactResolver(); - if (resolver == null) { - final AetherArtifactResolver aetherResolver = AetherArtifactResolver - .getInstance(this.localRepo == null ? ctx.getWorkPath("repo") : this.localRepo); - aetherResolver.relink(appArtifact, appJar); - final List artifactRepos = aetherResolver.resolveArtifactRepos(appArtifact); - if (!artifactRepos.isEmpty()) { - aetherResolver.addRemoteRepositories(artifactRepos); - final List modelRepos = new ArrayList<>(artifactRepos.size()); - for (RemoteRepository repo : artifactRepos) { - final Repository modelRepo = new Repository(); - modelRepo.setId(repo.getId()); - modelRepo.setUrl(repo.getUrl()); - modelRepo.setLayout(repo.getContentType()); - RepositoryPolicy policy = repo.getPolicy(true); - if (policy != null) { - modelRepo.setSnapshots(toMavenRepoPolicy(policy)); - } - policy = repo.getPolicy(false); - if (policy != null) { - modelRepo.setReleases(toMavenRepoPolicy(policy)); + AppModelResolver modelResolver = ctx.getArtifactResolver(); + final AppModel initialDepsList; + try { + if (modelResolver == null) { + final BootstrapAppModelResolver bsResolver = new BootstrapAppModelResolver( + MavenArtifactResolver.builder() + .setRepoHome(this.localRepo == null ? ctx.getWorkPath("repo") : this.localRepo) + .build()); + bsResolver.relink(appArtifact, appJar); + final List artifactRepos = bsResolver.resolveArtifactRepos(appArtifact); + if (!artifactRepos.isEmpty()) { + bsResolver.addRemoteRepositories(artifactRepos); + final List modelRepos = new ArrayList<>(artifactRepos.size()); + for (RemoteRepository repo : artifactRepos) { + final Repository modelRepo = new Repository(); + modelRepo.setId(repo.getId()); + modelRepo.setUrl(repo.getUrl()); + modelRepo.setLayout(repo.getContentType()); + RepositoryPolicy policy = repo.getPolicy(true); + if (policy != null) { + modelRepo.setSnapshots(toMavenRepoPolicy(policy)); + } + policy = repo.getPolicy(false); + if (policy != null) { + modelRepo.setReleases(toMavenRepoPolicy(policy)); + } + modelRepos.add(modelRepo); } - modelRepos.add(modelRepo); + outcome.setArtifactRepos(modelRepos); } - outcome.setArtifactRepos(modelRepos); + modelResolver = bsResolver; + } else { + modelResolver.relink(appArtifact, appJar); } - resolver = aetherResolver; - } else { - resolver.relink(appArtifact, appJar); - } - outcome.setArtifactResolver(resolver); + outcome.setAppModelResolver(modelResolver); - final List initialDepsList; - if (depsOrigin == DependenciesOrigin.LAST_UPDATE) { - log.info("Looking for the state of the last update"); - Path statePath = null; - try { - AppArtifact stateArtifact = Utils.getStateArtifact(appArtifact); - final String latest = resolver.getLatestVersion(stateArtifact, null, false); - if (!stateArtifact.getVersion().equals(latest)) { - stateArtifact = new AppArtifact(stateArtifact.getGroupId(), - stateArtifact.getArtifactId(), - stateArtifact.getClassifier(), - stateArtifact.getType(), - latest); + if (depsOrigin == DependenciesOrigin.LAST_UPDATE) { + log.info("Looking for the state of the last update"); + Path statePath = null; + try { + AppArtifact stateArtifact = ModelUtils.getStateArtifact(appArtifact); + final String latest = modelResolver.getLatestVersion(stateArtifact, null, false); + if (!stateArtifact.getVersion().equals(latest)) { + stateArtifact = new AppArtifact(stateArtifact.getGroupId(), stateArtifact.getArtifactId(), + stateArtifact.getClassifier(), stateArtifact.getType(), latest); + } + statePath = modelResolver.resolve(stateArtifact); + outcome.setStateArtifact(stateArtifact); + log.info("- located the state at " + statePath); + } catch (AppModelResolverException e) { + // for now let's assume this means artifact does not exist + // System.out.println(" no state found"); } - statePath = resolver.resolve(stateArtifact); - outcome.setStateArtifact(stateArtifact); - log.info("- located the state at " + statePath); - } catch (AppCreatorException e) { - // for now let's assume this means artifact does not exist - //System.out.println(" no state found"); - } - if (statePath != null) { - try { - final Model model = Utils.readModel(statePath); + if (statePath != null) { + Model model; + try { + model = ModelUtils.readModel(statePath); + } catch (IOException e) { + throw new AppCreatorException("Failed to read application state " + statePath, e); + } /* - * final Properties props = model.getProperties(); - * final String appGroupId = props.getProperty(CurateOutcome.CREATOR_APP_GROUP_ID); - * final String appArtifactId = props.getProperty(CurateOutcome.CREATOR_APP_ARTIFACT_ID); - * final String appClassifier = props.getProperty(CurateOutcome.CREATOR_APP_CLASSIFIER); - * final String appType = props.getProperty(CurateOutcome.CREATOR_APP_TYPE); - * final String appVersion = props.getProperty(CurateOutcome.CREATOR_APP_VERSION); - * final AppArtifact modelAppArtifact = new AppArtifact(appGroupId, appArtifactId, appClassifier, appType, - * appVersion); + * final Properties props = model.getProperties(); final String appGroupId = + * props.getProperty(CurateOutcome.CREATOR_APP_GROUP_ID); final String appArtifactId = + * props.getProperty(CurateOutcome.CREATOR_APP_ARTIFACT_ID); final String appClassifier = + * props.getProperty(CurateOutcome.CREATOR_APP_CLASSIFIER); final String appType = + * props.getProperty(CurateOutcome.CREATOR_APP_TYPE); final String appVersion = + * props.getProperty(CurateOutcome.CREATOR_APP_VERSION); final AppArtifact modelAppArtifact = new + * AppArtifact(appGroupId, appArtifactId, appClassifier, appType, appVersion); */ final List modelStateDeps = model.getDependencies(); final List updatedDeps = new ArrayList<>(modelStateDeps.size()); @@ -231,32 +243,37 @@ public void provideOutcome(AppCreator ctx) throws AppCreatorException { continue; } updatedDeps.add(new AppDependency(new AppArtifact(modelDep.getGroupId(), modelDep.getArtifactId(), - modelDep.getClassifier(), modelDep.getType(), modelDep.getVersion()), modelDep.getScope())); + modelDep.getClassifier(), modelDep.getType(), modelDep.getVersion()), modelDep.getScope(), + modelDep.isOptional())); } - initialDepsList = resolver.collectDependencies(appArtifact, updatedDeps); + initialDepsList = modelResolver.resolveModel(appArtifact, updatedDeps); outcome.setLoadedFromState(); - } catch (IOException e) { - throw new AppCreatorException("Failed to load application state POM " + statePath, e); + } else { + initialDepsList = modelResolver.resolveModel(appArtifact); } } else { - initialDepsList = resolver.collectDependencies(appArtifact); + initialDepsList = modelResolver.resolveModel(appArtifact); } - } else { - initialDepsList = resolver.collectDependencies(appArtifact); + } catch (AppModelResolverException e) { + throw new AppCreatorException("Failed to resolve initial application dependencies", e); } - //logDeps("INITIAL:", initialDepsList); - outcome.setInitialDeps(initialDepsList); + outcome.setAppModel(initialDepsList); if (update == VersionUpdate.NONE) { ctx.pushOutcome(outcome.build()); return; } log.info("Checking for available updates"); - final List appDeps = Utils.getUpdateCandidates(Utils.readAppModel(appJar, appArtifact).getDependencies(), - initialDepsList, updateGroupIds); - final UpdateDiscovery ud = new DefaultUpdateDiscovery(resolver, updateNumber); + List appDeps; + try { + appDeps = ModelUtils.getUpdateCandidates(ModelUtils.readAppModel(appJar, appArtifact).getDependencies(), + initialDepsList.getAllDependencies(), updateGroupIds); + } catch (IOException | BootstrapDependencyProcessingException e) { + throw new AppCreatorException("Failed to determine the list of dependencies to update", e); + } + final UpdateDiscovery ud = new DefaultUpdateDiscovery(modelResolver, updateNumber); List availableUpdates = null; int i = 0; while (i < appDeps.size()) { diff --git a/core/creator/src/main/java/io/quarkus/creator/phase/curate/DefaultUpdateDiscovery.java b/core/creator/src/main/java/io/quarkus/creator/phase/curate/DefaultUpdateDiscovery.java index df684a70fa9d5..308233899b647 100644 --- a/core/creator/src/main/java/io/quarkus/creator/phase/curate/DefaultUpdateDiscovery.java +++ b/core/creator/src/main/java/io/quarkus/creator/phase/curate/DefaultUpdateDiscovery.java @@ -19,8 +19,9 @@ import java.util.List; -import io.quarkus.creator.AppArtifact; -import io.quarkus.creator.AppArtifactResolver; +import io.quarkus.bootstrap.model.AppArtifact; +import io.quarkus.bootstrap.resolver.AppModelResolver; +import io.quarkus.bootstrap.resolver.AppModelResolverException; import io.quarkus.creator.AppCreatorException; /** @@ -29,22 +30,30 @@ */ public class DefaultUpdateDiscovery implements UpdateDiscovery { - private final AppArtifactResolver resolver; + private final AppModelResolver resolver; private final VersionUpdateNumber updateNumber; - public DefaultUpdateDiscovery(AppArtifactResolver resolver, VersionUpdateNumber updateNumber) { + public DefaultUpdateDiscovery(AppModelResolver resolver, VersionUpdateNumber updateNumber) { this.resolver = resolver; this.updateNumber = updateNumber; } @Override public List listUpdates(AppArtifact artifact) throws AppCreatorException { - return resolver.listLaterVersions(artifact, resolveUpToVersion(artifact), false); + try { + return resolver.listLaterVersions(artifact, resolveUpToVersion(artifact), false); + } catch (AppModelResolverException e) { + throw new AppCreatorException("Failed to collect later versions", e); + } } @Override public String getNextVersion(AppArtifact artifact) throws AppCreatorException { - return resolver.getNextVersion(artifact, resolveUpToVersion(artifact), false); + try { + return resolver.getNextVersion(artifact, resolveUpToVersion(artifact), false); + } catch (AppModelResolverException e) { + throw new AppCreatorException("Failed to determine the next available version", e); + } } @Override @@ -62,7 +71,11 @@ public String getLatestVersion(AppArtifact artifact) throws AppCreatorException * } * return latestStr; */ - return resolver.getLatestVersion(artifact, resolveUpToVersion(artifact), false); + try { + return resolver.getLatestVersion(artifact, resolveUpToVersion(artifact), false); + } catch (AppModelResolverException e) { + throw new AppCreatorException("Failed to determine the latest available version", e); + } } private String resolveUpToVersion(AppArtifact artifact) throws AppCreatorException { diff --git a/core/creator/src/main/java/io/quarkus/creator/phase/curate/UpdateDiscovery.java b/core/creator/src/main/java/io/quarkus/creator/phase/curate/UpdateDiscovery.java index 84942e042e815..68c8cee776433 100644 --- a/core/creator/src/main/java/io/quarkus/creator/phase/curate/UpdateDiscovery.java +++ b/core/creator/src/main/java/io/quarkus/creator/phase/curate/UpdateDiscovery.java @@ -19,7 +19,7 @@ import java.util.List; -import io.quarkus.creator.AppArtifact; +import io.quarkus.bootstrap.model.AppArtifact; import io.quarkus.creator.AppCreatorException; /** diff --git a/core/creator/src/main/java/io/quarkus/creator/phase/nativeimage/NativeImagePhase.java b/core/creator/src/main/java/io/quarkus/creator/phase/nativeimage/NativeImagePhase.java index a31cfde44452c..a5e3c5ef4b5cb 100644 --- a/core/creator/src/main/java/io/quarkus/creator/phase/nativeimage/NativeImagePhase.java +++ b/core/creator/src/main/java/io/quarkus/creator/phase/nativeimage/NativeImagePhase.java @@ -38,6 +38,7 @@ import org.eclipse.microprofile.config.Config; import org.jboss.logging.Logger; +import io.quarkus.bootstrap.util.IoUtils; import io.quarkus.creator.AppCreationPhase; import io.quarkus.creator.AppCreator; import io.quarkus.creator.AppCreatorException; @@ -46,7 +47,6 @@ import io.quarkus.creator.outcome.OutcomeProviderRegistration; import io.quarkus.creator.phase.augment.AugmentOutcome; import io.quarkus.creator.phase.runnerjar.RunnerJarOutcome; -import io.quarkus.creator.util.IoUtils; import io.smallrye.config.SmallRyeConfigProviderResolver; /** diff --git a/core/creator/src/main/java/io/quarkus/creator/phase/runnerjar/RunnerJarPhase.java b/core/creator/src/main/java/io/quarkus/creator/phase/runnerjar/RunnerJarPhase.java index 4c7022388fc6f..b22f85c50213b 100644 --- a/core/creator/src/main/java/io/quarkus/creator/phase/runnerjar/RunnerJarPhase.java +++ b/core/creator/src/main/java/io/quarkus/creator/phase/runnerjar/RunnerJarPhase.java @@ -31,7 +31,6 @@ import java.nio.file.SimpleFileVisitor; import java.nio.file.StandardCopyOption; import java.nio.file.attribute.BasicFileAttributes; -import java.nio.file.attribute.PosixFilePermissions; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -47,19 +46,19 @@ import org.jboss.logging.Logger; -import io.quarkus.creator.AppArtifact; -import io.quarkus.creator.AppArtifactResolver; +import io.quarkus.bootstrap.model.AppArtifact; +import io.quarkus.bootstrap.model.AppDependency; +import io.quarkus.bootstrap.resolver.AppModelResolver; +import io.quarkus.bootstrap.util.IoUtils; +import io.quarkus.bootstrap.util.ZipUtils; import io.quarkus.creator.AppCreationPhase; import io.quarkus.creator.AppCreator; import io.quarkus.creator.AppCreatorException; -import io.quarkus.creator.AppDependency; import io.quarkus.creator.config.reader.MappedPropertiesHandler; import io.quarkus.creator.config.reader.PropertiesHandler; import io.quarkus.creator.outcome.OutcomeProviderRegistration; import io.quarkus.creator.phase.augment.AugmentOutcome; import io.quarkus.creator.phase.curate.CurateOutcome; -import io.quarkus.creator.util.IoUtils; -import io.quarkus.creator.util.ZipUtils; /** * Based on the provided {@link io.quarkus.creator.phase.augment.AugmentOutcome}, @@ -70,7 +69,6 @@ public class RunnerJarPhase implements AppCreationPhase, RunnerJarOutcome { private static final String DEFAULT_MAIN_CLASS = "io.quarkus.runner.GeneratedMain"; - private static final String PROVIDED = "provided"; private static final Logger log = Logger.getLogger(RunnerJarPhase.class); @@ -82,13 +80,14 @@ public class RunnerJarPhase implements AppCreationPhase, RunnerJ "META-INF/NOTICE", "META-INF/LICENSE.txt", "META-INF/NOTICE.txt", - "dependencies.runtime", "META-INF/README", "META-INF/quarkus-config-roots.list", "META-INF/DEPENDENCIES", "META-INF/beans.xml", "META-INF/quarkus-javadoc.properties", - "LICENSE"))); + "LICENSE", + "quarqus/quarkus-extension.properties", + "quarqus/quarkus-deployment-dependency.graph"))); private Path outputDir; private Path libDir; @@ -184,7 +183,7 @@ public void provideOutcome(AppCreator ctx) throws AppCreatorException { libDir = IoUtils.mkdirs(libDir == null ? outputDir.resolve("lib") : libDir); if (finalName == null) { - final String name = appState.getArtifactResolver().resolve(appState.getAppArtifact()).getFileName().toString(); + final String name = appState.getAppArtifact().getPath().getFileName().toString(); int i = name.lastIndexOf('.'); if (i > 0) { finalName = name.substring(0, i); @@ -220,24 +219,22 @@ public void provideOutcome(AppCreator ctx) throws AppCreatorException { ctx.pushOutcome(RunnerJarOutcome.class, this); } - private void buildRunner(FileSystem runnerZipFs, CurateOutcome appState, AugmentOutcome augmentOutcome) throws Exception { + private void buildRunner(FileSystem runnerZipFs, CurateOutcome curateOutcome, AugmentOutcome augmentOutcome) + throws Exception { log.info("Building jar: " + runnerJar); - final AppArtifactResolver depResolver = appState.getArtifactResolver(); - final List appDeps = appState.getEffectiveDeps(); + final AppModelResolver depResolver = curateOutcome.getArtifactResolver(); final Map seen = new HashMap<>(); final Map> duplicateCatcher = new HashMap<>(); final StringBuilder classPath = new StringBuilder(); final Map> services = new HashMap<>(); + final List appDeps = curateOutcome.getEffectiveModel().getUserDependencies(); for (AppDependency appDep : appDeps) { - if (appDep.getScope().equals(PROVIDED) && !augmentOutcome.isWhitelisted(appDep)) { - continue; - } final AppArtifact depArtifact = appDep.getArtifact(); if (depArtifact.getArtifactId().equals("svm") && depArtifact.getGroupId().equals("com.oracle.substratevm")) { - continue; + throw new IllegalStateException("Dependency on com.oracle.substratevm:svm"); } final Path resolvedDep = depResolver.resolve(depArtifact); if (uberJar) { diff --git a/core/creator/src/main/java/io/quarkus/creator/resolver/aether/AetherArtifactResolver.java b/core/creator/src/main/java/io/quarkus/creator/resolver/aether/AetherArtifactResolver.java deleted file mode 100644 index dccd262f6fbc7..0000000000000 --- a/core/creator/src/main/java/io/quarkus/creator/resolver/aether/AetherArtifactResolver.java +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Copyright 2018 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.quarkus.creator.resolver.aether; - -import java.io.File; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.maven.settings.Settings; -import org.eclipse.aether.DefaultRepositorySystemSession; -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.artifact.DefaultArtifact; -import org.eclipse.aether.collection.CollectRequest; -import org.eclipse.aether.graph.Dependency; -import org.eclipse.aether.graph.DependencyNode; -import org.eclipse.aether.installation.InstallRequest; -import org.eclipse.aether.installation.InstallationException; -import org.eclipse.aether.repository.LocalRepository; -import org.eclipse.aether.repository.RemoteRepository; -import org.eclipse.aether.resolution.ArtifactDescriptorException; -import org.eclipse.aether.resolution.ArtifactDescriptorRequest; -import org.eclipse.aether.resolution.ArtifactDescriptorResult; -import org.eclipse.aether.resolution.ArtifactRequest; -import org.eclipse.aether.resolution.ArtifactResolutionException; -import org.eclipse.aether.resolution.ArtifactResult; -import org.eclipse.aether.resolution.DependencyRequest; -import org.eclipse.aether.resolution.DependencyResolutionException; -import org.eclipse.aether.resolution.DependencyResult; -import org.eclipse.aether.resolution.VersionRangeRequest; -import org.eclipse.aether.resolution.VersionRangeResolutionException; -import org.eclipse.aether.resolution.VersionRangeResult; -import org.eclipse.aether.version.Version; - -import io.quarkus.creator.AppArtifact; -import io.quarkus.creator.AppArtifactResolverBase; -import io.quarkus.creator.AppCreatorException; -import io.quarkus.creator.AppDependency; - -/** - * - * @author Alexey Loubyansky - */ -public class AetherArtifactResolver extends AppArtifactResolverBase { - - public static AetherArtifactResolver getInstance(Path repoHome) throws AppCreatorException { - final RepositorySystem repoSystem = MavenRepoInitializer.getRepositorySystem(); - final Settings settings = MavenRepoInitializer.getSettings(); - final DefaultRepositorySystemSession repoSession = MavenRepoInitializer.newSession(repoSystem, settings); - final AppCreatorLocalRepositoryManager appCreatorLocalRepoManager = new AppCreatorLocalRepositoryManager( - repoSystem.newLocalRepositoryManager(repoSession, - new LocalRepository(repoHome.toString())), - Paths.get(MavenRepoInitializer.getLocalRepo(settings))); - repoSession.setLocalRepositoryManager(appCreatorLocalRepoManager); - repoSession.setDependencySelector(new AppCreatorDependencySelector(true)); - final AetherArtifactResolver resolver = new AetherArtifactResolver(repoSystem, repoSession, - MavenRepoInitializer.getRemoteRepos(settings)); - resolver.setLocalRepositoryManager(appCreatorLocalRepoManager); - return resolver; - } - - public static AetherArtifactResolver getInstance(Path repoHome, List remoteRepos) - throws AppCreatorException { - final RepositorySystem repoSystem = MavenRepoInitializer.getRepositorySystem(); - final Settings settings = MavenRepoInitializer.getSettings(); - final DefaultRepositorySystemSession repoSession = MavenRepoInitializer.newSession(repoSystem, settings); - final AppCreatorLocalRepositoryManager appCreatorLocalRepoManager = new AppCreatorLocalRepositoryManager( - repoSystem.newLocalRepositoryManager(repoSession, - new LocalRepository(repoHome.toString())), - Paths.get(MavenRepoInitializer.getLocalRepo(settings))); - repoSession.setLocalRepositoryManager(appCreatorLocalRepoManager); - repoSession.setDependencySelector(new AppCreatorDependencySelector(true)); - final AetherArtifactResolver resolver = new AetherArtifactResolver(repoSystem, repoSession, remoteRepos); - resolver.setLocalRepositoryManager(appCreatorLocalRepoManager); - return resolver; - } - - protected final RepositorySystem repoSystem; - protected final RepositorySystemSession repoSession; - protected final List remoteRepos; - protected AppCreatorLocalRepositoryManager localRepoManager; - - public AetherArtifactResolver() throws AppCreatorException { - this(MavenRepoInitializer.getRepositorySystem(), - MavenRepoInitializer.newSession(MavenRepoInitializer.getRepositorySystem()), - MavenRepoInitializer.getRemoteRepos()); - } - - public AetherArtifactResolver(RepositorySystem repoSystem, RepositorySystemSession repoSession, - List remoteRepos) { - super(); - this.repoSystem = repoSystem; - this.repoSession = repoSession; - this.remoteRepos = remoteRepos; - } - - public void setLocalRepositoryManager(AppCreatorLocalRepositoryManager localRepoManager) { - this.localRepoManager = localRepoManager; - } - - public void addRemoteRepositories(List repos) { - remoteRepos.addAll(repos); - } - - @Override - public void relink(AppArtifact artifact, Path path) throws AppCreatorException { - if (localRepoManager == null) { - throw new AppCreatorException("Failed to (re-)link " + artifact + " to " + path - + ": AppCreatorLocalRepositoryManager has not been initialized"); - } - localRepoManager.relink(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), artifact.getType(), - artifact.getVersion(), path); - setPath(artifact, path); - } - - @Override - protected void doResolve(AppArtifact artifact) throws AppCreatorException { - final ArtifactRequest artifactRequest = new ArtifactRequest(); - artifactRequest.setArtifact(toAetherArtifact(artifact)); - artifactRequest.setRepositories(remoteRepos); - ArtifactResult artifactResult; - try { - artifactResult = repoSystem.resolveArtifact(repoSession, artifactRequest); - } catch (ArtifactResolutionException e) { - throw new AppCreatorException("Failed to resolve artifact " + artifact, e); - } - setPath(artifact, artifactResult.getArtifact().getFile().toPath()); - } - - @Override - public List collectDependencies(AppArtifact coords) throws AppCreatorException { - final CollectRequest collectRequest = new CollectRequest(); - collectRequest.setRoot(new Dependency(toAetherArtifact(coords), "runtime")); - //collectRequest.setRootArtifact(toAetherArtifact(coords)); - collectRequest.setRepositories(remoteRepos); - - final DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, null); - - final DependencyResult depResult; - try { - depResult = repoSystem.resolveDependencies(repoSession, dependencyRequest); - } catch (DependencyResolutionException e) { - throw new AppCreatorException("Failed to collect dependencies for " + coords, e); - } - - final List depNodes = depResult.getRoot().getChildren(); - if (depNodes.isEmpty()) { - return Collections.emptyList(); - } - - final List appDeps = new ArrayList<>(); - collect(depNodes, appDeps); - return appDeps; - } - - @Override - public List collectDependencies(AppArtifact root, List coords) throws AppCreatorException { - final CollectRequest collectRequest = new CollectRequest(); - collectRequest.setRoot(new Dependency(toAetherArtifact(root), "runtime")); - for (AppDependency dep : coords) { - collectRequest.addDependency(new Dependency(toAetherArtifact(dep.getArtifact()), dep.getScope())); - } - collectRequest.setRepositories(remoteRepos); - - final DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, null); - - final DependencyResult depResult; - try { - depResult = repoSystem.resolveDependencies(repoSession, dependencyRequest); - } catch (DependencyResolutionException e) { - throw new AppCreatorException("Failed to collect dependencies for " + coords, e); - } - - final List depNodes = depResult.getRoot().getChildren(); - if (depNodes.isEmpty()) { - return Collections.emptyList(); - } - - final List appDeps = new ArrayList<>(); - collect(depNodes, appDeps); - return appDeps; - } - - /* - * @Override - * public List collectDependencies(AppArtifact coords) throws AppCreatorException { - * final CollectRequest collectRequest = new CollectRequest(); - * collectRequest.setRoot(new Dependency(toAetherArtifact(coords), "runtime")); - * //collectRequest.setRootArtifact(toAetherArtifact(coords)); - * collectRequest.setRepositories(remoteRepos); - * - * final CollectResult depResult; - * try { - * depResult = repoSystem.collectDependencies(repoSession, collectRequest); - * } catch (DependencyCollectionException e) { - * throw new AppCreatorException("Failed to collect dependencies for " + coords, e); - * } - * - * final List depNodes = depResult.getRoot().getChildren(); - * if(depNodes.isEmpty()) { - * return Collections.emptyList(); - * } - * - * final List appDeps = new ArrayList<>(); - * collect(depNodes, appDeps); - * return appDeps; - * } - */ - @Override - public List listLaterVersions(AppArtifact appArtifact, String upToVersion, boolean inclusive) - throws AppCreatorException { - final VersionRangeResult rangeResult = resolveVersionRangeResult(appArtifact, upToVersion, inclusive); - final List resolvedVersions = rangeResult.getVersions(); - final List versions = new ArrayList<>(resolvedVersions.size()); - for (Version v : resolvedVersions) { - versions.add(v.toString()); - } - return versions; - } - - @Override - public String getNextVersion(AppArtifact appArtifact, String upToVersion, boolean inclusive) throws AppCreatorException { - final VersionRangeResult rangeResult = resolveVersionRangeResult(appArtifact, upToVersion, inclusive); - final List versions = rangeResult.getVersions(); - if (versions.isEmpty()) { - return appArtifact.getVersion(); - } - Version next = versions.get(0); - for (int i = 1; i < versions.size(); ++i) { - final Version candidate = versions.get(i); - if (next.compareTo(candidate) > 0) { - next = candidate; - } - } - return next.toString(); - } - - @Override - public String getLatestVersion(AppArtifact appArtifact, String upToVersion, boolean inclusive) throws AppCreatorException { - final VersionRangeResult rangeResult = resolveVersionRangeResult(appArtifact, upToVersion, inclusive); - final List versions = rangeResult.getVersions(); - if (versions.isEmpty()) { - return appArtifact.getVersion(); - } - Version latest = versions.get(0); - for (int i = 1; i < versions.size(); ++i) { - final Version candidate = versions.get(i); - if (latest.compareTo(candidate) < 0) { - latest = candidate; - } - } - return latest.toString(); - } - - public List resolveArtifactRepos(AppArtifact appArtifact) throws AppCreatorException { - final ArtifactDescriptorRequest request = new ArtifactDescriptorRequest(); - request.setArtifact(new DefaultArtifact(appArtifact.getGroupId(), appArtifact.getArtifactId(), - appArtifact.getClassifier(), appArtifact.getType(), appArtifact.getVersion())); - //request.setRepositories(remoteRepos); - final ArtifactDescriptorResult result; - try { - result = repoSystem.readArtifactDescriptor(repoSession, request); - } catch (ArtifactDescriptorException e) { - throw new AppCreatorException("Failed to resolve descriptor for " + appArtifact, e); - } - return result.getRepositories(); - } - - private VersionRangeResult resolveVersionRangeResult(AppArtifact appArtifact, String upToVersion, boolean inclusive) - throws AppCreatorException { - final Artifact artifact = new DefaultArtifact(appArtifact.getGroupId(), - appArtifact.getArtifactId(), appArtifact.getType(), - '(' + appArtifact.getVersion() + ',' + (upToVersion == null ? ')' : upToVersion + (inclusive ? ']' : ')'))); - //System.out.println("AetherArtifactResolver.listLaterVersions for range " + artifact.getVersion()); - final VersionRangeResult rangeResult = getVersionRange(artifact); - return rangeResult; - } - - public void install(AppArtifact appArtifact, Path localPath) throws AppCreatorException { - final InstallRequest request = new InstallRequest(); - request.addArtifact( - new DefaultArtifact(appArtifact.getGroupId(), appArtifact.getArtifactId(), appArtifact.getClassifier(), - appArtifact.getType(), appArtifact.getVersion(), Collections.emptyMap(), localPath.toFile())); - try { - repoSystem.install(repoSession, request); - } catch (InstallationException ex) { - throw new AppCreatorException("Failed to install " + appArtifact, ex); - } - } - - private VersionRangeResult getVersionRange(Artifact artifact) throws AppCreatorException { - final VersionRangeRequest rangeRequest = new VersionRangeRequest(); - rangeRequest.setArtifact(artifact); - rangeRequest.setRepositories(remoteRepos); - VersionRangeResult rangeResult; - try { - rangeResult = repoSystem.resolveVersionRange(repoSession, rangeRequest); - } catch (VersionRangeResolutionException ex) { - throw new AppCreatorException("Failed to resolve version range for " + artifact, ex); - } - return rangeResult; - } - - private static void collect(List nodes, List appDeps) { - for (DependencyNode node : nodes) { - collect(node.getChildren(), appDeps); - appDeps.add(new AppDependency(toAppArtifact(node.getArtifact()), node.getDependency().getScope())); - } - } - - private static Artifact toAetherArtifact(AppArtifact artifact) { - return new DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), - artifact.getType(), artifact.getVersion()); - } - - private static AppArtifact toAppArtifact(Artifact artifact) { - final AppArtifact mvn = new AppArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), - artifact.getExtension(), artifact.getVersion()); - final File file = artifact.getFile(); - if (file != null) { - setPath(mvn, file.toPath()); - } - return mvn; - } -} diff --git a/core/creator/src/main/java/io/quarkus/creator/resolver/aether/AppCreatorDependencySelector.java b/core/creator/src/main/java/io/quarkus/creator/resolver/aether/AppCreatorDependencySelector.java deleted file mode 100644 index b4c5ef84ac202..0000000000000 --- a/core/creator/src/main/java/io/quarkus/creator/resolver/aether/AppCreatorDependencySelector.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * - */ -package io.quarkus.creator.resolver.aether; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.aether.collection.DependencyCollectionContext; -import org.eclipse.aether.collection.DependencySelector; -import org.eclipse.aether.graph.Dependency; - -/** - * - * @author Alexey Loubyansky - */ -public class AppCreatorDependencySelector implements DependencySelector { - - static final String COMPILE = "compile"; - static final String PROVIDED = "provided"; - static final String RUNTIME = "runtime"; - static final String SYSTEM = "system"; - static final String WILDCARD = "*"; - - static final Set APP_SCOPES = new HashSet<>(Arrays.asList(new String[] { COMPILE, SYSTEM, PROVIDED, RUNTIME })); - static final Set TRANSITIVE_SCOPES = new HashSet<>(Arrays.asList(new String[] { COMPILE, SYSTEM, RUNTIME })); - - protected final boolean debug; - - public AppCreatorDependencySelector(boolean debug) { - this.debug = debug; - } - - @Override - public boolean selectDependency(Dependency dependency) { - throw new UnsupportedOperationException(); - } - - @Override - public DependencySelector deriveChildSelector(DependencyCollectionContext context) { - final Dependency dependency = context.getDependency(); - if (dependency != null && (dependency.isOptional() || !APP_SCOPES.contains(dependency.getScope()))) { - return DisabledDependencySelector.INSTANCE; - } - return new DerivedDependencySelector(debug, dependency); - } -} diff --git a/core/creator/src/main/java/io/quarkus/creator/resolver/aether/DerivedDependencySelector.java b/core/creator/src/main/java/io/quarkus/creator/resolver/aether/DerivedDependencySelector.java deleted file mode 100644 index 8fc48217e9419..0000000000000 --- a/core/creator/src/main/java/io/quarkus/creator/resolver/aether/DerivedDependencySelector.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright 2018 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.quarkus.creator.resolver.aether; - -import java.util.Collection; -import java.util.Set; - -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.collection.DependencyCollectionContext; -import org.eclipse.aether.collection.DependencySelector; -import org.eclipse.aether.graph.Dependency; -import org.eclipse.aether.graph.Exclusion; -import org.jboss.logging.Logger; - -/** - * - * @author Alexey Loubyansky - */ -public class DerivedDependencySelector implements DependencySelector { - - private static final Logger log = Logger.getLogger(DerivedDependencySelector.class); - - private static class DepExclusions { - - private final Collection exclusions; - private final DepExclusions parent; - - DepExclusions(DepExclusions parent, Collection exclusions) { - this.parent = parent; - this.exclusions = exclusions; - } - - boolean isExcluded(Dependency dep) { - for (Exclusion excl : exclusions) { - final String exclGroupId = excl.getGroupId(); - final String exclArtifactId = excl.getArtifactId(); - final String exclClassifier = excl.getClassifier(); - final String exclExt = excl.getExtension(); - final Artifact artifact = dep.getArtifact(); - if ((exclGroupId.equals(AppCreatorDependencySelector.WILDCARD) || exclGroupId.equals(artifact.getGroupId())) && - (exclArtifactId.equals(AppCreatorDependencySelector.WILDCARD) - || exclArtifactId.equals(artifact.getArtifactId())) - && - (exclClassifier.equals(AppCreatorDependencySelector.WILDCARD) - || exclClassifier.equals(artifact.getClassifier())) - && - (exclExt.equals(AppCreatorDependencySelector.WILDCARD) || exclExt.equals(artifact.getExtension()))) { - return true; - } - } - if (parent != null) { - DepExclusions parent = this.parent; - while (parent != null) { - if (parent.isExcluded(dep)) { - return true; - } - parent = parent.parent; - } - } - return false; - } - } - - private final int depth; - //private final Set selected; - //private final Set childrenProcessed; - private final Set acceptedScopes; - //private Dependency lastSelected; - private final DepExclusions depExclusions; - //private Map> managedExcl; - - public DerivedDependencySelector(boolean debug) { - this.depth = debug && log.isDebugEnabled() ? 0 : -1; - //this.selected = new HashSet<>(); - //this.childrenProcessed = new HashSet<>(); - this.acceptedScopes = AppCreatorDependencySelector.APP_SCOPES; - this.depExclusions = null; - } - - DerivedDependencySelector(boolean debug, Dependency dependency) { - this.depth = debug && log.isDebugEnabled() ? 0 : -1; - //this.selected = new HashSet<>(); - //this.childrenProcessed = new HashSet<>(); - if (dependency == null) { - depExclusions = null; - } else { - //childrenProcessed.add(dependency.getArtifact().toString()); - this.depExclusions = dependency.getExclusions().isEmpty() ? null - : new DepExclusions(null, dependency.getExclusions()); - } - this.acceptedScopes = AppCreatorDependencySelector.APP_SCOPES; - } - - private DerivedDependencySelector(DerivedDependencySelector parent, Set acceptedScopes, - DepExclusions depExclusions) { - this.depth = parent.depth < 0 ? parent.depth : parent.depth + 1; - //this.selected = parent.selected; - //this.childrenProcessed = parent.childrenProcessed; - //this.managedExcl = parent.managedExcl; - this.acceptedScopes = acceptedScopes; - this.depExclusions = depExclusions; - } - - @Override - public boolean selectDependency(Dependency dependency) { - //System.out.println("selectDependency " + dependency); - - if (dependency.isOptional() - || !acceptedScopes.contains(dependency.getScope()) - || depExclusions != null && depExclusions.isExcluded(dependency)) { - //System.out.println("Filtered out " + dependency); - return false; - } - - if (depth >= 0) { - final StringBuilder buf = new StringBuilder(); - for (int i = 0; i < depth; ++i) { - buf.append(" "); - } - String offset = buf.toString(); - log.debug(offset + dependency); - //System.out.println(offset + dependency); - if (!dependency.getExclusions().isEmpty()) { - log.debug(offset + " Excludes:"); - //System.out.println(offset + " Excludes:"); - buf.append(" - "); - offset = buf.toString(); - for (Exclusion excl : dependency.getExclusions()) { - log.debug(offset + excl.getGroupId() + ":" + excl.getArtifactId() + ":" + excl.getClassifier() + ":" - + excl.getExtension()); - //System.out.println(offset + excl.getGroupId() + ":" + excl.getArtifactId() + ":" + excl.getClassifier() + ":" + excl.getExtension()); - } - } - } - //lastSelected = dependency; - return true; - } - - @Override - public DependencySelector deriveChildSelector(DependencyCollectionContext context) { - //System.out.println("derivedChildSelector " + context.getDependency()); - /* - * doesn't seem to be relevant to look into the managed deps at the root - * if(managedExcl == null && depth <= 0) { - * final List managedDeps = context.getManagedDependencies(); - * if(managedDeps.isEmpty()) { - * managedExcl = Collections.emptyMap(); - * } else { - * System.out.println("Managed dependencies"); - * managedExcl = new HashMap<>(managedDeps.size()); - * for(Dependency dep : managedDeps) { - * final Collection exclusions = dep.getExclusions(); - * if(!exclusions.isEmpty()) { - * managedExcl.put(getKey(dep.getArtifact()), exclusions); - * if(depth == 0) { - * System.out.println(" " + dep); - * System.out.println(" Excludes:"); - * for (Exclusion excl : exclusions) { - * System.out.println(" - " + excl.getGroupId() + ":" + excl.getArtifactId() + ":" - * + excl.getClassifier() + ":" + excl.getExtension()); - * } - * } - * } - * } - * } - * } - */ - final Dependency dependency = context.getDependency(); - /* - * this condition actually leads to a trouble - * while the version might not match, the dependencies will still be of the version selected at the end - * skipping it here will result in the dependency graph transformer removing the dependencies of this artifact from the - * tree - * if(lastSelected != null && !lastSelected.getArtifact().getVersion().equals(dependency.getArtifact().getVersion())) { - * return DisabledDependencySelector.INSTANCE; - * } - */ - - /* - * if (dependency.isOptional() - * / *|| !acceptedScopes.contains(dependency.getScope())* / - * || !childrenProcessed.add(dependency.getArtifact().toString())) { - * //System.out.println("Filtering out children of " + dependency); - * return DisabledDependencySelector.INSTANCE; - * } - */ - - if (acceptedScopes.size() != AppCreatorDependencySelector.TRANSITIVE_SCOPES.size()) { - return new DerivedDependencySelector(this, AppCreatorDependencySelector.TRANSITIVE_SCOPES, - dependency.getExclusions().isEmpty() ? depExclusions - : new DepExclusions(depExclusions, dependency.getExclusions())); - } - return depth < 0 && dependency.getExclusions().isEmpty() ? this - : new DerivedDependencySelector(this, acceptedScopes, - dependency.getExclusions().isEmpty() ? depExclusions - : new DepExclusions(depExclusions, dependency.getExclusions())); - } - /* - * private static String getKey(Artifact artifact) { - * StringBuilder sb = new StringBuilder(128); - * sb.append(artifact.getGroupId()); - * sb.append(':'); - * sb.append(artifact.getArtifactId()); - * sb.append(':'); - * sb.append(artifact.getExtension()); - * if (!artifact.getClassifier().isEmpty()) { - * sb.append(':'); - * sb.append(artifact.getClassifier()); - * } - * return sb.toString(); - * } - */ -} \ No newline at end of file diff --git a/core/creator/src/main/java/io/quarkus/creator/resolver/aether/MavenRepoInitializer.java b/core/creator/src/main/java/io/quarkus/creator/resolver/aether/MavenRepoInitializer.java deleted file mode 100644 index bb0bdda61b958..0000000000000 --- a/core/creator/src/main/java/io/quarkus/creator/resolver/aether/MavenRepoInitializer.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright 2018 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.quarkus.creator.resolver.aether; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.apache.maven.repository.internal.MavenRepositorySystemUtils; -import org.apache.maven.settings.Profile; -import org.apache.maven.settings.Repository; -import org.apache.maven.settings.Settings; -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.SettingsBuildingRequest; -import org.apache.maven.settings.building.SettingsBuildingResult; -import org.apache.maven.settings.building.SettingsProblem; -import org.eclipse.aether.DefaultRepositorySystemSession; -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory; -import org.eclipse.aether.impl.DefaultServiceLocator; -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.file.FileTransporterFactory; -import org.eclipse.aether.transport.http.HttpTransporterFactory; -import org.eclipse.aether.util.repository.AuthenticationBuilder; -import org.eclipse.aether.util.repository.DefaultProxySelector; -import org.jboss.logging.Logger; - -import io.quarkus.creator.AppCreatorException; -import io.quarkus.creator.util.PropertyUtils; - -/** - * - * @author Alexey Loubyansky - */ -public class MavenRepoInitializer { - - private static final String DOT_M2 = ".m2"; - private static final String MAVEN_HOME = "maven.home"; - private static final String M2_HOME = "M2_HOME"; - private static final String SETTINGS_XML = "settings.xml"; - - public static final String userHome = PropertyUtils.getUserHome(); - public static final File userMavenConfigurationHome = new File(userHome, DOT_M2); - public static final String envM2Home = System.getenv(M2_HOME); - public static final File DEFAULT_USER_SETTINGS_FILE = new File(userMavenConfigurationHome, SETTINGS_XML); - public static final File DEFAULT_GLOBAL_SETTINGS_FILE = new File( - PropertyUtils.getProperty(MAVEN_HOME, envM2Home != null ? envM2Home : ""), "conf/settings.xml"); - - private static RepositorySystem repoSystem; - private static List remoteRepos; - private static Settings settings; - - private static final Logger log = Logger.getLogger(MavenRepoInitializer.class); - - public static RepositorySystem getRepositorySystem() { - if (repoSystem != null) { - return repoSystem; - } - - final DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator(); - locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class); - locator.addService(TransporterFactory.class, FileTransporterFactory.class); - locator.addService(TransporterFactory.class, HttpTransporterFactory.class); - - locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() { - @Override - public void serviceCreationFailed(Class type, Class impl, Throwable exception) { - System.err.println("Service creation failed"); - exception.printStackTrace(); - } - }); - - return repoSystem = locator.getService(RepositorySystem.class); - } - - public static DefaultRepositorySystemSession newSession(RepositorySystem system) throws AppCreatorException { - return newSession(system, getSettings()); - } - - public static DefaultRepositorySystemSession newSession(RepositorySystem system, Settings settings) { - final DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession(); - - final org.apache.maven.settings.Proxy proxy = settings.getActiveProxy(); - if (proxy != null) { - Authentication auth = null; - if (proxy.getUsername() != null) { - auth = new AuthenticationBuilder() - .addUsername(proxy.getUsername()) - .addPassword(proxy.getPassword()) - .build(); - } - final Proxy aetherProxy = new Proxy(proxy.getProtocol(), proxy.getHost(), proxy.getPort(), auth); - DefaultProxySelector proxySelector = new DefaultProxySelector(); - proxySelector.add(aetherProxy, proxy.getNonProxyHosts()); - session.setProxySelector(proxySelector); - } - - final String localRepoPath = getLocalRepo(settings); - session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, new LocalRepository(localRepoPath))); - - session.setOffline(settings.isOffline()); - - // uncomment to generate dirty trees - //session.setDependencyGraphTransformer( null ); - - return session; - } - - public static List getRemoteRepos() throws AppCreatorException { - if (remoteRepos != null) { - return remoteRepos; - } - remoteRepos = Collections.unmodifiableList(getRemoteRepos(getSettings())); - return remoteRepos; - } - - public static List getRemoteRepos(Settings settings) throws AppCreatorException { - - final Map profilesMap = settings.getProfilesAsMap(); - final List remotes = new ArrayList<>(); - - for (String profileName : settings.getActiveProfiles()) { - final Profile profile = profilesMap.get(profileName); - final List repositories = profile.getRepositories(); - for (Repository repo : repositories) { - final RemoteRepository.Builder repoBuilder = new RemoteRepository.Builder(repo.getId(), repo.getLayout(), - repo.getUrl()); - org.apache.maven.settings.RepositoryPolicy policy = repo.getReleases(); - if (policy != null) { - repoBuilder.setReleasePolicy( - new RepositoryPolicy(policy.isEnabled(), policy.getUpdatePolicy(), policy.getChecksumPolicy())); - } - policy = repo.getSnapshots(); - if (policy != null) { - repoBuilder.setSnapshotPolicy( - new RepositoryPolicy(policy.isEnabled(), policy.getUpdatePolicy(), policy.getChecksumPolicy())); - } - remotes.add(repoBuilder.build()); - } - } - return remotes; - } - - public static Settings getSettings() throws AppCreatorException { - if (settings != null) { - return settings; - } - final SettingsBuildingRequest settingsBuildingRequest = new DefaultSettingsBuildingRequest(); - settingsBuildingRequest.setSystemProperties(System.getProperties()); - settingsBuildingRequest.setUserSettingsFile(DEFAULT_USER_SETTINGS_FILE); - settingsBuildingRequest.setGlobalSettingsFile(DEFAULT_GLOBAL_SETTINGS_FILE); - - final Settings effectiveSettings; - try { - final SettingsBuildingResult result = new DefaultSettingsBuilderFactory().newInstance() - .build(settingsBuildingRequest); - final List problems = result.getProblems(); - if (!problems.isEmpty()) { - for (SettingsProblem problem : problems) { - switch (problem.getSeverity()) { - case ERROR: - case FATAL: - throw new AppCreatorException("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 AppCreatorException("Failed to initialize Maven repository settings", e); - } - - settings = effectiveSettings; - return effectiveSettings; - } - - public static String getLocalRepo(Settings settings) { - final String localRepo = settings.getLocalRepository(); - return localRepo == null ? getDefaultLocalRepo() : localRepo; - } - - private static String getDefaultLocalRepo() { - return new File(userMavenConfigurationHome, "repository").getAbsolutePath(); - } -} diff --git a/core/creator/src/main/java/io/quarkus/creator/resolver/maven/ResolvedMavenArtifactDeps.java b/core/creator/src/main/java/io/quarkus/creator/resolver/maven/ResolvedMavenArtifactDeps.java deleted file mode 100644 index 88747ffb3da27..0000000000000 --- a/core/creator/src/main/java/io/quarkus/creator/resolver/maven/ResolvedMavenArtifactDeps.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2018 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.quarkus.creator.resolver.maven; - -import java.io.File; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.apache.maven.artifact.Artifact; - -import io.quarkus.creator.AppArtifact; -import io.quarkus.creator.AppArtifactResolverBase; -import io.quarkus.creator.AppCreatorException; -import io.quarkus.creator.AppDependency; - -/** - * - * @author Alexey Loubyansky - */ -public class ResolvedMavenArtifactDeps extends AppArtifactResolverBase { - - private final String groupId; - private final String artifactId; - private final String classifier; - private final String type; - private final String version; - private final List deps; - - public ResolvedMavenArtifactDeps(String groupId, String artifactId, String version, Collection artifacts) { - this(groupId, artifactId, "", version, artifacts); - } - - public ResolvedMavenArtifactDeps(String groupId, String artifactId, String classifier, String version, - Collection artifacts) { - this(groupId, artifactId, "", "jar", version, artifacts); - } - - public ResolvedMavenArtifactDeps(String groupId, String artifactId, String classifier, String type, String version, - Collection artifacts) { - this.groupId = groupId; - this.artifactId = artifactId; - this.classifier = classifier; - this.type = type; - this.version = version; - final List tmp = new ArrayList<>(artifacts.size()); - for (Artifact artifact : artifacts) { - tmp.add(new AppDependency(toMvnArtifact(artifact), artifact.getScope())); - } - deps = Collections.unmodifiableList(tmp); - } - - @Override - public void relink(AppArtifact artifact, Path path) throws AppCreatorException { - throw new UnsupportedOperationException(); - } - - @Override - protected void doResolve(AppArtifact coords) throws AppCreatorException { - throw new UnsupportedOperationException(); - } - - @Override - public List collectDependencies(AppArtifact coords) throws AppCreatorException { - if (!coords.getGroupId().equals(groupId) || - !coords.getArtifactId().equals(artifactId) || - !coords.getClassifier().equals(classifier) || - !coords.getType().equals(type) || - !coords.getVersion().equals(version)) { - throw new AppCreatorException("The resolve can only resolve dependencies for " + groupId + ':' + artifactId + ':' - + classifier + ':' + type + ':' + version + ": " + coords); - } - return deps; - } - - @Override - public List collectDependencies(AppArtifact root, List deps) throws AppCreatorException { - throw new UnsupportedOperationException(); - } - - private static AppArtifact toMvnArtifact(Artifact artifact) { - final AppArtifact mvn = new AppArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), - artifact.getType(), artifact.getVersion()); - final File file = artifact.getFile(); - if (file != null) { - setPath(mvn, file.toPath()); - } - return mvn; - } - - @Override - public List listLaterVersions(AppArtifact artifact, String upToVersion, boolean inclusive) - throws AppCreatorException { - throw new UnsupportedOperationException(); - } - - @Override - public String getNextVersion(AppArtifact artifact, String upToVersion, boolean inclusive) throws AppCreatorException { - throw new UnsupportedOperationException(); - } - - @Override - public String getLatestVersion(AppArtifact artifact, String upToVersion, boolean inclusive) throws AppCreatorException { - throw new UnsupportedOperationException(); - } -} diff --git a/core/creator/src/main/java/io/quarkus/creator/util/PropertyUtils.java b/core/creator/src/main/java/io/quarkus/creator/util/PropertyUtils.java deleted file mode 100644 index d146d274c1c2c..0000000000000 --- a/core/creator/src/main/java/io/quarkus/creator/util/PropertyUtils.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2018 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.quarkus.creator.util; - -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.Locale; - -/** - * - * @author Alexey Loubyansky - */ -public class PropertyUtils { - - private static final String OS_NAME = "os.name"; - private static final String USER_HOME = "user.home"; - private static final String WINDOWS = "windows"; - - private PropertyUtils() { - } - - public static boolean isWindows() { - return getProperty(OS_NAME).toLowerCase(Locale.ENGLISH).indexOf(WINDOWS) >= 0; - } - - public static String getUserHome() { - return getProperty(USER_HOME); - } - - public static String getProperty(final String name, String defValue) { - final String value = getProperty(name); - return value == null ? defValue : value; - } - - public static String getProperty(final String name) { - assert name != null : "name is null"; - final SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - return AccessController.doPrivileged(new PrivilegedAction() { - @Override - public String run() { - return System.getProperty(name); - } - }); - } else { - return System.getProperty(name); - } - } -} diff --git a/core/creator/src/test/java/io/quarkus/creator/config/test/PersonAddressTestBase.java b/core/creator/src/test/java/io/quarkus/creator/config/test/PersonAddressTestBase.java index 7d38e20fd440e..c709cbd54e365 100644 --- a/core/creator/src/test/java/io/quarkus/creator/config/test/PersonAddressTestBase.java +++ b/core/creator/src/test/java/io/quarkus/creator/config/test/PersonAddressTestBase.java @@ -28,10 +28,10 @@ import org.junit.Test; +import io.quarkus.bootstrap.util.IoUtils; import io.quarkus.creator.config.reader.PropertiesConfigReader; import io.quarkus.creator.config.reader.PropertiesHandler; import io.quarkus.creator.config.reader.PropertyLine; -import io.quarkus.creator.util.IoUtils; /** * diff --git a/core/deployment/pom.xml b/core/deployment/pom.xml index 9354d4be9321e..707a1071d1a53 100644 --- a/core/deployment/pom.xml +++ b/core/deployment/pom.xml @@ -27,7 +27,7 @@ ../ - quarkus-core + quarkus-core-deployment Quarkus - Core - Deployment @@ -65,9 +65,14 @@ org.ow2.asm asm + + io.quarkus.bootstrap + bootstrap-core + provided + io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus.gizmo diff --git a/core/devmode/pom.xml b/core/devmode/pom.xml index ef2345c3ea92c..49452486a4c6a 100644 --- a/core/devmode/pom.xml +++ b/core/devmode/pom.xml @@ -32,7 +32,7 @@ io.quarkus - quarkus-core + quarkus-core-deployment org.jboss.logmanager diff --git a/core/runtime/pom.xml b/core/runtime/pom.xml index 55df1d12f7908..fa102cffb3537 100644 --- a/core/runtime/pom.xml +++ b/core/runtime/pom.xml @@ -27,7 +27,7 @@ ../ - quarkus-core-runtime + quarkus-core Quarkus - Core - Runtime @@ -109,6 +109,10 @@ + + io.quarkus.bootstrap + bootstrap-maven-plugin + org.apache.maven.plugins maven-compiler-plugin @@ -131,9 +135,6 @@ - - maven-dependency-plugin - diff --git a/core/test-extension/deployment/pom.xml b/core/test-extension/deployment/pom.xml index 6e9055913d444..c9f2064acb8b7 100644 --- a/core/test-extension/deployment/pom.xml +++ b/core/test-extension/deployment/pom.xml @@ -25,7 +25,7 @@ 4.0.0 - quarkus-test-extension + quarkus-test-extension-deployment Quarkus - Core - Test Extension - Deployment @@ -35,19 +35,19 @@ io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-undertow-runtime + quarkus-undertow io.quarkus - quarkus-test-extension-runtime + quarkus-test-extension 999-SNAPSHOT diff --git a/core/test-extension/runtime/pom.xml b/core/test-extension/runtime/pom.xml index 441fae4a13c3e..a7802423a9180 100644 --- a/core/test-extension/runtime/pom.xml +++ b/core/test-extension/runtime/pom.xml @@ -25,13 +25,13 @@ 4.0.0 - quarkus-test-extension-runtime + quarkus-test-extension Quarkus - Core - Test Extension - Runtime io.quarkus - quarkus-arc-runtime + quarkus-arc com.oracle.substratevm @@ -51,14 +51,15 @@ io.quarkus - quarkus-core-runtime + quarkus-core - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/devtools/common/pom.xml b/devtools/common/pom.xml index 81bde12a3cd21..6b30fdb069c95 100644 --- a/devtools/common/pom.xml +++ b/devtools/common/pom.xml @@ -53,6 +53,12 @@ io.quarkus quarkus-devtools-common-core + org.apache.maven maven-plugin-api diff --git a/devtools/gradle-it/pom.xml b/devtools/gradle-it/pom.xml index ac8f0419efe22..fc16038c3fb8e 100644 --- a/devtools/gradle-it/pom.xml +++ b/devtools/gradle-it/pom.xml @@ -36,6 +36,12 @@ io.rest-assured rest-assured test + + + org.apache.commons + commons-lang3 + + diff --git a/devtools/gradle/pom.xml b/devtools/gradle/pom.xml index fb508d98b5110..4db44d83ca85e 100644 --- a/devtools/gradle/pom.xml +++ b/devtools/gradle/pom.xml @@ -21,6 +21,10 @@ + + io.quarkus.bootstrap + bootstrap-core + io.quarkus quarkus-devtools-common diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/AppModelGradleResolver.java b/devtools/gradle/src/main/java/io/quarkus/gradle/AppModelGradleResolver.java new file mode 100644 index 0000000000000..8f3e429e74ad6 --- /dev/null +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/AppModelGradleResolver.java @@ -0,0 +1,228 @@ +/* + * Copyright 2018 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.quarkus.gradle; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.nio.file.FileSystem; +import java.nio.file.FileSystems; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.stream.Stream; + +import org.apache.log4j.Logger; +import org.gradle.api.GradleException; +import org.gradle.api.Project; +import org.gradle.api.artifacts.Configuration; +import org.gradle.api.artifacts.Dependency; +import org.gradle.api.artifacts.ModuleIdentifier; +import org.gradle.api.artifacts.ModuleVersionIdentifier; +import org.gradle.api.artifacts.ResolvedArtifact; +import org.gradle.api.artifacts.ResolvedConfiguration; +import org.gradle.api.internal.artifacts.DefaultModuleIdentifier; + +import io.quarkus.bootstrap.BootstrapConstants; +import io.quarkus.bootstrap.model.AppArtifact; +import io.quarkus.bootstrap.model.AppDependency; +import io.quarkus.bootstrap.model.AppModel; +import io.quarkus.bootstrap.resolver.AppModelResolver; +import io.quarkus.bootstrap.resolver.AppModelResolverException; + +public class AppModelGradleResolver implements AppModelResolver { + + private static final Logger log = Logger.getLogger(AppModelGradleResolver.class); + + private AppModel appModel; + private final Project project; + + public AppModelGradleResolver(Project project) { + this.project = project; + } + + @Override + public String getLatestVersion(AppArtifact arg0, String arg1, boolean arg2) throws AppModelResolverException { + throw new UnsupportedOperationException(); + } + + @Override + public String getNextVersion(AppArtifact arg0, String arg1, boolean arg2) throws AppModelResolverException { + throw new UnsupportedOperationException(); + } + + @Override + public List listLaterVersions(AppArtifact arg0, String arg1, boolean arg2) throws AppModelResolverException { + throw new UnsupportedOperationException(); + } + + @Override + public void relink(AppArtifact arg0, Path arg1) throws AppModelResolverException { + + } + + @Override + public Path resolve(AppArtifact appArtifact) throws AppModelResolverException { + if (!appArtifact.isResolved()) { + throw new AppModelResolverException("Artifact has not been resolved: " + appArtifact); + } + return appArtifact.getPath(); + } + + @Override + public AppModel resolveModel(AppArtifact appArtifact) throws AppModelResolverException { + if (appModel != null && appModel.getAppArtifact().equals(appArtifact)) { + return appModel; + } + final Configuration compileCp = project.getConfigurations().getByName("compileClasspath"); + final List extensionDeps = new ArrayList<>(); + final List userDeps = new ArrayList<>(); + Map userModules = new HashMap<>(); + for (ResolvedArtifact a : compileCp.getResolvedConfiguration().getResolvedArtifacts()) { + if (!"jar".equals(a.getType())) { + continue; + } + userModules.put(getModuleId(a), a.getModuleVersion().getId()); + userDeps.add(toAppDependency(a)); + + final File f = a.getFile(); + final Dependency dep; + if (f.isDirectory()) { + dep = processQuarkusDir(a, f.toPath().resolve(BootstrapConstants.QUARKUS)); + } else { + try (FileSystem artifactFs = FileSystems.newFileSystem(f.toPath(), null)) { + dep = processQuarkusDir(a, artifactFs.getPath(BootstrapConstants.QUARKUS)); + } catch (IOException e) { + throw new GradleException("Failed to process " + f, e); + } + } + if (dep != null) { + extensionDeps.add(dep); + } + } + List deploymentDeps = new ArrayList<>(); + if (!extensionDeps.isEmpty()) { + final Configuration deploymentConfig = project.getConfigurations() + .detachedConfiguration(extensionDeps.toArray(new Dependency[extensionDeps.size()])); + final ResolvedConfiguration rc = deploymentConfig.getResolvedConfiguration(); + for (ResolvedArtifact a : rc.getResolvedArtifacts()) { + final ModuleVersionIdentifier userVersion = userModules.get(getModuleId(a)); + if (userVersion != null) { + if (!userVersion.equals(a.getModuleVersion().getId())) { + log.warn("User dependency " + userVersion + " overrides Quarkus platform dependency " + + a.getModuleVersion().getId()); + } + continue; + } + deploymentDeps.add(toAppDependency(a)); + } + } + + /* + * System.out.println("USER APP DEPENDENCIES"); + * for (AppDependency dep : userDeps) { + * System.out.println(" " + dep); + * } + * System.out.println("DEPLOYMENT DEPENDENCIES"); + * for (AppDependency dep : deploymentDeps) { + * System.out.println(" " + dep); + * } + */ + + if (!appArtifact.isResolved()) { + // TODO this is pretty dirty + final Path libs = project.getBuildDir().toPath().resolve("libs"); + if (Files.isDirectory(libs)) { + Path theJar = null; + try (Stream stream = Files.list(libs)) { + final Iterator i = stream.iterator(); + while (i.hasNext()) { + final Path p = i.next(); + if (!p.getFileName().toString().endsWith(".jar")) { + continue; + } + if (theJar != null) { + throw new GradleException("Failed to determine the application JAR in " + libs); + } + theJar = p; + } + appArtifact.setPath(theJar); + } catch (IOException e) { + throw new GradleException("Failed to read project's libs dir", e); + } + } else { + throw new GradleException("The project's libs dir does not exist: " + libs); + } + } + return this.appModel = new AppModel(appArtifact, userDeps, deploymentDeps); + } + + @Override + public AppModel resolveModel(AppArtifact arg0, List arg1) throws AppModelResolverException { + throw new UnsupportedOperationException(); + } + + private ModuleIdentifier getModuleId(ResolvedArtifact a) { + final String[] split = a.getModuleVersion().toString().split(":"); + return DefaultModuleIdentifier.newId(split[0], split[1]); + } + + private AppDependency toAppDependency(ResolvedArtifact a) { + final String[] split = a.getModuleVersion().toString().split(":"); + final AppArtifact appArtifact = new AppArtifact(split[0], split[1], split[2]); + appArtifact.setPath(a.getFile().toPath()); + return new AppDependency(appArtifact, "runtime"); + } + + private Dependency processQuarkusDir(ResolvedArtifact a, Path quarkusDir) { + if (!Files.exists(quarkusDir)) { + return null; + } + final Path quarkusDescr = quarkusDir.resolve(BootstrapConstants.DESCRIPTOR_PATH); + if (!Files.exists(quarkusDescr)) { + return null; + } + final Properties extProps = resolveDescriptor(quarkusDescr); + if (extProps == null) { + return null; + } + String value = extProps.getProperty(BootstrapConstants.PROP_DEPLOYMENT_ARTIFACT); + final String[] split = value.split(":"); + + return new QuarkusExtDependency(split[0], split[1], split[2], null); + } + + private Properties resolveDescriptor(final Path path) { + final Properties rtProps; + if (!Files.exists(path)) { + // not a platform artifact + return null; + } + rtProps = new Properties(); + try (BufferedReader reader = Files.newBufferedReader(path)) { + rtProps.load(reader); + } catch (IOException e) { + throw new GradleException("Failed to load extension description " + path, e); + } + return rtProps; + } +} diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusExtDependency.java b/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusExtDependency.java new file mode 100644 index 0000000000000..52044d702f159 --- /dev/null +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusExtDependency.java @@ -0,0 +1,32 @@ +package io.quarkus.gradle; + +import org.gradle.api.artifacts.Dependency; +import org.gradle.api.artifacts.ExternalModuleDependency; +import org.gradle.api.internal.artifacts.DefaultModuleIdentifier; +import org.gradle.api.internal.artifacts.dependencies.AbstractExternalModuleDependency; + +public class QuarkusExtDependency extends AbstractExternalModuleDependency { + + private final String group; + private final String name; + private final String version; + private final String configuration; + + public QuarkusExtDependency(String group, String name, String version, String configuration) { + super(DefaultModuleIdentifier.newId(group, name), version, configuration); + this.group = group; + this.name = name; + this.version = version; + this.configuration = configuration; + } + + @Override + public ExternalModuleDependency copy() { + return new QuarkusExtDependency(group, name, version, configuration); + } + + @Override + public boolean contentEquals(Dependency arg0) { + return true; + } +} diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPluginExtension.java b/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPluginExtension.java index 2915a1964bc7e..acbd449220a87 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPluginExtension.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPluginExtension.java @@ -21,6 +21,10 @@ import org.gradle.api.Project; import org.gradle.api.plugins.JavaPluginConvention; import org.gradle.api.tasks.SourceSet; +import org.gradle.api.tasks.SourceSetContainer; + +import io.quarkus.bootstrap.model.AppArtifact; +import io.quarkus.bootstrap.resolver.AppModelResolver; /** * @author Ståle Pedersen @@ -104,18 +108,6 @@ public void setFinalName(String finalName) { this.finalName = finalName; } - public String groupId() { - return project.getGroup().toString(); - } - - public String artifactId() { - return project.getName(); - } - - public String version() { - return project.getVersion().toString(); - } - public boolean uberJar() { return false; } @@ -126,8 +118,18 @@ public Set resourcesDir() { } public Set dependencyFiles() { - SourceSet sourceSet = project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().getByName("main"); - return sourceSet.getCompileClasspath().getFiles(); + SourceSetContainer sourceSets = project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets(); + SourceSet sourceSet = sourceSets.getByName("main"); + Set files = sourceSet.getCompileClasspath().getFiles(); + return files; } + public AppArtifact getAppArtifact() { + return new AppArtifact(project.getGroup().toString(), project.getName(), + project.getVersion().toString()); + } + + public AppModelResolver resolveAppModel() { + return new AppModelGradleResolver(project); + } } diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/ResolvedGradleArtifactDeps.java b/devtools/gradle/src/main/java/io/quarkus/gradle/ResolvedGradleArtifactDeps.java index a8039c905e265..78422b27e511f 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/ResolvedGradleArtifactDeps.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/ResolvedGradleArtifactDeps.java @@ -34,15 +34,14 @@ import org.gradle.api.plugins.JavaPluginConvention; import org.gradle.api.tasks.SourceSet; -import io.quarkus.creator.AppArtifact; -import io.quarkus.creator.AppArtifactResolverBase; +import io.quarkus.bootstrap.model.AppArtifact; +import io.quarkus.bootstrap.model.AppDependency; import io.quarkus.creator.AppCreatorException; -import io.quarkus.creator.AppDependency; /** * @author Ståle Pedersen */ -public class ResolvedGradleArtifactDeps extends AppArtifactResolverBase { +public class ResolvedGradleArtifactDeps { private final String groupId; private final String artifactId; @@ -105,20 +104,18 @@ private void traverseDependencies(Set dependencies, }); } - @Override public void relink(AppArtifact artifact, Path path) throws AppCreatorException { throw new UnsupportedOperationException(); } - @Override protected void doResolve(AppArtifact coords) throws AppCreatorException { if (coords.getGroupId().equals(groupId) && coords.getArtifactId().equals(artifactId)) { - setPath(coords, projectFile.toPath()); + coords.setPath(projectFile.toPath()); } else { File dep = findMatchingDependencyFile(coords.getGroupId(), coords.getArtifactId(), coords.getVersion()); if (dep != null) - setPath(coords, dep.toPath()); + coords.setPath(dep.toPath()); else throw new AppCreatorException("Did not find dependency file for: " + coords.toString()); } @@ -131,7 +128,7 @@ private AppArtifact toAppArtifact(ResolvedComponentResult result) { File dep = findMatchingDependencyFile(appArtifacat.getGroupId(), appArtifacat.getArtifactId(), appArtifacat.getVersion()); if (dep != null) { - setPath(appArtifacat, dep.toPath()); + appArtifacat.setPath(dep.toPath()); } return appArtifacat; } @@ -150,7 +147,6 @@ private File findMatchingDependencyFile(String group, String artifact, String ve return null; } - @Override public List collectDependencies(AppArtifact coords) throws AppCreatorException { if (!coords.getGroupId().equals(groupId) || !coords.getArtifactId().equals(artifactId) || @@ -163,23 +159,19 @@ public List collectDependencies(AppArtifact coords) throws AppCre return deps; } - @Override public List collectDependencies(AppArtifact root, List deps) throws AppCreatorException { throw new UnsupportedOperationException(); } - @Override public List listLaterVersions(AppArtifact artifact, String upToVersion, boolean inclusive) throws AppCreatorException { throw new UnsupportedOperationException(); } - @Override public String getNextVersion(AppArtifact artifact, String upToVersion, boolean inclusive) throws AppCreatorException { throw new UnsupportedOperationException(); } - @Override public String getLatestVersion(AppArtifact artifact, String upToVersion, boolean inclusive) throws AppCreatorException { throw new UnsupportedOperationException(); } diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusBuild.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusBuild.java index 8f0be6b6f8c3d..ab9680787ba41 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusBuild.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusBuild.java @@ -16,21 +16,22 @@ package io.quarkus.gradle.tasks; import java.io.File; -import java.util.List; +import org.gradle.api.GradleException; import org.gradle.api.tasks.Optional; import org.gradle.api.tasks.TaskAction; import org.gradle.api.tasks.options.Option; -import io.quarkus.creator.AppArtifact; +import io.quarkus.bootstrap.model.AppArtifact; +import io.quarkus.bootstrap.model.AppModel; +import io.quarkus.bootstrap.resolver.AppModelResolver; +import io.quarkus.bootstrap.resolver.AppModelResolverException; import io.quarkus.creator.AppCreator; import io.quarkus.creator.AppCreatorException; -import io.quarkus.creator.AppDependency; import io.quarkus.creator.phase.augment.AugmentPhase; import io.quarkus.creator.phase.curate.CurateOutcome; import io.quarkus.creator.phase.runnerjar.RunnerJarOutcome; import io.quarkus.creator.phase.runnerjar.RunnerJarPhase; -import io.quarkus.gradle.ResolvedGradleArtifactDeps; /** * @author Ståle Pedersen @@ -126,6 +127,15 @@ public void setUberJar(boolean uberJar) { public void buildQuarkus() { getLogger().lifecycle("building quarkus runner"); + final AppArtifact appArtifact = extension().getAppArtifact(); + final AppModel appModel; + final AppModelResolver modelResolver = extension().resolveAppModel(); + try { + appModel = modelResolver.resolveModel(appArtifact); + } catch (AppModelResolverException e) { + throw new GradleException("Failed to resolve application model " + appArtifact + " dependencies", e); + } + try (AppCreator appCreator = AppCreator.builder() // configure the build phases we want the app to go through .addPhase(new AugmentPhase() @@ -140,28 +150,17 @@ public void buildQuarkus() { .setWorkDir(getProject().getBuildDir().toPath()) .build()) { - final AppArtifact appArtifact = new AppArtifact(extension().groupId(), extension().artifactId(), - extension().version()); - try { - ResolvedGradleArtifactDeps resolvedGradleArtifactDeps = new ResolvedGradleArtifactDeps(getProject()); - final List appDeps = resolvedGradleArtifactDeps.collectDependencies(appArtifact); - - // push resolved application state - appCreator.pushOutcome(CurateOutcome.builder() - .setAppArtifact(appArtifact) - .setArtifactResolver(resolvedGradleArtifactDeps) - .setInitialDeps(appDeps) - .build()); - - // resolve the outcome we need here - appCreator.resolveOutcome(RunnerJarOutcome.class); - } catch (AppCreatorException e) { - e.printStackTrace(); - } + // push resolved application state + appCreator.pushOutcome(CurateOutcome.builder() + .setAppModelResolver(modelResolver) + .setAppModel(appModel) + .build()); + + // resolve the outcome we need here + appCreator.resolveOutcome(RunnerJarOutcome.class); } catch (AppCreatorException e) { - e.printStackTrace(); + throw new GradleException("Failed to build a runnable JAR", e); } - } } diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java index 2b4a295dd8ebd..c29a93a309ff6 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java @@ -38,6 +38,11 @@ import org.gradle.api.tasks.TaskAction; import org.gradle.api.tasks.options.Option; +import io.quarkus.bootstrap.model.AppArtifact; +import io.quarkus.bootstrap.model.AppDependency; +import io.quarkus.bootstrap.model.AppModel; +import io.quarkus.bootstrap.resolver.AppModelResolver; +import io.quarkus.bootstrap.resolver.AppModelResolverException; import io.quarkus.dev.ClassLoaderCompiler; import io.quarkus.dev.DevModeMain; import io.quarkus.gradle.QuarkusPluginExtension; @@ -80,11 +85,11 @@ public void setDebug(String debug) { } @OutputDirectory + @Optional public File getBuildDir() { return buildDir; } - @Optional public void setBuildDir(File buildDir) { this.buildDir = buildDir; } @@ -133,8 +138,7 @@ public void startDev() { throw new GradleException("The `src/main/java` directory is required, please create it."); } - if (!getBuildDir().isDirectory() || - !new File(getBuildDir(), "classes").isDirectory()) { + if (!extension().outputDirectory().isDirectory()) { throw new GradleException("The project has no output yet, " + "this should not happen as build should have been executed first. " + "Do the project have any source files?"); @@ -142,7 +146,7 @@ public void startDev() { try { List args = new ArrayList<>(); - args.add("java"); + args.add(findJavaTool()); if (getDebug() == null) { // debug mode not specified // make sure 5005 is not used, we don't want to just fail if something else is using it @@ -197,13 +201,24 @@ public void startDev() { // Do not include URIs in the manifest, because some JVMs do not like that StringBuilder classPathManifest = new StringBuilder(); StringBuilder classPath = new StringBuilder(); - for (File f : extension.dependencyFiles()) { - addToClassPaths(classPathManifest, classPath, f); + + final AppModel appModel; + final AppModelResolver modelResolver = extension().resolveAppModel(); + try { + final AppArtifact appArtifact = extension.getAppArtifact(); + appArtifact.setPath(extension.outputDirectory().toPath()); + appModel = modelResolver.resolveModel(appArtifact); + } catch (AppModelResolverException e) { + throw new GradleException("Failed to resolve application model " + extension.getAppArtifact() + " dependencies", + e); } + for (AppDependency appDep : appModel.getAllDependencies()) { + addToClassPaths(classPathManifest, classPath, appDep.getArtifact().getPath().toFile()); + } + args.add("-Djava.util.logging.manager=org.jboss.logmanager.LogManager"); File wiringClassesDirectory = new File(getBuildDir(), "wiring-classes"); wiringClassesDirectory.mkdirs(); - addToClassPaths(classPathManifest, classPath, wiringClassesDirectory); //we also want to add the maven plugin jar to the class path @@ -292,6 +307,45 @@ public void run() { } } + /** + * Search for the java command in the order: + * 1. maven-toolchains plugin configuration + * 2. java.home location + * 3. java[.exe] on the system path + * + * @return the java command to use + */ + protected String findJavaTool() { + // use the same JVM as the one used to run Maven (the "java.home" one) + String java = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; + File javaCheck = new File(java); + if (!javaCheck.canExecute()) { + + java = null; + // Try executable extensions if windows + if (OS.determineOS() == OS.WINDOWS && System.getenv().containsKey("PATHEXT")) { + String extpath = System.getenv("PATHEXT"); + String[] exts = extpath.split(";"); + for (String ext : exts) { + File winExe = new File(javaCheck.getAbsolutePath() + ext); + if (winExe.canExecute()) { + java = winExe.getAbsolutePath(); + break; + } + } + } + // Fallback to java on the path + if (java == null) { + if (OS.determineOS() == OS.WINDOWS) { + java = "java.exe"; + } else { + java = "java"; + } + } + } + return java; + } + private void addToClassPaths(StringBuilder classPathManifest, StringBuilder classPath, File file) throws MalformedURLException { URI uri = file.toPath().toAbsolutePath().toUri(); @@ -305,4 +359,43 @@ private void addToClassPaths(StringBuilder classPathManifest, StringBuilder clas classPath.append(" "); } + /** + * Enum to classify the os.name system property + */ + static enum OS { + WINDOWS, LINUX, MAC, OTHER; + + private String version; + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + static OS determineOS() { + OS os = OS.OTHER; + String osName = System.getProperty("os.name"); + osName = osName.toLowerCase(); + if (osName.contains("windows")) { + os = OS.WINDOWS; + } else if (osName.contains("linux") + || osName.contains("freebsd") + || osName.contains("unix") + || osName.contains("sunos") + || osName.contains("solaris") + || osName.contains("aix")) { + os = OS.LINUX; + } else if (osName.contains("mac os")) { + os = OS.MAC; + } else { + os = OS.OTHER; + } + + os.setVersion(System.getProperty("os.version")); + return os; + } + } } diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusNative.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusNative.java index 067d70d6a811c..ea115587a6cc6 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusNative.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusNative.java @@ -25,7 +25,6 @@ import io.quarkus.creator.AppCreator; import io.quarkus.creator.AppCreatorException; -import io.quarkus.creator.AppDependency; import io.quarkus.creator.phase.augment.AugmentOutcome; import io.quarkus.creator.phase.nativeimage.NativeImageOutcome; import io.quarkus.creator.phase.nativeimage.NativeImagePhase; @@ -358,12 +357,6 @@ public Path getWiringClassesDir() { // not relevant for this mojo throw new UnsupportedOperationException(); } - - @Override - public boolean isWhitelisted(AppDependency dep) { - // not relevant for this mojo - throw new UnsupportedOperationException(); - } }).pushOutcome(RunnerJarOutcome.class, new RunnerJarOutcome() { final Path runnerJar = getProject().getBuildDir().toPath().resolve(extension().finalName() + "-runner.jar"); diff --git a/devtools/maven/pom.xml b/devtools/maven/pom.xml index b17414fc0007b..867b098a96c9a 100644 --- a/devtools/maven/pom.xml +++ b/devtools/maven/pom.xml @@ -34,6 +34,10 @@ ${project.version} + + io.quarkus.bootstrap + bootstrap-core + io.quarkus quarkus-devtools-common @@ -71,9 +75,10 @@ --> io.quarkus - quarkus-kotlin + quarkus-kotlin-deployment test + org.apache.maven.shared maven-artifact-transfer @@ -190,7 +195,6 @@ org.apache.maven.plugins maven-plugin-plugin - 3.5.2 quarkus true diff --git a/devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java index b58a9aad40d08..1e16b7174c098 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java @@ -32,15 +32,17 @@ import org.eclipse.aether.RepositorySystemSession; import org.eclipse.aether.repository.RemoteRepository; -import io.quarkus.creator.AppArtifact; +import io.quarkus.bootstrap.model.AppArtifact; +import io.quarkus.bootstrap.model.AppModel; +import io.quarkus.bootstrap.resolver.AppModelResolverException; +import io.quarkus.bootstrap.resolver.BootstrapAppModelResolver; +import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver; import io.quarkus.creator.AppCreator; import io.quarkus.creator.AppCreatorException; -import io.quarkus.creator.AppDependency; import io.quarkus.creator.phase.augment.AugmentPhase; import io.quarkus.creator.phase.curate.CurateOutcome; import io.quarkus.creator.phase.runnerjar.RunnerJarOutcome; import io.quarkus.creator.phase.runnerjar.RunnerJarPhase; -import io.quarkus.creator.resolver.maven.ResolvedMavenArtifactDeps; /** * @@ -107,6 +109,7 @@ public class BuildMojo extends AbstractMojo { @Parameter(defaultValue = "${project.build.directory}") private File buildDir; + /** * The directory for library jars */ @@ -131,6 +134,20 @@ public BuildMojo() { @Override public void execute() throws MojoExecutionException { + final AppArtifact appArtifact = new AppArtifact(project.getGroupId(), project.getArtifactId(), project.getVersion()); + final AppModel appModel; + final BootstrapAppModelResolver modelResolver; + try { + modelResolver = new BootstrapAppModelResolver( + MavenArtifactResolver.builder() + .setRepositorySystem(repoSystem) + .setRepositorySystemSession(repoSession) + .setRemoteRepositories(repos) + .build()); + appModel = modelResolver.resolveModel(appArtifact); + } catch (AppModelResolverException e) { + throw new MojoExecutionException("Failed to resolve application model " + appArtifact + " dependencies", e); + } try (AppCreator appCreator = AppCreator.builder() // configure the build phases we want the app to go through .addPhase(new AugmentPhase() @@ -145,15 +162,10 @@ public void execute() throws MojoExecutionException { .setWorkDir(buildDir.toPath()) .build()) { - final AppArtifact appArtifact = new AppArtifact(project.getGroupId(), project.getArtifactId(), - project.getVersion()); - final List appDeps = new ResolvedMavenArtifactDeps(project.getGroupId(), project.getArtifactId(), - project.getVersion(), project.getArtifacts()).collectDependencies(appArtifact); - // push resolved application state appCreator.pushOutcome(CurateOutcome.builder() - .setAppArtifact(appArtifact) - .setInitialDeps(appDeps) + .setAppModelResolver(modelResolver) + .setAppModel(appModel) .build()); // resolve the outcome we need here diff --git a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java index bfac68469bb7e..eebc44e8bed13 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java @@ -34,7 +34,6 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; -import org.apache.maven.artifact.Artifact; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Plugin; import org.apache.maven.model.PluginExecution; @@ -50,7 +49,15 @@ import org.apache.maven.project.MavenProject; import org.apache.maven.toolchain.Toolchain; import org.apache.maven.toolchain.ToolchainManager; - +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.repository.RemoteRepository; + +import io.quarkus.bootstrap.model.AppDependency; +import io.quarkus.bootstrap.model.AppModel; +import io.quarkus.bootstrap.resolver.BootstrapAppModelResolver; +import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver; +import io.quarkus.bootstrap.resolver.maven.workspace.LocalProject; import io.quarkus.dev.ClassLoaderCompiler; import io.quarkus.dev.DevModeMain; import io.quarkus.maven.components.MavenVersionEnforcer; @@ -121,6 +128,15 @@ public class DevMojo extends AbstractMojo { @Component private MavenVersionEnforcer mavenVersionEnforcer; + @Component + private RepositorySystem repoSystem; + + @Parameter(defaultValue = "${repositorySystemSession}", readonly = true) + private RepositorySystemSession repoSession; + + @Parameter(defaultValue = "${project.remoteProjectRepositories}", readonly = true, required = true) + private List repos; + /** * This value is intended to be set to true when some generated bytecode * is erroneous causing the JVM to crash when the verify:none option is set (which is on by default) @@ -235,13 +251,29 @@ public void execute() throws MojoFailureException, MojoExecutionException { // Do not include URIs in the manifest, because some JVMs do not like that StringBuilder classPathManifest = new StringBuilder(); StringBuilder classPath = new StringBuilder(); - for (Artifact artifact : project.getArtifacts()) { - addToClassPaths(classPathManifest, classPath, artifact.getFile()); + + final AppModel appModel; + try { + final LocalProject localProject = LocalProject + .resolveLocalProjectWithWorkspace(LocalProject.locateCurrentProjectDir(outputDirectory.toPath())); + appModel = new BootstrapAppModelResolver(MavenArtifactResolver.builder() + .setRepositorySystem(repoSystem) + .setRepositorySystemSession(repoSession) + .setRemoteRepositories(repos) + .setOffline(false) + .setWorkspace(localProject.getWorkspace()) + .build()) + .resolveModel(localProject.getAppArtifact()); + } catch (Exception e) { + throw new MojoExecutionException("Failed to resolve Quarkus application model", e); + } + for (AppDependency appDep : appModel.getAllDependencies()) { + addToClassPaths(classPathManifest, classPath, appDep.getArtifact().getPath().toFile()); } + args.add("-Djava.util.logging.manager=org.jboss.logmanager.LogManager"); File wiringClassesDirectory = new File(buildDir, "wiring-devmode"); wiringClassesDirectory.mkdirs(); - addToClassPaths(classPathManifest, classPath, wiringClassesDirectory); //we also want to add the maven plugin jar to the class path @@ -442,5 +474,4 @@ static OS determineOS() { return os; } } - } diff --git a/devtools/maven/src/main/java/io/quarkus/maven/NativeImageMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/NativeImageMojo.java index 2481c0a7c82ac..61beac79de888 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/NativeImageMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/NativeImageMojo.java @@ -31,7 +31,6 @@ import io.quarkus.creator.AppCreator; import io.quarkus.creator.AppCreatorException; -import io.quarkus.creator.AppDependency; import io.quarkus.creator.phase.augment.AugmentOutcome; import io.quarkus.creator.phase.nativeimage.NativeImageOutcome; import io.quarkus.creator.phase.nativeimage.NativeImagePhase; @@ -187,12 +186,6 @@ public Path getWiringClassesDir() { // not relevant for this mojo throw new UnsupportedOperationException(); } - - @Override - public boolean isWhitelisted(AppDependency dep) { - // not relevant for this mojo - throw new UnsupportedOperationException(); - } }) .pushOutcome(RunnerJarOutcome.class, new RunnerJarOutcome() { final Path runnerJar = buildDir.toPath().resolve(finalName + "-runner.jar"); diff --git a/devtools/maven/src/test/resources/projects/classic-kotlin/pom.xml b/devtools/maven/src/test/resources/projects/classic-kotlin/pom.xml index 22f9a84b6a0bb..5f795d0423fe6 100644 --- a/devtools/maven/src/test/resources/projects/classic-kotlin/pom.xml +++ b/devtools/maven/src/test/resources/projects/classic-kotlin/pom.xml @@ -17,19 +17,16 @@ @project.groupId@ quarkus-resteasy ${quarkus.version} - provided @project.groupId@ quarkus-arc ${quarkus.version} - provided @project.groupId@ - quarkus-kotlin + quarkus-kotlin-deployment ${quarkus.version} - provided @project.groupId@ diff --git a/devtools/maven/src/test/resources/projects/classic/pom.xml b/devtools/maven/src/test/resources/projects/classic/pom.xml index dc0cad1cc34b5..f81d957dea9e6 100644 --- a/devtools/maven/src/test/resources/projects/classic/pom.xml +++ b/devtools/maven/src/test/resources/projects/classic/pom.xml @@ -16,13 +16,11 @@ @project.groupId@ quarkus-resteasy ${quarkus.version} - provided @project.groupId@ quarkus-arc ${quarkus.version} - provided @project.groupId@ diff --git a/devtools/maven/src/test/resources/projects/uberjar-check/pom.xml b/devtools/maven/src/test/resources/projects/uberjar-check/pom.xml index 95301e18b8292..ff5f846651d6e 100644 --- a/devtools/maven/src/test/resources/projects/uberjar-check/pom.xml +++ b/devtools/maven/src/test/resources/projects/uberjar-check/pom.xml @@ -16,13 +16,11 @@ @project.groupId@ quarkus-resteasy ${quarkus.version} - provided @project.groupId@ quarkus-arc ${quarkus.version} - provided @project.groupId@ diff --git a/docs/src/main/asciidoc/extension-authors-guide.adoc b/docs/src/main/asciidoc/extension-authors-guide.adoc index cbc1e036bdaf5..8a0b473b6590a 100644 --- a/docs/src/main/asciidoc/extension-authors-guide.adoc +++ b/docs/src/main/asciidoc/extension-authors-guide.adoc @@ -58,14 +58,12 @@ Your extension project should be setup as a multi-module project with two submod 2. A runtime submodule that contains the runtime behavior that will provide the extension behavior in the native executable or runtime JVM. -Your runtime artifact should depend on quarkus-core-runtime, and possibly the runtime artifacts of other Quarkus -modules if you want to use functionality provided by them. You will also need to include the `maven-dependency-plugin` -to write out the needed runtime dependencies, if you are using the Quarkus parent pom it will automatically -inherit the correct configuration. +Your runtime artifact should depend on `io.quarkus:quarkus-core`, and possibly the runtime artifacts of other Quarkus +modules if you want to use functionality provided by them. You will also need to include the `io.quarkus.bootstrap:bootstrap-maven-plugin` +to generate the Quarkus extension descriptor included into the runtime artifact, if you are using the Quarkus parent pom it will automatically inherit the correct configuration. -Note that at present by convention the runtime artifact will have the `-runtime` suffix, and the deployment time artifact -has no suffix (and is what the end user adds to their project). In the near future this will change, so the `-runtime` -artifact will loose its suffix, and the deployment time artifacts will have one added. +NOTE: By convention the deployment time artifact has the `-deployment` suffix, and the runtime artifact +has no suffix (and is what the end user adds to their project). [source%nowrap,xml] ---- @@ -73,14 +71,15 @@ artifact will loose its suffix, and the deployment time artifacts will have one io.quarkus - quarkus-core-runtime + quarkus-core - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin @@ -92,7 +91,7 @@ Under no circumstances can the runtime module depend on a deployment artifact. T in pulling all the deployment time code into runtime scope, which defeats the purpose of having the split. ==== -Your deployment time module should depend on `quarkus-core`, your runtime artifact, +Your deployment time module should depend on `io.quarkus:quarkus-core-deployment`, your runtime artifact, and possibly the deployment artifacts of other Quarkus modules if you want to use functionality provided by them. @@ -100,11 +99,10 @@ and possibly the deployment artifacts of other Quarkus modules if you want to us ---- io.quarkus - quarkus-core + quarkus-core-deployment ---- -NOTE: For historical reasons the `augment` step is still called `deployment`, this will likely remain until we do our big rename. == Build Step Processors diff --git a/extensions/agroal/deployment/pom.xml b/extensions/agroal/deployment/pom.xml index fc7421a928a49..26ace6e486951 100644 --- a/extensions/agroal/deployment/pom.xml +++ b/extensions/agroal/deployment/pom.xml @@ -26,25 +26,25 @@ 4.0.0 - quarkus-agroal + quarkus-agroal-deployment Quarkus - Agroal - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-agroal-runtime + quarkus-agroal io.quarkus - quarkus-narayana-jta + quarkus-narayana-jta-deployment diff --git a/extensions/agroal/runtime/pom.xml b/extensions/agroal/runtime/pom.xml index d0145f903f5b7..73e8546408031 100644 --- a/extensions/agroal/runtime/pom.xml +++ b/extensions/agroal/runtime/pom.xml @@ -26,17 +26,17 @@ 4.0.0 - quarkus-agroal-runtime + quarkus-agroal Quarkus - Agroal - Runtime io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus - quarkus-arc-runtime + quarkus-arc com.oracle.substratevm @@ -75,7 +75,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/amazon-lambda/deployment/pom.xml b/extensions/amazon-lambda/deployment/pom.xml index 7287c1cf0b9f8..9b5f5056f9a51 100644 --- a/extensions/amazon-lambda/deployment/pom.xml +++ b/extensions/amazon-lambda/deployment/pom.xml @@ -11,21 +11,21 @@ ../pom.xml - quarkus-amazon-lambda + quarkus-amazon-lambda-deployment Quarkus - Amazon Lambda - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-amazon-lambda-runtime + quarkus-amazon-lambda @@ -41,7 +41,7 @@ io.quarkus - quarkus-undertow + quarkus-undertow-deployment diff --git a/extensions/amazon-lambda/runtime/pom.xml b/extensions/amazon-lambda/runtime/pom.xml index 07407d21531d2..da392a7cf7e53 100644 --- a/extensions/amazon-lambda/runtime/pom.xml +++ b/extensions/amazon-lambda/runtime/pom.xml @@ -11,7 +11,7 @@ ../pom.xml - quarkus-amazon-lambda-runtime + quarkus-amazon-lambda Quarkus - Amazon Lambda - Runtime @@ -21,11 +21,11 @@ io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus - quarkus-undertow-runtime + quarkus-undertow com.fasterxml.jackson.core @@ -36,7 +36,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/arc/deployment/pom.xml b/extensions/arc/deployment/pom.xml index 28d943df9c7f4..b35647038922e 100644 --- a/extensions/arc/deployment/pom.xml +++ b/extensions/arc/deployment/pom.xml @@ -26,23 +26,23 @@ 4.0.0 - quarkus-arc + quarkus-arc-deployment Quarkus - ArC - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc-runtime + quarkus-arc io.quarkus.arc arc-processor - + io.quarkus quarkus-junit5-internal diff --git a/extensions/arc/runtime/pom.xml b/extensions/arc/runtime/pom.xml index 9862b4d6750bd..fdf7589095c25 100644 --- a/extensions/arc/runtime/pom.xml +++ b/extensions/arc/runtime/pom.xml @@ -26,24 +26,25 @@ 4.0.0 - quarkus-arc-runtime + quarkus-arc Quarkus - ArC - Runtime io.quarkus.arc - arc-runtime + arc io.quarkus - quarkus-core-runtime + quarkus-core - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/caffeine/deployment/pom.xml b/extensions/caffeine/deployment/pom.xml index ca471c32c4c34..d4c4f31e3a0b3 100644 --- a/extensions/caffeine/deployment/pom.xml +++ b/extensions/caffeine/deployment/pom.xml @@ -25,17 +25,17 @@ 4.0.0 - quarkus-caffeine + quarkus-caffeine-deployment Quarkus - Caffeine - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-caffeine-runtime + quarkus-caffeine diff --git a/extensions/caffeine/runtime/pom.xml b/extensions/caffeine/runtime/pom.xml index 9284167bf9442..f531d13528d57 100644 --- a/extensions/caffeine/runtime/pom.xml +++ b/extensions/caffeine/runtime/pom.xml @@ -25,7 +25,7 @@ 4.0.0 - quarkus-caffeine-runtime + quarkus-caffeine Quarkus - Caffeine - Runtime @@ -36,15 +36,14 @@ com.oracle.substratevm svm - compile - - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/camel/camel-aws-s3/deployment/pom.xml b/extensions/camel/camel-aws-s3/deployment/pom.xml index 71ab2cf4308d9..87bc74997d37a 100644 --- a/extensions/camel/camel-aws-s3/deployment/pom.xml +++ b/extensions/camel/camel-aws-s3/deployment/pom.xml @@ -10,7 +10,7 @@ 4.0.0 - quarkus-camel-aws-s3 + quarkus-camel-aws-s3-deployment Quarkus - Camel - AWS S3 - Deployment @@ -18,17 +18,17 @@ io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-camel-aws-s3-runtime + quarkus-camel-aws-s3 diff --git a/extensions/camel/camel-aws-s3/runtime/pom.xml b/extensions/camel/camel-aws-s3/runtime/pom.xml index d8bf1eecfdf76..0c9b02e9c39dd 100644 --- a/extensions/camel/camel-aws-s3/runtime/pom.xml +++ b/extensions/camel/camel-aws-s3/runtime/pom.xml @@ -10,7 +10,7 @@ 4.0.0 - quarkus-camel-aws-s3-runtime + quarkus-camel-aws-s3 Quarkus - Camel - AWS S3 - Runtime @@ -18,11 +18,11 @@ io.quarkus - quarkus-arc-runtime + quarkus-arc io.quarkus - quarkus-core-runtime + quarkus-core com.oracle.substratevm @@ -60,7 +60,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/camel/camel-core/deployment/pom.xml b/extensions/camel/camel-core/deployment/pom.xml index f494b039899e0..c482ff3ad3352 100644 --- a/extensions/camel/camel-core/deployment/pom.xml +++ b/extensions/camel/camel-core/deployment/pom.xml @@ -10,7 +10,7 @@ 4.0.0 - quarkus-camel-core + quarkus-camel-core-deployment Quarkus - Camel - Core - Deployment @@ -18,21 +18,21 @@ io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-camel-core-runtime + quarkus-camel-core io.quarkus - quarkus-jaxb + quarkus-jaxb-deployment diff --git a/extensions/camel/camel-core/runtime/pom.xml b/extensions/camel/camel-core/runtime/pom.xml index 390d9b5210b36..8522bea7c7729 100644 --- a/extensions/camel/camel-core/runtime/pom.xml +++ b/extensions/camel/camel-core/runtime/pom.xml @@ -10,7 +10,7 @@ 4.0.0 - quarkus-camel-core-runtime + quarkus-camel-core Quarkus - Camel - Core - Runtime @@ -18,11 +18,11 @@ io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus - quarkus-arc-runtime + quarkus-arc com.oracle.substratevm @@ -50,7 +50,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/camel/camel-infinispan/deployment/pom.xml b/extensions/camel/camel-infinispan/deployment/pom.xml index 45edcf37e3996..d6ad2e7ba5d9e 100644 --- a/extensions/camel/camel-infinispan/deployment/pom.xml +++ b/extensions/camel/camel-infinispan/deployment/pom.xml @@ -10,29 +10,29 @@ 4.0.0 - quarkus-camel-infinispan - Quarkus - Camel - Infinispan - Deployment + quarkus-camel-infinispan-deployment + Quarkus - Camel - Infinispan - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-infinispan-client + quarkus-infinispan-client-deployment io.quarkus - quarkus-camel-infinispan-runtime + quarkus-camel-infinispan diff --git a/extensions/camel/camel-infinispan/runtime/pom.xml b/extensions/camel/camel-infinispan/runtime/pom.xml index d7b406cb90d93..a2ff86850fa4a 100644 --- a/extensions/camel/camel-infinispan/runtime/pom.xml +++ b/extensions/camel/camel-infinispan/runtime/pom.xml @@ -10,7 +10,7 @@ 4.0.0 - quarkus-camel-infinispan-runtime + quarkus-camel-infinispan Quarkus - Camel - Infinispan - Runtime @@ -18,15 +18,15 @@ io.quarkus - quarkus-arc-runtime + quarkus-arc io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus - quarkus-infinispan-client-runtime + quarkus-infinispan-client org.infinispan @@ -48,7 +48,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/camel/camel-netty4-http/deployment/pom.xml b/extensions/camel/camel-netty4-http/deployment/pom.xml index c03a611a65798..5ca026d4eb1c4 100644 --- a/extensions/camel/camel-netty4-http/deployment/pom.xml +++ b/extensions/camel/camel-netty4-http/deployment/pom.xml @@ -10,7 +10,7 @@ 4.0.0 - quarkus-camel-netty4-http + quarkus-camel-netty4-http-deployment Quarkus - Camel - Netty 4 HTTP - Deployment @@ -18,21 +18,21 @@ io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-netty + quarkus-netty-deployment io.quarkus - quarkus-camel-netty4-http-runtime + quarkus-camel-netty4-http diff --git a/extensions/camel/camel-netty4-http/runtime/pom.xml b/extensions/camel/camel-netty4-http/runtime/pom.xml index f516c5fd31bd1..178400a20af4b 100644 --- a/extensions/camel/camel-netty4-http/runtime/pom.xml +++ b/extensions/camel/camel-netty4-http/runtime/pom.xml @@ -10,7 +10,7 @@ 4.0.0 - quarkus-camel-netty4-http-runtime + quarkus-camel-netty4-http Quarkus - Camel - Netty 4 HTTP - Runtime @@ -18,11 +18,11 @@ io.quarkus - quarkus-arc-runtime + quarkus-arc io.quarkus - quarkus-core-runtime + quarkus-core com.oracle.substratevm @@ -40,7 +40,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/camel/camel-salesforce/deployment/pom.xml b/extensions/camel/camel-salesforce/deployment/pom.xml index 9d3c9e238bd13..7f3122c438825 100644 --- a/extensions/camel/camel-salesforce/deployment/pom.xml +++ b/extensions/camel/camel-salesforce/deployment/pom.xml @@ -10,7 +10,7 @@ 4.0.0 - quarkus-camel-salesforce + quarkus-camel-salesforce-deployment Quarkus - Camel - Salesforce - Deployment @@ -18,17 +18,17 @@ io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-camel-salesforce-runtime + quarkus-camel-salesforce diff --git a/extensions/camel/camel-salesforce/runtime/pom.xml b/extensions/camel/camel-salesforce/runtime/pom.xml index 00c80b4f47288..8740a650780ae 100644 --- a/extensions/camel/camel-salesforce/runtime/pom.xml +++ b/extensions/camel/camel-salesforce/runtime/pom.xml @@ -10,7 +10,7 @@ 4.0.0 - quarkus-camel-salesforce-runtime + quarkus-camel-salesforce Quarkus - Camel - Salesforce - Runtime @@ -18,11 +18,11 @@ io.quarkus - quarkus-arc-runtime + quarkus-arc io.quarkus - quarkus-core-runtime + quarkus-core com.oracle.substratevm @@ -40,7 +40,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/elytron-security/deployment/pom.xml b/extensions/elytron-security/deployment/pom.xml index 718f2c7968415..118b7143fc7f2 100644 --- a/extensions/elytron-security/deployment/pom.xml +++ b/extensions/elytron-security/deployment/pom.xml @@ -26,26 +26,26 @@ 4.0.0 - quarkus-elytron-security + quarkus-elytron-security-deployment Quarkus - Security - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-resteasy + quarkus-resteasy-deployment io.quarkus - quarkus-undertow + quarkus-undertow-deployment io.quarkus - quarkus-elytron-security-runtime + quarkus-elytron-security diff --git a/extensions/elytron-security/runtime/pom.xml b/extensions/elytron-security/runtime/pom.xml index 02a270da725fd..cee859e0d1b08 100644 --- a/extensions/elytron-security/runtime/pom.xml +++ b/extensions/elytron-security/runtime/pom.xml @@ -25,13 +25,13 @@ 4.0.0 - quarkus-elytron-security-runtime + quarkus-elytron-security Quarkus - Security - Runtime io.quarkus - quarkus-core-runtime + quarkus-core com.oracle.substratevm @@ -63,7 +63,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/hibernate-orm/deployment/pom.xml b/extensions/hibernate-orm/deployment/pom.xml index 51a098e1193a2..380cce8057415 100644 --- a/extensions/hibernate-orm/deployment/pom.xml +++ b/extensions/hibernate-orm/deployment/pom.xml @@ -25,47 +25,29 @@ 4.0.0 - quarkus-hibernate-orm + quarkus-hibernate-orm-deployment Quarkus - Hibernate ORM - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-hibernate-orm-runtime + quarkus-hibernate-orm io.quarkus - quarkus-narayana-jta + quarkus-narayana-jta-deployment io.quarkus - quarkus-agroal + quarkus-agroal-deployment io.quarkus - quarkus-arc - - - - - org.hibernate - hibernate-core - - - org.javassist - javassist - - + quarkus-arc-deployment diff --git a/extensions/hibernate-orm/runtime/pom.xml b/extensions/hibernate-orm/runtime/pom.xml index eba68d14fdb04..eddf081a31bde 100644 --- a/extensions/hibernate-orm/runtime/pom.xml +++ b/extensions/hibernate-orm/runtime/pom.xml @@ -25,31 +25,33 @@ 4.0.0 - quarkus-hibernate-orm-runtime + quarkus-hibernate-orm Quarkus - Hibernate ORM - Runtime io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus - quarkus-arc-runtime + quarkus-agroal + + + io.quarkus + quarkus-arc compile true + + io.quarkus + quarkus-narayana-jta + org.hibernate hibernate-core - - - net.bytebuddy - byte-buddy - - org.javassist @@ -88,14 +90,15 @@ other Quarkus components (yet) --> io.quarkus - quarkus-caffeine-runtime + quarkus-caffeine - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/hibernate-validator/deployment/pom.xml b/extensions/hibernate-validator/deployment/pom.xml index 54a5249a0743f..6464f66c71644 100644 --- a/extensions/hibernate-validator/deployment/pom.xml +++ b/extensions/hibernate-validator/deployment/pom.xml @@ -26,21 +26,21 @@ 4.0.0 - quarkus-hibernate-validator + quarkus-hibernate-validator-deployment Quarkus - Hibernate Validator - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-hibernate-validator-runtime + quarkus-hibernate-validator diff --git a/extensions/hibernate-validator/runtime/pom.xml b/extensions/hibernate-validator/runtime/pom.xml index 714802f3b73f5..043325cea5d3a 100644 --- a/extensions/hibernate-validator/runtime/pom.xml +++ b/extensions/hibernate-validator/runtime/pom.xml @@ -26,17 +26,17 @@ 4.0.0 - quarkus-hibernate-validator-runtime + quarkus-hibernate-validator Quarkus - Hibernate Validator - Runtime io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus - quarkus-arc-runtime + quarkus-arc org.hibernate.validator @@ -82,7 +82,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/infinispan-client/deployment/pom.xml b/extensions/infinispan-client/deployment/pom.xml index 8d7dd30ab0c6a..5aa5dad05b820 100644 --- a/extensions/infinispan-client/deployment/pom.xml +++ b/extensions/infinispan-client/deployment/pom.xml @@ -25,29 +25,29 @@ 4.0.0 - quarkus-infinispan-client + quarkus-infinispan-client-deployment Quarkus - Infinispan - Client - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-infinispan-client-runtime + quarkus-infinispan-client io.quarkus - quarkus-caffeine + quarkus-caffeine-deployment io.quarkus - quarkus-netty + quarkus-netty-deployment diff --git a/extensions/infinispan-client/runtime/pom.xml b/extensions/infinispan-client/runtime/pom.xml index e67ef30babaf6..9db443335147f 100644 --- a/extensions/infinispan-client/runtime/pom.xml +++ b/extensions/infinispan-client/runtime/pom.xml @@ -25,25 +25,25 @@ 4.0.0 - quarkus-infinispan-client-runtime + quarkus-infinispan-client Quarkus - Infinispan - Client - Runtime io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus - quarkus-arc-runtime + quarkus-arc io.quarkus - quarkus-caffeine-runtime + quarkus-caffeine io.quarkus - quarkus-netty-runtime + quarkus-netty org.infinispan @@ -72,10 +72,10 @@ - - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/jaeger/deployment/pom.xml b/extensions/jaeger/deployment/pom.xml index 68066a2edbc37..93911fabeb4fa 100644 --- a/extensions/jaeger/deployment/pom.xml +++ b/extensions/jaeger/deployment/pom.xml @@ -26,17 +26,17 @@ 4.0.0 - quarkus-jaeger + quarkus-jaeger-deployment Quarkus - Jaeger - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-jaeger-runtime + quarkus-jaeger javax.enterprise diff --git a/extensions/jaeger/runtime/pom.xml b/extensions/jaeger/runtime/pom.xml index dfdd892fd8281..cbbfe11dcf1bb 100644 --- a/extensions/jaeger/runtime/pom.xml +++ b/extensions/jaeger/runtime/pom.xml @@ -26,14 +26,14 @@ 4.0.0 - quarkus-jaeger-runtime + quarkus-jaeger Quarkus - Jaeger - Runtime io.quarkus - quarkus-core-runtime + quarkus-core io.jaegertracing @@ -56,7 +56,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/jaxb/deployment/pom.xml b/extensions/jaxb/deployment/pom.xml index f3a2940095049..0303c90b5f605 100644 --- a/extensions/jaxb/deployment/pom.xml +++ b/extensions/jaxb/deployment/pom.xml @@ -26,17 +26,17 @@ 4.0.0 - quarkus-jaxb + quarkus-jaxb-deployment Quarkus - JAXB - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-jaxb-runtime + quarkus-jaxb diff --git a/extensions/jaxb/runtime/pom.xml b/extensions/jaxb/runtime/pom.xml index 02eee2192fe9e..0df9154e7b00a 100644 --- a/extensions/jaxb/runtime/pom.xml +++ b/extensions/jaxb/runtime/pom.xml @@ -26,7 +26,7 @@ 4.0.0 - quarkus-jaxb-runtime + quarkus-jaxb Quarkus - JAXB - Runtime @@ -36,7 +36,7 @@ io.quarkus - quarkus-core-runtime + quarkus-core javax.xml.bind @@ -47,7 +47,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/jdbc/jdbc-h2/jdbc-h2-deployment/pom.xml b/extensions/jdbc/jdbc-h2/jdbc-h2-deployment/pom.xml index 28c4648ec9ccf..742a7c2187da2 100644 --- a/extensions/jdbc/jdbc-h2/jdbc-h2-deployment/pom.xml +++ b/extensions/jdbc/jdbc-h2/jdbc-h2-deployment/pom.xml @@ -25,17 +25,17 @@ 4.0.0 - quarkus-jdbc-h2 + quarkus-jdbc-h2-deployment Quarkus - JDBC - H2 - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-jdbc-h2-runtime + quarkus-jdbc-h2 diff --git a/extensions/jdbc/jdbc-h2/jdbc-h2-runtime/pom.xml b/extensions/jdbc/jdbc-h2/jdbc-h2-runtime/pom.xml index f1c6ab417125e..3cbd0af632da0 100644 --- a/extensions/jdbc/jdbc-h2/jdbc-h2-runtime/pom.xml +++ b/extensions/jdbc/jdbc-h2/jdbc-h2-runtime/pom.xml @@ -25,7 +25,7 @@ 4.0.0 - quarkus-jdbc-h2-runtime + quarkus-jdbc-h2 Quarkus - JDBC - H2 - Runtime @@ -46,15 +46,14 @@ com.oracle.substratevm svm - compile - - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/jdbc/jdbc-mariadb/jdbc-mariadb-deployment/pom.xml b/extensions/jdbc/jdbc-mariadb/jdbc-mariadb-deployment/pom.xml index 259a678d6a372..b25445cefc7d8 100644 --- a/extensions/jdbc/jdbc-mariadb/jdbc-mariadb-deployment/pom.xml +++ b/extensions/jdbc/jdbc-mariadb/jdbc-mariadb-deployment/pom.xml @@ -25,17 +25,17 @@ 4.0.0 - quarkus-jdbc-mariadb + quarkus-jdbc-mariadb-deployment Quarkus - JDBC - MariaDB - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-jdbc-mariadb-runtime + quarkus-jdbc-mariadb diff --git a/extensions/jdbc/jdbc-mariadb/jdbc-mariadb-runtime/pom.xml b/extensions/jdbc/jdbc-mariadb/jdbc-mariadb-runtime/pom.xml index 7d50c925d6ada..57993fb173536 100644 --- a/extensions/jdbc/jdbc-mariadb/jdbc-mariadb-runtime/pom.xml +++ b/extensions/jdbc/jdbc-mariadb/jdbc-mariadb-runtime/pom.xml @@ -25,7 +25,7 @@ 4.0.0 - quarkus-jdbc-mariadb-runtime + quarkus-jdbc-mariadb Quarkus - JDBC - MariaDB - Runtime @@ -40,10 +40,10 @@ - - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/jdbc/jdbc-mssql/jdbc-mssql-deployment/pom.xml b/extensions/jdbc/jdbc-mssql/jdbc-mssql-deployment/pom.xml index edd7886bd1074..c84c192771fbb 100644 --- a/extensions/jdbc/jdbc-mssql/jdbc-mssql-deployment/pom.xml +++ b/extensions/jdbc/jdbc-mssql/jdbc-mssql-deployment/pom.xml @@ -25,17 +25,17 @@ 4.0.0 - quarkus-jdbc-mssql + quarkus-jdbc-mssql-deployment Quarkus - JDBC - MSSQL - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-jdbc-mssql-runtime + quarkus-jdbc-mssql diff --git a/extensions/jdbc/jdbc-mssql/jdbc-mssql-runtime/pom.xml b/extensions/jdbc/jdbc-mssql/jdbc-mssql-runtime/pom.xml index 1bb4573e93577..985f57944724f 100644 --- a/extensions/jdbc/jdbc-mssql/jdbc-mssql-runtime/pom.xml +++ b/extensions/jdbc/jdbc-mssql/jdbc-mssql-runtime/pom.xml @@ -25,7 +25,7 @@ 4.0.0 - quarkus-jdbc-mssql-runtime + quarkus-jdbc-mssql Quarkus - JDBC - MSSQL - Runtime @@ -83,7 +83,6 @@ com.oracle.substratevm svm - compile @@ -91,7 +90,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/jdbc/jdbc-postgresql/jdbc-postgresql-deployment/pom.xml b/extensions/jdbc/jdbc-postgresql/jdbc-postgresql-deployment/pom.xml index 2f23d5ec9dd64..0843dc177f45b 100644 --- a/extensions/jdbc/jdbc-postgresql/jdbc-postgresql-deployment/pom.xml +++ b/extensions/jdbc/jdbc-postgresql/jdbc-postgresql-deployment/pom.xml @@ -25,17 +25,17 @@ 4.0.0 - quarkus-jdbc-postgresql + quarkus-jdbc-postgresql-deployment Quarkus - JDBC - PostgreSQL - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-jdbc-postgresql-runtime + quarkus-jdbc-postgresql diff --git a/extensions/jdbc/jdbc-postgresql/jdbc-postgresql-runtime/pom.xml b/extensions/jdbc/jdbc-postgresql/jdbc-postgresql-runtime/pom.xml index caab9fc46141b..c2f1072aa5c2c 100644 --- a/extensions/jdbc/jdbc-postgresql/jdbc-postgresql-runtime/pom.xml +++ b/extensions/jdbc/jdbc-postgresql/jdbc-postgresql-runtime/pom.xml @@ -25,7 +25,7 @@ 4.0.0 - quarkus-jdbc-postgresql-runtime + quarkus-jdbc-postgresql Quarkus - JDBC - PostgreSQL - Runtime @@ -40,10 +40,10 @@ - - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/jsonb/deployment/pom.xml b/extensions/jsonb/deployment/pom.xml index e5dd5d289b39b..41fc132061181 100644 --- a/extensions/jsonb/deployment/pom.xml +++ b/extensions/jsonb/deployment/pom.xml @@ -10,21 +10,21 @@ 4.0.0 - quarkus-jsonb + quarkus-jsonb-deployment Quarkus - JSON-B - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-jsonp + quarkus-jsonp-deployment io.quarkus - quarkus-jsonb-runtime + quarkus-jsonb diff --git a/extensions/jsonb/runtime/pom.xml b/extensions/jsonb/runtime/pom.xml index 137e637f25c22..23901025d2f68 100644 --- a/extensions/jsonb/runtime/pom.xml +++ b/extensions/jsonb/runtime/pom.xml @@ -10,7 +10,7 @@ 4.0.0 - quarkus-jsonb-runtime + quarkus-jsonb Quarkus - JSON-B - Runtime @@ -24,18 +24,19 @@ io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus - quarkus-jsonp-runtime + quarkus-jsonp - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/jsonp/deployment/pom.xml b/extensions/jsonp/deployment/pom.xml index 319b24f1696e7..e36f70a9ba179 100644 --- a/extensions/jsonp/deployment/pom.xml +++ b/extensions/jsonp/deployment/pom.xml @@ -10,17 +10,17 @@ 4.0.0 - quarkus-jsonp + quarkus-jsonp-deployment Quarkus - JSON-P - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-jsonp-runtime + quarkus-jsonp diff --git a/extensions/jsonp/runtime/pom.xml b/extensions/jsonp/runtime/pom.xml index adafff418384b..3079b10b83a0f 100644 --- a/extensions/jsonp/runtime/pom.xml +++ b/extensions/jsonp/runtime/pom.xml @@ -10,13 +10,13 @@ 4.0.0 - quarkus-jsonp-runtime + quarkus-jsonp Quarkus - JSON-P - Runtime io.quarkus - quarkus-core-runtime + quarkus-core org.glassfish @@ -27,7 +27,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/kafka-client/deployment/pom.xml b/extensions/kafka-client/deployment/pom.xml index 40418d211ed2c..ecba013364d1c 100644 --- a/extensions/kafka-client/deployment/pom.xml +++ b/extensions/kafka-client/deployment/pom.xml @@ -10,17 +10,17 @@ 999-SNAPSHOT - quarkus-kafka-client + quarkus-kafka-client-deployment Quarkus - Kafka - Client - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-kafka-client-runtime + quarkus-kafka-client io.quarkus diff --git a/extensions/kafka-client/runtime/pom.xml b/extensions/kafka-client/runtime/pom.xml index 433bc6bab4d8d..35ca579fd8887 100644 --- a/extensions/kafka-client/runtime/pom.xml +++ b/extensions/kafka-client/runtime/pom.xml @@ -10,11 +10,16 @@ 999-SNAPSHOT - quarkus-kafka-client-runtime + quarkus-kafka-client Quarkus - Kafka - Client - Runtime + + io.quarkus + quarkus-core + + org.apache.kafka kafka-clients @@ -30,7 +35,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/kotlin/deployment/pom.xml b/extensions/kotlin/deployment/pom.xml index 7555b1b405c38..3f1155dbf4eeb 100644 --- a/extensions/kotlin/deployment/pom.xml +++ b/extensions/kotlin/deployment/pom.xml @@ -26,7 +26,7 @@ 4.0.0 - quarkus-kotlin + quarkus-kotlin-deployment Quarkus - Kotlin - Deployment diff --git a/extensions/narayana-jta/deployment/pom.xml b/extensions/narayana-jta/deployment/pom.xml index a1df971e1b81c..c1c64f7572e9d 100644 --- a/extensions/narayana-jta/deployment/pom.xml +++ b/extensions/narayana-jta/deployment/pom.xml @@ -26,21 +26,21 @@ 4.0.0 - quarkus-narayana-jta + quarkus-narayana-jta-deployment Quarkus - Narayana JTA - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-narayana-jta-runtime + quarkus-narayana-jta diff --git a/extensions/narayana-jta/runtime/pom.xml b/extensions/narayana-jta/runtime/pom.xml index 03375ed3e24f9..be68a8a1d6033 100644 --- a/extensions/narayana-jta/runtime/pom.xml +++ b/extensions/narayana-jta/runtime/pom.xml @@ -26,17 +26,17 @@ 4.0.0 - quarkus-narayana-jta-runtime + quarkus-narayana-jta Quarkus - Narayana JTA - Runtime io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus - quarkus-arc-runtime + quarkus-arc com.oracle.substratevm @@ -59,7 +59,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/netty/deployment/pom.xml b/extensions/netty/deployment/pom.xml index 7f9e9ec99eff0..2df9849116efe 100644 --- a/extensions/netty/deployment/pom.xml +++ b/extensions/netty/deployment/pom.xml @@ -25,21 +25,21 @@ 4.0.0 - quarkus-netty + quarkus-netty-deployment Quarkus - Netty - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-netty-runtime + quarkus-netty io.quarkus - quarkus-arc + quarkus-arc-deployment diff --git a/extensions/netty/runtime/pom.xml b/extensions/netty/runtime/pom.xml index db0c3f611aee6..30aa3ee02aa57 100644 --- a/extensions/netty/runtime/pom.xml +++ b/extensions/netty/runtime/pom.xml @@ -25,7 +25,7 @@ 4.0.0 - quarkus-netty-runtime + quarkus-netty Quarkus - Netty - Runtime @@ -40,7 +40,7 @@ io.quarkus - quarkus-core-runtime + quarkus-core io.netty @@ -54,15 +54,14 @@ com.oracle.substratevm svm - compile - - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/panache/hibernate-orm-panache/deployment/pom.xml b/extensions/panache/hibernate-orm-panache/deployment/pom.xml index 7cad072a684bb..54fbbe2c36444 100644 --- a/extensions/panache/hibernate-orm-panache/deployment/pom.xml +++ b/extensions/panache/hibernate-orm-panache/deployment/pom.xml @@ -26,20 +26,20 @@ 4.0.0 - quarkus-hibernate-orm-panache + quarkus-hibernate-orm-panache-deployment Quarkus - Hibernate ORM with Panache - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-hibernate-orm + quarkus-hibernate-orm-deployment io.quarkus - quarkus-hibernate-orm-panache-runtime + quarkus-hibernate-orm-panache org.ow2.asm diff --git a/extensions/panache/hibernate-orm-panache/runtime/pom.xml b/extensions/panache/hibernate-orm-panache/runtime/pom.xml index f54ba5937ec4f..30d7d300ade78 100644 --- a/extensions/panache/hibernate-orm-panache/runtime/pom.xml +++ b/extensions/panache/hibernate-orm-panache/runtime/pom.xml @@ -25,32 +25,33 @@ 4.0.0 - quarkus-hibernate-orm-panache-runtime + quarkus-hibernate-orm-panache Quarkus - Hibernate ORM with Panache - Runtime io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus - quarkus-hibernate-orm-runtime + quarkus-hibernate-orm io.quarkus - quarkus-arc-runtime + quarkus-arc io.quarkus - quarkus-panache-common-runtime + quarkus-panache-common - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin diff --git a/extensions/panache/panache-common/runtime/pom.xml b/extensions/panache/panache-common/runtime/pom.xml index 96a6c3569899b..d1bc1a6457685 100644 --- a/extensions/panache/panache-common/runtime/pom.xml +++ b/extensions/panache/panache-common/runtime/pom.xml @@ -25,33 +25,26 @@ 4.0.0 - quarkus-panache-common-runtime + quarkus-panache-common Quarkus - Panache - Common - Runtime io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus - quarkus-vertx-runtime + quarkus-vertx io.quarkus - quarkus-hibernate-orm-runtime + quarkus-hibernate-orm io.quarkus - quarkus-arc-runtime + quarkus-arc - - - - maven-dependency-plugin - - - diff --git a/extensions/reactive-streams-operators/smallrye-reactive-streams-operators/deployment/pom.xml b/extensions/reactive-streams-operators/smallrye-reactive-streams-operators/deployment/pom.xml index b39a8d54f3f22..37994d9398bda 100644 --- a/extensions/reactive-streams-operators/smallrye-reactive-streams-operators/deployment/pom.xml +++ b/extensions/reactive-streams-operators/smallrye-reactive-streams-operators/deployment/pom.xml @@ -25,17 +25,17 @@ 4.0.0 - quarkus-smallrye-reactive-streams-operators + quarkus-smallrye-reactive-streams-operators-deployment Quarkus - SmallRye Reactive Streams Operators - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-smallrye-reactive-streams-operators-runtime + quarkus-smallrye-reactive-streams-operators diff --git a/extensions/reactive-streams-operators/smallrye-reactive-streams-operators/runtime/pom.xml b/extensions/reactive-streams-operators/smallrye-reactive-streams-operators/runtime/pom.xml index 1a7ad330dcf4a..eab5ceba7eacd 100644 --- a/extensions/reactive-streams-operators/smallrye-reactive-streams-operators/runtime/pom.xml +++ b/extensions/reactive-streams-operators/smallrye-reactive-streams-operators/runtime/pom.xml @@ -25,7 +25,7 @@ 4.0.0 - quarkus-smallrye-reactive-streams-operators-runtime + quarkus-smallrye-reactive-streams-operators Quarkus - SmallRye Reactive Streams Operators - Runtime @@ -44,10 +44,10 @@ - - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/reactive-streams-operators/smallrye-reactive-type-converters/deployment/pom.xml b/extensions/reactive-streams-operators/smallrye-reactive-type-converters/deployment/pom.xml index 8f649909da25e..e557102493ca2 100644 --- a/extensions/reactive-streams-operators/smallrye-reactive-type-converters/deployment/pom.xml +++ b/extensions/reactive-streams-operators/smallrye-reactive-type-converters/deployment/pom.xml @@ -10,17 +10,17 @@ 999-SNAPSHOT - quarkus-smallrye-reactive-type-converters + quarkus-smallrye-reactive-type-converters-deployment Quarkus - SmallRye Reactive Type Converters - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-smallrye-reactive-type-converters-runtime + quarkus-smallrye-reactive-type-converters diff --git a/extensions/reactive-streams-operators/smallrye-reactive-type-converters/runtime/pom.xml b/extensions/reactive-streams-operators/smallrye-reactive-type-converters/runtime/pom.xml index a34b0bdefd0c0..17c034f42c1c5 100644 --- a/extensions/reactive-streams-operators/smallrye-reactive-type-converters/runtime/pom.xml +++ b/extensions/reactive-streams-operators/smallrye-reactive-type-converters/runtime/pom.xml @@ -25,7 +25,7 @@ 999-SNAPSHOT - quarkus-smallrye-reactive-type-converters-runtime + quarkus-smallrye-reactive-type-converters Quarkus - SmallRye Reactive Type Converters - Runtime @@ -36,12 +36,11 @@ - - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin - diff --git a/extensions/resteasy-common/deployment/pom.xml b/extensions/resteasy-common/deployment/pom.xml index 2a4d6d43c0446..b9a93dab52acf 100644 --- a/extensions/resteasy-common/deployment/pom.xml +++ b/extensions/resteasy-common/deployment/pom.xml @@ -26,13 +26,13 @@ 4.0.0 - quarkus-resteasy-common + quarkus-resteasy-common-deployment Quarkus - RESTEasy - Common - Deployment io.quarkus - quarkus-resteasy-common-runtime + quarkus-resteasy-common com.oracle.substratevm diff --git a/extensions/resteasy-common/runtime/pom.xml b/extensions/resteasy-common/runtime/pom.xml index 0b852ec3007dc..c7d2af0fb5290 100644 --- a/extensions/resteasy-common/runtime/pom.xml +++ b/extensions/resteasy-common/runtime/pom.xml @@ -26,7 +26,7 @@ 4.0.0 - quarkus-resteasy-common-runtime + quarkus-resteasy-common Quarkus - RESTEasy - Common - Runtime @@ -36,7 +36,7 @@ io.quarkus - quarkus-core-runtime + quarkus-core org.jboss.resteasy @@ -47,7 +47,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/resteasy-jsonb/deployment/pom.xml b/extensions/resteasy-jsonb/deployment/pom.xml index 336e2671af242..6971642400be1 100644 --- a/extensions/resteasy-jsonb/deployment/pom.xml +++ b/extensions/resteasy-jsonb/deployment/pom.xml @@ -26,21 +26,21 @@ 4.0.0 - quarkus-resteasy-jsonb + quarkus-resteasy-jsonb-deployment Quarkus - RESTEasy - JSON-B - Deployment io.quarkus - quarkus-resteasy + quarkus-resteasy-deployment io.quarkus - quarkus-resteasy-jsonb-runtime + quarkus-resteasy-jsonb io.quarkus - quarkus-jsonb + quarkus-jsonb-deployment diff --git a/extensions/resteasy-jsonb/runtime/pom.xml b/extensions/resteasy-jsonb/runtime/pom.xml index 4cbf99c3d3e06..2154f1372dd82 100644 --- a/extensions/resteasy-jsonb/runtime/pom.xml +++ b/extensions/resteasy-jsonb/runtime/pom.xml @@ -26,17 +26,17 @@ 4.0.0 - quarkus-resteasy-jsonb-runtime + quarkus-resteasy-jsonb Quarkus - RESTEasy - JSON-B - Runtime io.quarkus - quarkus-resteasy-runtime + quarkus-resteasy io.quarkus - quarkus-jsonb-runtime + quarkus-jsonb org.jboss.resteasy @@ -51,7 +51,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/resteasy/deployment/pom.xml b/extensions/resteasy/deployment/pom.xml index 984a159159aad..33087f00bcbad 100644 --- a/extensions/resteasy/deployment/pom.xml +++ b/extensions/resteasy/deployment/pom.xml @@ -26,33 +26,33 @@ 4.0.0 - quarkus-resteasy + quarkus-resteasy-deployment Quarkus - RESTEasy - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-resteasy-common + quarkus-resteasy-common-deployment io.quarkus - quarkus-undertow + quarkus-undertow-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-jaxb + quarkus-jaxb-deployment io.quarkus - quarkus-resteasy-runtime + quarkus-resteasy com.oracle.substratevm diff --git a/extensions/resteasy/runtime/pom.xml b/extensions/resteasy/runtime/pom.xml index 34cec06725538..53533cc58b3e3 100644 --- a/extensions/resteasy/runtime/pom.xml +++ b/extensions/resteasy/runtime/pom.xml @@ -26,7 +26,7 @@ 4.0.0 - quarkus-resteasy-runtime + quarkus-resteasy Quarkus - RESTEasy - Runtime @@ -36,19 +36,19 @@ io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus - quarkus-undertow-runtime + quarkus-undertow io.quarkus - quarkus-arc-runtime + quarkus-arc io.quarkus - quarkus-resteasy-common-runtime + quarkus-resteasy-common javax.validation @@ -60,14 +60,15 @@ io.quarkus - quarkus-jaxb-runtime + quarkus-jaxb - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/scheduler/deployment/pom.xml b/extensions/scheduler/deployment/pom.xml index d5469deacc1a1..643b45232e10a 100644 --- a/extensions/scheduler/deployment/pom.xml +++ b/extensions/scheduler/deployment/pom.xml @@ -11,28 +11,28 @@ 4.0.0 - quarkus-scheduler + quarkus-scheduler-deployment Quarkus - Scheduler - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-scheduler-runtime + quarkus-scheduler - + io.quarkus quarkus-junit5-internal - + diff --git a/extensions/scheduler/runtime/pom.xml b/extensions/scheduler/runtime/pom.xml index 3b13cf61ce412..4a9c51c5149f1 100644 --- a/extensions/scheduler/runtime/pom.xml +++ b/extensions/scheduler/runtime/pom.xml @@ -10,13 +10,13 @@ 4.0.0 - quarkus-scheduler-runtime + quarkus-scheduler Quarkus - Scheduler - Runtime io.quarkus - quarkus-arc-runtime + quarkus-arc org.slf4j @@ -51,13 +51,14 @@ true --> - + - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/smallrye-fault-tolerance/deployment/pom.xml b/extensions/smallrye-fault-tolerance/deployment/pom.xml index ff4bd3a1ec7f9..8b3b81aa74a0f 100644 --- a/extensions/smallrye-fault-tolerance/deployment/pom.xml +++ b/extensions/smallrye-fault-tolerance/deployment/pom.xml @@ -26,25 +26,25 @@ 4.0.0 - quarkus-smallrye-fault-tolerance + quarkus-smallrye-fault-tolerance-deployment Quarkus - SmallRye Fault tolerance - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-smallrye-metrics + quarkus-smallrye-metrics-deployment io.quarkus - quarkus-smallrye-fault-tolerance-runtime + quarkus-smallrye-fault-tolerance com.oracle.substratevm diff --git a/extensions/smallrye-fault-tolerance/runtime/pom.xml b/extensions/smallrye-fault-tolerance/runtime/pom.xml index 76aee731d0e45..6392b2f15d1c4 100644 --- a/extensions/smallrye-fault-tolerance/runtime/pom.xml +++ b/extensions/smallrye-fault-tolerance/runtime/pom.xml @@ -26,13 +26,13 @@ 4.0.0 - quarkus-smallrye-fault-tolerance-runtime + quarkus-smallrye-fault-tolerance Quarkus - SmallRye Fault tolerance - Runtime io.quarkus - quarkus-core-runtime + quarkus-core io.smallrye @@ -54,9 +54,10 @@ - - maven-dependency-plugin - + + io.quarkus.bootstrap + bootstrap-maven-plugin + maven-compiler-plugin diff --git a/extensions/smallrye-health/deployment/pom.xml b/extensions/smallrye-health/deployment/pom.xml index 503f8f0a958f6..71100f407e78b 100644 --- a/extensions/smallrye-health/deployment/pom.xml +++ b/extensions/smallrye-health/deployment/pom.xml @@ -26,29 +26,29 @@ 4.0.0 - quarkus-smallrye-health + quarkus-smallrye-health-deployment Quarkus - SmallRye Health - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-undertow + quarkus-undertow-deployment io.quarkus - quarkus-jsonp + quarkus-jsonp-deployment io.quarkus - quarkus-smallrye-health-runtime + quarkus-smallrye-health diff --git a/extensions/smallrye-health/runtime/pom.xml b/extensions/smallrye-health/runtime/pom.xml index df5b954261b04..d27a384406552 100644 --- a/extensions/smallrye-health/runtime/pom.xml +++ b/extensions/smallrye-health/runtime/pom.xml @@ -26,7 +26,7 @@ 4.0.0 - quarkus-smallrye-health-runtime + quarkus-smallrye-health Quarkus - SmallRye Health - Runtime @@ -37,15 +37,15 @@ io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus - quarkus-undertow-runtime + quarkus-undertow io.quarkus - quarkus-jsonp-runtime + quarkus-jsonp org.jboss.spec.javax.servlet @@ -56,7 +56,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/smallrye-jwt/deployment/pom.xml b/extensions/smallrye-jwt/deployment/pom.xml index 543fd03edf511..94f5944ec2839 100644 --- a/extensions/smallrye-jwt/deployment/pom.xml +++ b/extensions/smallrye-jwt/deployment/pom.xml @@ -26,7 +26,7 @@ 4.0.0 - quarkus-smallrye-jwt + quarkus-smallrye-jwt-deployment Quarkus - SmallRye JWT - Deployment @@ -36,27 +36,27 @@ io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-undertow + quarkus-undertow-deployment io.quarkus - quarkus-jsonp + quarkus-jsonp-deployment io.quarkus - quarkus-elytron-security + quarkus-elytron-security-deployment io.quarkus - quarkus-smallrye-jwt-runtime + quarkus-smallrye-jwt @@ -67,7 +67,7 @@ io.quarkus - quarkus-resteasy-jsonb-runtime + quarkus-resteasy-jsonb io.rest-assured diff --git a/extensions/smallrye-jwt/runtime/pom.xml b/extensions/smallrye-jwt/runtime/pom.xml index 79ccccd51e994..fa18dc0c83e5e 100644 --- a/extensions/smallrye-jwt/runtime/pom.xml +++ b/extensions/smallrye-jwt/runtime/pom.xml @@ -26,7 +26,7 @@ 4.0.0 - quarkus-smallrye-jwt-runtime + quarkus-smallrye-jwt Quarkus - SmallRye JWT - Runtime @@ -40,19 +40,19 @@ io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus - quarkus-elytron-security-runtime + quarkus-elytron-security io.quarkus - quarkus-undertow-runtime + quarkus-undertow io.quarkus - quarkus-jsonp-runtime + quarkus-jsonp org.jboss.spec.javax.servlet @@ -67,7 +67,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/smallrye-metrics/deployment/pom.xml b/extensions/smallrye-metrics/deployment/pom.xml index 71b81ed2f1dd5..0341755d1388a 100644 --- a/extensions/smallrye-metrics/deployment/pom.xml +++ b/extensions/smallrye-metrics/deployment/pom.xml @@ -26,29 +26,29 @@ 4.0.0 - quarkus-smallrye-metrics + quarkus-smallrye-metrics-deployment Quarkus - SmallRye Metrics - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-undertow + quarkus-undertow-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-jsonp + quarkus-jsonp-deployment io.quarkus - quarkus-smallrye-metrics-runtime + quarkus-smallrye-metrics diff --git a/extensions/smallrye-metrics/runtime/pom.xml b/extensions/smallrye-metrics/runtime/pom.xml index d0e4934a74e49..995c79f15b4dd 100644 --- a/extensions/smallrye-metrics/runtime/pom.xml +++ b/extensions/smallrye-metrics/runtime/pom.xml @@ -26,7 +26,7 @@ 4.0.0 - quarkus-smallrye-metrics-runtime + quarkus-smallrye-metrics Quarkus - SmallRye Metrics - Runtime @@ -37,19 +37,19 @@ io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus - quarkus-undertow-runtime + quarkus-undertow io.quarkus - quarkus-arc-runtime + quarkus-arc io.quarkus - quarkus-jsonp-runtime + quarkus-jsonp org.jboss.spec.javax.servlet @@ -60,7 +60,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/smallrye-openapi/deployment/pom.xml b/extensions/smallrye-openapi/deployment/pom.xml index 9de6acb068078..5baee6bd18059 100644 --- a/extensions/smallrye-openapi/deployment/pom.xml +++ b/extensions/smallrye-openapi/deployment/pom.xml @@ -26,29 +26,29 @@ 4.0.0 - quarkus-smallrye-openapi + quarkus-smallrye-openapi-deployment Quarkus - SmallRye OpenAPI - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-undertow + quarkus-undertow-deployment io.quarkus - quarkus-resteasy + quarkus-resteasy-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-smallrye-openapi-runtime + quarkus-smallrye-openapi diff --git a/extensions/smallrye-openapi/runtime/pom.xml b/extensions/smallrye-openapi/runtime/pom.xml index 061741ca407ea..02efb72c6bca1 100644 --- a/extensions/smallrye-openapi/runtime/pom.xml +++ b/extensions/smallrye-openapi/runtime/pom.xml @@ -26,7 +26,7 @@ 4.0.0 - quarkus-smallrye-openapi-runtime + quarkus-smallrye-openapi Quarkus - SmallRye OpenAPI - Runtime @@ -46,15 +46,15 @@ io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus - quarkus-undertow-runtime + quarkus-undertow io.quarkus - quarkus-arc-runtime + quarkus-arc com.fasterxml.jackson.core @@ -65,7 +65,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/smallrye-opentracing/deployment/pom.xml b/extensions/smallrye-opentracing/deployment/pom.xml index 2eb46716179c9..55634bcc7eaa9 100644 --- a/extensions/smallrye-opentracing/deployment/pom.xml +++ b/extensions/smallrye-opentracing/deployment/pom.xml @@ -26,37 +26,37 @@ 4.0.0 - quarkus-smallrye-opentracing + quarkus-smallrye-opentracing-deployment Quarkus - SmallRye OpenTracing - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-resteasy + quarkus-resteasy-deployment io.quarkus - quarkus-undertow + quarkus-undertow-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-smallrye-opentracing-runtime + quarkus-smallrye-opentracing io.quarkus - quarkus-jaeger + quarkus-jaeger-deployment io.quarkus - quarkus-jsonp + quarkus-jsonp-deployment diff --git a/extensions/smallrye-opentracing/runtime/pom.xml b/extensions/smallrye-opentracing/runtime/pom.xml index e97483c653424..00eadd8a40e7a 100644 --- a/extensions/smallrye-opentracing/runtime/pom.xml +++ b/extensions/smallrye-opentracing/runtime/pom.xml @@ -26,7 +26,7 @@ 4.0.0 - quarkus-smallrye-opentracing-runtime + quarkus-smallrye-opentracing Quarkus - SmallRye OpenTracing - Runtime @@ -44,27 +44,23 @@ io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus - quarkus-undertow-runtime + quarkus-jaeger io.quarkus - quarkus-jsonp-runtime + quarkus-undertow - org.jboss.spec.javax.servlet - jboss-servlet-api_4.0_spec - - - io.jaegertracing - jaeger-core + io.quarkus + quarkus-jsonp - io.jaegertracing - jaeger-thrift + org.jboss.spec.javax.servlet + jboss-servlet-api_4.0_spec com.oracle.substratevm @@ -80,7 +76,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/smallrye-reactive-messaging-kafka/deployment/pom.xml b/extensions/smallrye-reactive-messaging-kafka/deployment/pom.xml index 0460927c956a9..b0198fa759bf1 100644 --- a/extensions/smallrye-reactive-messaging-kafka/deployment/pom.xml +++ b/extensions/smallrye-reactive-messaging-kafka/deployment/pom.xml @@ -10,29 +10,29 @@ 999-SNAPSHOT - quarkus-smallrye-reactive-messaging-kafka + quarkus-smallrye-reactive-messaging-kafka-deployment Quarkus - SmallRye Reactive Messaging - Kafka - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-smallrye-reactive-messaging + quarkus-smallrye-reactive-messaging-deployment io.quarkus - quarkus-kafka-client + quarkus-kafka-client-deployment io.quarkus - quarkus-smallrye-reactive-messaging-kafka-runtime + quarkus-smallrye-reactive-messaging-kafka io.quarkus - quarkus-vertx + quarkus-vertx-deployment diff --git a/extensions/smallrye-reactive-messaging-kafka/runtime/pom.xml b/extensions/smallrye-reactive-messaging-kafka/runtime/pom.xml index 81fad82ee3250..4ecccf31907e8 100644 --- a/extensions/smallrye-reactive-messaging-kafka/runtime/pom.xml +++ b/extensions/smallrye-reactive-messaging-kafka/runtime/pom.xml @@ -10,13 +10,13 @@ 999-SNAPSHOT - quarkus-smallrye-reactive-messaging-kafka-runtime + quarkus-smallrye-reactive-messaging-kafka Quarkus - SmallRye Reactive Messaging - Kafka - Runtime io.quarkus - quarkus-kafka-client-runtime + quarkus-kafka-client io.smallrye.reactive @@ -34,7 +34,7 @@ io.quarkus - quarkus-smallrye-reactive-streams-operators-runtime + quarkus-smallrye-reactive-streams-operators io.smallrye.reactive @@ -56,7 +56,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/smallrye-reactive-messaging/deployment/pom.xml b/extensions/smallrye-reactive-messaging/deployment/pom.xml index 3a1aaa02d9ad5..89aa3f6d34ed8 100644 --- a/extensions/smallrye-reactive-messaging/deployment/pom.xml +++ b/extensions/smallrye-reactive-messaging/deployment/pom.xml @@ -11,32 +11,32 @@ 4.0.0 - quarkus-smallrye-reactive-messaging + quarkus-smallrye-reactive-messaging-deployment Quarkus - SmallRye Reactive Messaging - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-smallrye-reactive-messaging-runtime + quarkus-smallrye-reactive-messaging io.quarkus quarkus-smallrye-reactive-streams-operators - + io.quarkus quarkus-junit5-internal - + diff --git a/extensions/smallrye-reactive-messaging/runtime/pom.xml b/extensions/smallrye-reactive-messaging/runtime/pom.xml index 690fa3eacc105..77dccc20cc1c1 100644 --- a/extensions/smallrye-reactive-messaging/runtime/pom.xml +++ b/extensions/smallrye-reactive-messaging/runtime/pom.xml @@ -10,17 +10,17 @@ 4.0.0 - quarkus-smallrye-reactive-messaging-runtime + quarkus-smallrye-reactive-messaging Quarkus - SmallRye Reactive Messaging - Runtime io.quarkus - quarkus-arc-runtime + quarkus-arc io.quarkus - quarkus-smallrye-reactive-streams-operators-runtime + quarkus-smallrye-reactive-streams-operators io.smallrye.reactive @@ -37,7 +37,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/smallrye-rest-client/deployment/pom.xml b/extensions/smallrye-rest-client/deployment/pom.xml index afb330917e2fe..fcd85451133d5 100644 --- a/extensions/smallrye-rest-client/deployment/pom.xml +++ b/extensions/smallrye-rest-client/deployment/pom.xml @@ -26,25 +26,25 @@ 4.0.0 - quarkus-smallrye-rest-client + quarkus-smallrye-rest-client-deployment Quarkus - SmallRye REST client - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-resteasy-common + quarkus-resteasy-common-deployment io.quarkus - quarkus-smallrye-rest-client-runtime + quarkus-smallrye-rest-client diff --git a/extensions/smallrye-rest-client/runtime/pom.xml b/extensions/smallrye-rest-client/runtime/pom.xml index a893a4e0968ee..e171787c45d34 100644 --- a/extensions/smallrye-rest-client/runtime/pom.xml +++ b/extensions/smallrye-rest-client/runtime/pom.xml @@ -26,21 +26,21 @@ 4.0.0 - quarkus-smallrye-rest-client-runtime + quarkus-smallrye-rest-client Quarkus - SmallRye REST client - Runtime io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus - quarkus-arc-runtime + quarkus-arc io.quarkus - quarkus-resteasy-common-runtime + quarkus-resteasy-common io.smallrye @@ -63,7 +63,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/spring-di/deployment/pom.xml b/extensions/spring-di/deployment/pom.xml index 992e0f7000139..20272ee330106 100644 --- a/extensions/spring-di/deployment/pom.xml +++ b/extensions/spring-di/deployment/pom.xml @@ -26,17 +26,21 @@ 4.0.0 - quarkus-spring-di + quarkus-spring-di-deployment Quarkus - Spring - DI - Deployment + + ${project.groupId} + quarkus-spring-di + io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment diff --git a/extensions/spring-di/pom.xml b/extensions/spring-di/pom.xml index 47914d25d8cce..c6e31733373a8 100644 --- a/extensions/spring-di/pom.xml +++ b/extensions/spring-di/pom.xml @@ -31,5 +31,6 @@ pom deployment + runtime diff --git a/extensions/spring-di/runtime/pom.xml b/extensions/spring-di/runtime/pom.xml new file mode 100644 index 0000000000000..8803583198044 --- /dev/null +++ b/extensions/spring-di/runtime/pom.xml @@ -0,0 +1,40 @@ + + + + + quarkus-spring-di-parent + io.quarkus + 999-SNAPSHOT + ../ + + + 4.0.0 + + quarkus-spring-di + Quarkus - Spring - DI - Runtime + + + + + io.quarkus.bootstrap + bootstrap-maven-plugin + + + + diff --git a/extensions/undertow-websockets/deployment/pom.xml b/extensions/undertow-websockets/deployment/pom.xml index 5d07985164d57..2bd4c65fcbfb7 100644 --- a/extensions/undertow-websockets/deployment/pom.xml +++ b/extensions/undertow-websockets/deployment/pom.xml @@ -26,21 +26,21 @@ 4.0.0 - quarkus-undertow-websockets + quarkus-undertow-websockets-deployment Quarkus - Undertow - WebSockets - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-undertow + quarkus-undertow-deployment io.quarkus - quarkus-undertow-websockets-runtime + quarkus-undertow-websockets diff --git a/extensions/undertow-websockets/runtime/pom.xml b/extensions/undertow-websockets/runtime/pom.xml index 155b7085e728a..c017089c65aac 100644 --- a/extensions/undertow-websockets/runtime/pom.xml +++ b/extensions/undertow-websockets/runtime/pom.xml @@ -26,7 +26,7 @@ 4.0.0 - quarkus-undertow-websockets-runtime + quarkus-undertow-websockets Quarkus - Undertow - WebSockets - Runtime @@ -36,11 +36,11 @@ io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus - quarkus-undertow-runtime + quarkus-undertow io.undertow @@ -51,7 +51,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/undertow/deployment/pom.xml b/extensions/undertow/deployment/pom.xml index 3b471e645d26f..8687f50c40db5 100644 --- a/extensions/undertow/deployment/pom.xml +++ b/extensions/undertow/deployment/pom.xml @@ -25,7 +25,7 @@ 4.0.0 - quarkus-undertow + quarkus-undertow-deployment Quarkus - Undertow - Deployment @@ -35,15 +35,15 @@ io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-undertow-runtime + quarkus-undertow org.jboss.metadata diff --git a/extensions/undertow/runtime/pom.xml b/extensions/undertow/runtime/pom.xml index b5da9cc8a6ce0..cab77d88aec1f 100644 --- a/extensions/undertow/runtime/pom.xml +++ b/extensions/undertow/runtime/pom.xml @@ -25,13 +25,13 @@ 4.0.0 - quarkus-undertow-runtime + quarkus-undertow Quarkus - Undertow - Runtime io.quarkus - quarkus-arc-runtime + quarkus-arc com.oracle.substratevm @@ -51,14 +51,15 @@ io.quarkus - quarkus-core-runtime + quarkus-core - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/vertx-web/deployment/pom.xml b/extensions/vertx-web/deployment/pom.xml index 05428bc513d18..1e13046ca2738 100644 --- a/extensions/vertx-web/deployment/pom.xml +++ b/extensions/vertx-web/deployment/pom.xml @@ -26,17 +26,17 @@ 4.0.0 - quarkus-vertx-web + quarkus-vertx-web-deployment Quarkus - Vert.x Web - Deployment io.quarkus - quarkus-vertx + quarkus-vertx-deployment io.quarkus - quarkus-vertx-web-runtime + quarkus-vertx-web @@ -51,9 +51,6 @@ - - maven-dependency-plugin - maven-compiler-plugin diff --git a/extensions/vertx-web/runtime/pom.xml b/extensions/vertx-web/runtime/pom.xml index 219402364c85d..2cd2529ee4012 100644 --- a/extensions/vertx-web/runtime/pom.xml +++ b/extensions/vertx-web/runtime/pom.xml @@ -26,17 +26,17 @@ 4.0.0 - quarkus-vertx-web-runtime + quarkus-vertx-web Quarkus - Vert.x Web - Runtime io.quarkus - quarkus-core-runtime + quarkus-core io.quarkus - quarkus-vertx-runtime + quarkus-vertx io.vertx @@ -58,7 +58,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/extensions/vertx/deployment/pom.xml b/extensions/vertx/deployment/pom.xml index 285b92aa9cc41..6e12165291cde 100644 --- a/extensions/vertx/deployment/pom.xml +++ b/extensions/vertx/deployment/pom.xml @@ -26,27 +26,27 @@ 4.0.0 - quarkus-vertx + quarkus-vertx-deployment Quarkus - Vert.x - Deployment io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-netty + quarkus-netty-deployment io.quarkus - quarkus-vertx-runtime + quarkus-vertx - + io.quarkus quarkus-junit5-internal diff --git a/extensions/vertx/runtime/pom.xml b/extensions/vertx/runtime/pom.xml index 29506685f6199..e99a0bf8afc4f 100644 --- a/extensions/vertx/runtime/pom.xml +++ b/extensions/vertx/runtime/pom.xml @@ -26,13 +26,13 @@ 4.0.0 - quarkus-vertx-runtime + quarkus-vertx Quarkus - Vert.x - Runtime io.quarkus - quarkus-core-runtime + quarkus-core org.jboss.spec.javax.ws.rs @@ -41,11 +41,11 @@ io.quarkus - quarkus-arc-runtime + quarkus-arc io.quarkus - quarkus-netty-runtime + quarkus-netty io.smallrye.reactive @@ -80,7 +80,8 @@ - maven-dependency-plugin + io.quarkus.bootstrap + bootstrap-maven-plugin maven-compiler-plugin diff --git a/independent-projects/arc/pom.xml b/independent-projects/arc/pom.xml index 33e4f00b139cd..0fbaf879f9e2d 100644 --- a/independent-projects/arc/pom.xml +++ b/independent-projects/arc/pom.xml @@ -73,7 +73,7 @@ io.quarkus.arc - arc-runtime + arc ${project.version} diff --git a/independent-projects/arc/processor/pom.xml b/independent-projects/arc/processor/pom.xml index 9b1a0f5c2259a..698eda8656ae8 100644 --- a/independent-projects/arc/processor/pom.xml +++ b/independent-projects/arc/processor/pom.xml @@ -33,7 +33,7 @@ io.quarkus.arc - arc-runtime + arc diff --git a/independent-projects/arc/runtime/pom.xml b/independent-projects/arc/runtime/pom.xml index c7ff118619f90..3a4aa7e75cf1a 100644 --- a/independent-projects/arc/runtime/pom.xml +++ b/independent-projects/arc/runtime/pom.xml @@ -26,7 +26,7 @@ ../ - arc-runtime + arc ArC - Runtime diff --git a/independent-projects/arc/tests/pom.xml b/independent-projects/arc/tests/pom.xml index b128bc1526820..5b7643111b595 100644 --- a/independent-projects/arc/tests/pom.xml +++ b/independent-projects/arc/tests/pom.xml @@ -37,7 +37,7 @@ io.quarkus.arc - arc-runtime + arc @@ -57,7 +57,6 @@ - diff --git a/independent-projects/bootstrap/core/pom.xml b/independent-projects/bootstrap/core/pom.xml new file mode 100644 index 0000000000000..04516eadd6038 --- /dev/null +++ b/independent-projects/bootstrap/core/pom.xml @@ -0,0 +1,65 @@ + + + + + + bootstrap-parent + io.quarkus.bootstrap + 999-SNAPSHOT + ../pom.xml + + 4.0.0 + + bootstrap-core + Quarkus Bootstrap Core + + + + 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-file + + + org.apache.maven.resolver + maven-resolver-transport-http + + + org.jboss.logging + jboss-logging + + + + junit + junit + test + + + + diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapClassLoaderFactory.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapClassLoaderFactory.java new file mode 100644 index 0000000000000..33ad7014731a1 --- /dev/null +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapClassLoaderFactory.java @@ -0,0 +1,242 @@ +/* + * Copyright 2019 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.jboss.logging.Logger; + +import io.quarkus.bootstrap.model.AppDependency; +import io.quarkus.bootstrap.model.AppModel; +import io.quarkus.bootstrap.resolver.AppModelResolverException; +import io.quarkus.bootstrap.resolver.BootstrapAppModelResolver; +import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver; +import io.quarkus.bootstrap.resolver.maven.workspace.LocalProject; +import io.quarkus.bootstrap.util.PropertyUtils; + +/** + * + * @author Alexey Loubyansky + */ +public class BootstrapClassLoaderFactory { + + private static final String DOT_QUARKUS = ".quarkus"; + private static final String BOOTSTRAP = "bootstrap"; + private static final String DEPLOYMENT_CP = "deployment.cp"; + + public static final String PROP_CP_CACHE = "quarkus-cp-cache"; + public static final String PROP_PROJECT_DISCOVERY = "quarkus-project-discovery"; + public static final String PROP_OFFLINE = "quarkus-bootstrap-offline"; + + private static final Logger log = Logger.getLogger(BootstrapClassLoaderFactory.class); + + public static BootstrapClassLoaderFactory newInstance() { + return new BootstrapClassLoaderFactory(); + } + + public static URLClassLoader newClassLoader(ClassLoader parent, List deps, List extraPaths) { + final URL[] urls = new URL[deps.size() + extraPaths.size()]; + try { + int i = 0; + while (i < deps.size()) { + urls[i] = deps.get(i).getArtifact().getPath().toUri().toURL(); + ++i; + } + for(Path p : extraPaths) { + if(p == null) { + continue; + } + urls[i++] = p.toUri().toURL(); + } + return new URLClassLoader(i != urls.length ? Arrays.copyOf(urls, i) : urls, parent); + } catch (MalformedURLException e) { + throw new IllegalStateException("Failed to create a URL", e); + } + } + + private static Path resolveCachedCpPath(LocalProject project) { + return Paths.get(PropertyUtils.getUserHome()) + .resolve(DOT_QUARKUS) + .resolve(BOOTSTRAP) + .resolve(project.getGroupId()) + .resolve(project.getArtifactId()) + .resolve(project.getVersion()) + .resolve(DEPLOYMENT_CP); + } + + private ClassLoader parent; + private Path appClasses; + private List appCp = new ArrayList<>(1); + private boolean localProjectsDiscovery; + private boolean offline = true; + private boolean enableClasspathCache; + + private BootstrapClassLoaderFactory() { + } + + public BootstrapClassLoaderFactory setParent(ClassLoader parent) { + this.parent = parent; + return this; + } + + public BootstrapClassLoaderFactory setAppClasses(Path appClasses) { + this.appClasses = appClasses; + addToClassPath(appClasses); + return this; + } + + public BootstrapClassLoaderFactory addToClassPath(Path path) { + this.appCp.add(path); + return this; + } + + public BootstrapClassLoaderFactory setLocalProjectsDiscovery(boolean localProjectsDiscovery) { + this.localProjectsDiscovery = localProjectsDiscovery; + return this; + } + + public BootstrapClassLoaderFactory setOffline(boolean offline) { + this.offline = offline; + return this; + } + + public BootstrapClassLoaderFactory setClasspathCache(boolean enable) { + this.enableClasspathCache = enable; + return this; + } + + /** + * WARNING: this method is creating a classloader by resolving all the dependencies on every call, + * without consulting the cache. + * + * @param hierarchical whether the deployment classloader should use the classloader built using + * the user-defined application dependencies as its parent or all the dependencies should be loaded + * by the same classloader + * @return classloader that is able to load both user-defined and deployment dependencies + * @throws BootstrapException in case of a failure + */ + public URLClassLoader newAllInclusiveClassLoader(boolean hierarchical) throws BootstrapException { + if (appClasses == null) { + throw new IllegalArgumentException("Application classes path has not been set"); + } + try { + final MavenArtifactResolver.Builder mvnBuilder = MavenArtifactResolver.builder().setOffline(offline); + final LocalProject localProject; + if (localProjectsDiscovery) { + localProject = LocalProject.resolveLocalProjectWithWorkspace(LocalProject.locateCurrentProjectDir(appClasses)); + mvnBuilder.setWorkspace(localProject.getWorkspace()); + } else { + localProject = LocalProject.resolveLocalProject(LocalProject.locateCurrentProjectDir(appClasses)); + } + final AppModel appModel = new BootstrapAppModelResolver(mvnBuilder.build()).resolveModel(localProject.getAppArtifact()); + if (hierarchical) { + final URLClassLoader cl = newClassLoader(parent, appModel.getUserDependencies(), appCp); + try { + return newClassLoader(cl, appModel.getDeploymentDependencies(), Collections.emptyList()); + } catch (Throwable e) { + try { + cl.close(); + } catch (IOException e1) { + e1.printStackTrace(); + } + throw e; + } + } + return newClassLoader(parent, appModel.getAllDependencies(), appCp); + } catch (AppModelResolverException e) { + throw new BootstrapException("Failed to init application classloader", e); + } + } + + public URLClassLoader newDeploymentClassLoader() throws BootstrapException { + if (appClasses == null) { + throw new IllegalArgumentException("Application classes path has not been set"); + } + final URLClassLoader ucl; + Path cachedCpPath = null; + long lastUpdated = 0; + final LocalProject localProject = localProjectsDiscovery || enableClasspathCache + ? LocalProject.resolveLocalProjectWithWorkspace(LocalProject.locateCurrentProjectDir(appClasses)) + : LocalProject.resolveLocalProject(LocalProject.locateCurrentProjectDir(appClasses)); + try { + if (enableClasspathCache) { + lastUpdated = localProject.getWorkspace().getLastModified(); + cachedCpPath = resolveCachedCpPath(localProject); + if (Files.exists(cachedCpPath)) { + try (BufferedReader reader = Files.newBufferedReader(cachedCpPath)) { + String line = reader.readLine(); + if (Long.valueOf(line) == lastUpdated) { + line = reader.readLine(); + final List urls = new ArrayList<>(); + while (line != null) { + urls.add(new URL(line)); + line = reader.readLine(); + } + debug("Deployment classloader was re-created from cache for %s", localProject.getAppArtifact()); + return new URLClassLoader(urls.toArray(new URL[urls.size()]), parent); + } else { + debug("Cached deployment classloader has expired for %s", localProject.getAppArtifact()); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + final MavenArtifactResolver.Builder mvn = MavenArtifactResolver.builder() + .setOffline(offline) + .setWorkspace(localProject.getWorkspace()); + ucl = newClassLoader(parent, new BootstrapAppModelResolver(mvn.build()).resolveModel(localProject.getAppArtifact()).getDeploymentDependencies(), Collections.emptyList()); + } catch (AppModelResolverException e) { + throw new BootstrapException("Failed to init application classloader", e); + } + if(cachedCpPath != null) { + try { + Files.createDirectories(cachedCpPath.getParent()); + try(BufferedWriter writer = Files.newBufferedWriter(cachedCpPath)) { + writer.write(Long.toString(lastUpdated)); + writer.newLine(); + for(URL url : ucl.getURLs()) { + writer.write(url.toExternalForm()); + writer.newLine(); + } + } + debug("Deployment classloader cached for ", localProject.getAppArtifact()); + } catch (IOException e) { + e.printStackTrace(); + } + } + return ucl; + } + + private static void debug(String msg, Object... args) { + if(log.isDebugEnabled()) { + log.debug(String.format(msg, args)); + } + } +} 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 new file mode 100644 index 0000000000000..755a807e7bd91 --- /dev/null +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapConstants.java @@ -0,0 +1,34 @@ +/* + * Copyright 2019 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap; + +/** + * + * @author Alexey Loubyansky + */ +public interface BootstrapConstants { + + String DEPLOYMENT_DEPENDENCY_GRAPH = "quarkus-deployment-dependency.graph"; + + String DESCRIPTOR_FILE_NAME = "quarkus-extension.properties"; + + String DESCRIPTOR_PATH = DESCRIPTOR_FILE_NAME; + + String QUARKUS = "quarqus"; + + String PROP_DEPLOYMENT_ARTIFACT = "deployment-artifact"; +} diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapDependencyProcessingException.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapDependencyProcessingException.java new file mode 100644 index 0000000000000..a6768e050bf9e --- /dev/null +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapDependencyProcessingException.java @@ -0,0 +1,37 @@ +/* + * Copyright 2019 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap; + +/** + * + * @author Alexey Loubyansky + */ +public class BootstrapDependencyProcessingException extends BootstrapException { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public BootstrapDependencyProcessingException(String message, Throwable cause) { + super(message, cause); + } + + public BootstrapDependencyProcessingException(String message) { + super(message); + } +} diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapException.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapException.java new file mode 100644 index 0000000000000..a7b7500d3e163 --- /dev/null +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapException.java @@ -0,0 +1,37 @@ +/* + * Copyright 2019 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap; + +/** + * + * @author Alexey Loubyansky + */ +public class BootstrapException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public BootstrapException(String message, Throwable cause) { + super(message, cause); + } + + public BootstrapException(String message) { + super(message); + } +} diff --git a/core/creator/src/main/java/io/quarkus/creator/resolver/aether/DisabledDependencySelector.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppArtifact.java similarity index 51% rename from core/creator/src/main/java/io/quarkus/creator/resolver/aether/DisabledDependencySelector.java rename to independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppArtifact.java index e4308617bbc2d..765a22e78c2a0 100644 --- a/core/creator/src/main/java/io/quarkus/creator/resolver/aether/DisabledDependencySelector.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppArtifact.java @@ -14,27 +14,37 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.quarkus.creator.resolver.aether; -import org.eclipse.aether.collection.DependencyCollectionContext; -import org.eclipse.aether.collection.DependencySelector; -import org.eclipse.aether.graph.Dependency; +package io.quarkus.bootstrap.model; + +import java.nio.file.Path; /** + * Represents an application (or its dependency) artifact. * * @author Alexey Loubyansky */ -class DisabledDependencySelector implements DependencySelector { +public class AppArtifact extends AppArtifactCoords { + + protected Path path; + + public AppArtifact(String groupId, String artifactId, String version) { + super(groupId, artifactId, version); + } - static DisabledDependencySelector INSTANCE = new DisabledDependencySelector(); + public AppArtifact(String groupId, String artifactId, String classifier, String type, String version) { + super(groupId, artifactId, classifier, type, version); + } + + public Path getPath() { + return path; + } - @Override - public boolean selectDependency(Dependency dependency) { - return false; + public void setPath(Path path) { + this.path = path; } - @Override - public DependencySelector deriveChildSelector(DependencyCollectionContext context) { - return this; + public boolean isResolved() { + return path != null; } -} \ No newline at end of file +} diff --git a/core/creator/src/main/java/io/quarkus/creator/AppArtifact.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppArtifactCoords.java similarity index 56% rename from core/creator/src/main/java/io/quarkus/creator/AppArtifact.java rename to independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppArtifactCoords.java index 33515816eb9e0..41b07e33dd239 100644 --- a/core/creator/src/main/java/io/quarkus/creator/AppArtifact.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppArtifactCoords.java @@ -1,6 +1,5 @@ /* - * Copyright 2018 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. + * Copyright 2019 Red Hat, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,39 +14,60 @@ * limitations under the License. */ -package io.quarkus.creator; - -import java.nio.file.Path; +package io.quarkus.bootstrap.model; /** - * Represents an application (or its dependency) artifact. + * GroupId, artifactId, classifier, type, version * * @author Alexey Loubyansky */ -public class AppArtifact { +public class AppArtifactCoords { + + public static final String TYPE_JAR = "jar"; + public static final String TYPE_POM = "pom"; - private static final String CLASSIFIER_NONE = ""; - private static final String TYPE_JAR = "jar"; + public static AppArtifactCoords fromString(String str) { + return new AppArtifactCoords(split(str, new String[5])); + } + + protected static String[] split(String str, String[] parts) { + final int versionSep = str.lastIndexOf(':'); + if(versionSep <= 0 || versionSep == str.length() - 1) { + throw new IllegalArgumentException("One of type, version or separating them ':' is missing from '" + str + "'"); + } + parts[4] = str.substring(versionSep + 1); + AppArtifactKey.split(str, parts, versionSep); + return parts; + } protected final String groupId; protected final String artifactId; protected final String classifier; protected final String type; protected final String version; - protected Path path; - public AppArtifact(String groupId, String artifactId, String version) { - this(groupId, artifactId, CLASSIFIER_NONE, TYPE_JAR, version); + protected AppArtifactKey key; + + protected AppArtifactCoords(String[] parts) { + groupId = parts[0]; + artifactId = parts[1]; + classifier = parts[2]; + type = parts[3] == null ? TYPE_JAR : parts[3]; + version = parts[4]; + } + + public AppArtifactCoords(String groupId, String artifactId, String version) { + this(groupId, artifactId, "", TYPE_JAR, version); } - public AppArtifact(String groupId, String artifactId, String classifier, String version) { - this(groupId, artifactId, classifier, TYPE_JAR, version); + public AppArtifactCoords(String groupId, String artifactId, String type, String version) { + this(groupId, artifactId, "", type, version); } - public AppArtifact(String groupId, String artifactId, String classifier, String type, String version) { + public AppArtifactCoords(String groupId, String artifactId, String classifier, String type, String version) { this.groupId = groupId; this.artifactId = artifactId; - this.classifier = classifier == null ? CLASSIFIER_NONE : classifier; + this.classifier = classifier; this.type = type; this.version = version; } @@ -64,10 +84,6 @@ public String getClassifier() { return classifier; } - public boolean hasClassifier() { - return !classifier.isEmpty(); - } - public String getType() { return type; } @@ -76,16 +92,8 @@ public String getVersion() { return version; } - public Path getPath() { - return path; - } - - protected void setPath(Path path) { - this.path = path; - } - - public boolean isResolved() { - return path != null; + public AppArtifactKey getKey() { + return key == null ? key = new AppArtifactKey(groupId, artifactId, classifier, type) : key; } @Override @@ -108,7 +116,7 @@ public boolean equals(Object obj) { return false; if (getClass() != obj.getClass()) return false; - AppArtifact other = (AppArtifact) obj; + AppArtifactCoords other = (AppArtifactCoords) obj; if (artifactId == null) { if (other.artifactId != null) return false; @@ -139,9 +147,25 @@ public boolean equals(Object obj) { @Override public String toString() { - final StringBuilder buf = new StringBuilder(128); - buf.append(groupId).append(':').append(artifactId).append(':').append(classifier).append(':').append(type).append(':') - .append(version); + final StringBuilder buf = new StringBuilder(); + append(buf); return buf.toString(); } + + protected StringBuilder append(final StringBuilder buf) { + buf.append(groupId).append(':').append(artifactId).append(':'); + if(!classifier.isEmpty()) { + buf.append(classifier); + } + return buf.append(':').append(type).append(':').append(version); + } + + public static void main(String[] args) { + AppArtifactCoords ga = fromString("g:a:v"); + System.out.println(ga.getGroupId()); + System.out.println(ga.getArtifactId()); + System.out.println("'" + ga.getClassifier() + "'"); + System.out.println(ga.getType()); + System.out.println(ga.getVersion()); + } } diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppArtifactKey.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppArtifactKey.java new file mode 100644 index 0000000000000..22bb465f6b464 --- /dev/null +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppArtifactKey.java @@ -0,0 +1,188 @@ +/* + * Copyright 2019 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap.model; + +/** + * GroupId, artifactId and classifier + * + * @author Alexey Loubyansky + */ +public class AppArtifactKey { + + public static AppArtifactKey fromString(String str) { + return new AppArtifactKey(split(str, new String[4], str.length())); + } + + protected static String[] split(String str, String[] parts, int fromIndex) { + int i = str.lastIndexOf(':', fromIndex - 1); + if(i <= 0) { + throw new IllegalArgumentException("GroupId and artifactId separating ':' is abscent or not in the right place in '" + str.substring(0, fromIndex) + "'"); + } + parts[3] = str.substring(i + 1, fromIndex); + fromIndex = i; + i = str.lastIndexOf(':', fromIndex - 1); + if(i < 0) { + parts[0] = str.substring(0, fromIndex); + if((parts[1] = parts[3]).isEmpty()) { + throw new IllegalArgumentException("ArtifactId is empty in `" + str + "`"); + } + parts[2] = ""; + parts[3] = null; + return parts; + } + if(i == 0) { + throw new IllegalArgumentException("One of groupId or artifactId is missing from '" + str.substring(0, fromIndex) + "'"); + } + if(i == fromIndex - 1) { + parts[2] = ""; + } else { + parts[2] = str.substring(i + 1, fromIndex); + } + + fromIndex = i; + i = str.lastIndexOf(':', fromIndex - 1); + if(i < 0) { + parts[0] = str.substring(0, fromIndex); + if((parts[1] = parts[2]).isEmpty()) { + throw new IllegalArgumentException("ArtifactId is empty in `" + str + "`"); + } + parts[2] = parts[3]; + parts[3] = null; + return parts; + } + if(i == 0 || i == fromIndex - 1) { + throw new IllegalArgumentException("One of groupId or artifactId is missing from '" + str.substring(0, fromIndex) + "'"); + } + + parts[0] = str.substring(0, i); + parts[1] = str.substring(i + 1, fromIndex); + if(parts[3].isEmpty()) { + parts[3] = null; + } + return parts; + } + + protected final String groupId; + protected final String artifactId; + protected final String classifier; + protected final String type; + + protected AppArtifactKey(String[] parts) { + this.groupId = parts[0]; + this.artifactId = parts[1]; + this.classifier = parts[2]; + this.type = parts[3]; + } + + public AppArtifactKey(String groupId, String artifactId) { + this(groupId, artifactId, null); + } + + public AppArtifactKey(String groupId, String artifactId, String classifier) { + this(groupId, artifactId, classifier, null); + } + + public AppArtifactKey(String groupId, String artifactId, String classifier, String type) { + this.groupId = groupId; + this.artifactId = artifactId; + this.classifier = classifier == null ? "" : classifier; + this.type = type; + } + + public String getGroupId() { + return groupId; + } + + public String getArtifactId() { + return artifactId; + } + + public String getClassifier() { + return classifier; + } + + + public String getType() { + return type; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((artifactId == null) ? 0 : artifactId.hashCode()); + result = prime * result + ((classifier == null) ? 0 : classifier.hashCode()); + result = prime * result + ((groupId == null) ? 0 : groupId.hashCode()); + result = prime * result + ((type == null) ? 0 : type.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + AppArtifactKey other = (AppArtifactKey) obj; + if (artifactId == null) { + if (other.artifactId != null) + return false; + } else if (!artifactId.equals(other.artifactId)) + return false; + if (classifier == null) { + if (other.classifier != null) + return false; + } else if (!classifier.equals(other.classifier)) + return false; + if (groupId == null) { + if (other.groupId != null) + return false; + } else if (!groupId.equals(other.groupId)) + return false; + if (type == null) { + if (other.type != null) + return false; + } else if (!type.equals(other.type)) + return false; + return true; + } + + @Override + public String toString() { + final StringBuilder buf = new StringBuilder(); + buf.append(groupId).append(':').append(artifactId); + if(!classifier.isEmpty()) { + buf.append(':').append(classifier); + } else if(type != null) { + buf.append(':'); + } + if(type != null) { + buf.append(':').append(type); + } + return buf.toString(); + } + + public static void main(String[] args) { + AppArtifactKey ga = fromString("g:a:c:t"); + System.out.println(ga.getGroupId()); + System.out.println(ga.getArtifactId()); + System.out.println("'" + ga.getClassifier() + "'"); + System.out.println(ga.getType()); + } +} diff --git a/core/creator/src/main/java/io/quarkus/creator/AppDependency.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppDependency.java similarity index 76% rename from core/creator/src/main/java/io/quarkus/creator/AppDependency.java rename to independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppDependency.java index 97c52d76cbb5d..22ec46c339009 100644 --- a/core/creator/src/main/java/io/quarkus/creator/AppDependency.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppDependency.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.quarkus.creator; +package io.quarkus.bootstrap.model; /** * Represents an application artifact dependency. @@ -26,10 +26,16 @@ public class AppDependency { private final AppArtifact artifact; private final String scope; + private final boolean optional; public AppDependency(AppArtifact artifact, String scope) { + this(artifact, scope, false); + } + + public AppDependency(AppArtifact artifact, String scope, boolean optional) { this.artifact = artifact; this.scope = scope; + this.optional = optional; } public AppArtifact getArtifact() { @@ -40,11 +46,16 @@ public String getScope() { return scope; } + public boolean isOptional() { + return optional; + } + @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((artifact == null) ? 0 : artifact.hashCode()); + result = prime * result + (optional ? 1231 : 1237); result = prime * result + ((scope == null) ? 0 : scope.hashCode()); return result; } @@ -63,6 +74,8 @@ public boolean equals(Object obj) { return false; } else if (!artifact.equals(other.artifact)) return false; + if (optional != other.optional) + return false; if (scope == null) { if (other.scope != null) return false; @@ -73,6 +86,11 @@ public boolean equals(Object obj) { @Override public String toString() { - return artifact.toString() + '(' + scope + ')'; + final StringBuilder buf = new StringBuilder(); + artifact.append(buf).append('(').append(scope); + if(optional) { + buf.append(" optional"); + } + return buf.append(')').toString(); } } diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppModel.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppModel.java new file mode 100644 index 0000000000000..58f6c3f5f9f0a --- /dev/null +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/model/AppModel.java @@ -0,0 +1,61 @@ +/* + * Copyright 2019 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap.model; + +import java.util.ArrayList; +import java.util.List; + +import io.quarkus.bootstrap.BootstrapDependencyProcessingException; + +/** + * + * @author Alexey Loubyansky + */ +public class AppModel { + + private final AppArtifact appArtifact; + private final List deploymentDeps; + private final List userDeps; + private List allDeps; + + public AppModel(AppArtifact appArtifact, List userDeps, List deploymentDeps) { + this.appArtifact = appArtifact; + this.userDeps = userDeps; + this.deploymentDeps = deploymentDeps; + } + + public List getAllDependencies() throws BootstrapDependencyProcessingException { + if(allDeps == null) { + allDeps = new ArrayList<>(userDeps.size() + deploymentDeps.size()); + allDeps.addAll(userDeps); + allDeps.addAll(deploymentDeps); + } + return allDeps; + } + + public AppArtifact getAppArtifact() { + return appArtifact; + } + + public List getUserDependencies() throws BootstrapDependencyProcessingException { + return userDeps; + } + + public List getDeploymentDependencies() throws BootstrapDependencyProcessingException { + return deploymentDeps; + } +} diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/AppModelResolver.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/AppModelResolver.java new file mode 100644 index 0000000000000..807842b3ca8d8 --- /dev/null +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/AppModelResolver.java @@ -0,0 +1,104 @@ +/* + * Copyright 2018 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap.resolver; + +import java.nio.file.Path; +import java.util.List; + +import io.quarkus.bootstrap.model.AppArtifact; +import io.quarkus.bootstrap.model.AppDependency; +import io.quarkus.bootstrap.model.AppModel; + +/** + * Application model resolver used to resolve application and/or its dependency artifacts. + * + * @author Alexey Loubyansky + */ +public interface AppModelResolver { + + /** + * (Re-)links an artifact to a path. + * + * @param appArtifact an artifact to (re-)link to the path + * @param localPath local path to the artifact + * @throws AppModelResolverException in case of a failure + */ + void relink(AppArtifact appArtifact, Path localPath) throws AppModelResolverException; + + /** + * Resolves an artifact. + * + * @param artifact artifact to resolve + * @return local path + * @throws AppModelResolverException in case of a failure + */ + Path resolve(AppArtifact artifact) throws AppModelResolverException; + + /** + * Collect dependencies that are required at runtime, excluding test and optional depependencies. + * + * @param artifact + * @return + * @throws AppModelResolverException + */ + AppModel resolveModel(AppArtifact artifact) throws AppModelResolverException; + + /** + * Collects artifact dependencies merging the provided direct dependencies in + * + * @param root root artifact + * @param deps some or all of the direct dependencies that should be used in place of the original ones + * @return collected dependencies + * @throws AppModelResolverException in case of a failure + */ + AppModel resolveModel(AppArtifact root, List deps) throws AppModelResolverException; + + /** + * Lists versions released later than the version of the artifact up to the version + * specified or all the later versions in case the up-to-version is not provided. + * + * @param artifact artifact to list the versions for + * @return the list of versions released later than the version of the artifact + * @throws AppModelResolverException in case of a failure + */ + List listLaterVersions(AppArtifact artifact, String upToVersion, boolean inclusive) throws AppModelResolverException; + + /** + * Returns the next version for the artifact which is not later than the version specified. + * In case the next version is not available, the artifact's version is returned. + * + * @param artifact artifact + * @param upToVersion max version boundary + * @param inclusive whether the upToVersion should be included in the range or not + * @return the next version which is not later than the specified boundary + * @throws AppModelResolverException in case of a failure + */ + String getNextVersion(AppArtifact artifact, String upToVersion, boolean inclusive) throws AppModelResolverException; + + /** + * Returns the latest version for the artifact up to the version specified. + * In case there is no later version available, the artifact's version is returned. + * + * @param artifact artifact + * @param upToVersion max version boundary + * @param inclusive whether the upToVersion should be included in the range or not + * @return the latest version up to specified boundary + * @throws AppModelResolverException in case of a failure + */ + String getLatestVersion(AppArtifact artifact, String upToVersion, boolean inclusive) throws AppModelResolverException; +} diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/AppModelResolverException.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/AppModelResolverException.java new file mode 100644 index 0000000000000..d22d44c2cc39e --- /dev/null +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/AppModelResolverException.java @@ -0,0 +1,37 @@ +/* + * Copyright 2019 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap.resolver; + +/** + * + * @author Alexey Loubyansky + */ +public class AppModelResolverException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public AppModelResolverException(String message, Throwable cause) { + super(message, cause); + } + + public AppModelResolverException(String message) { + super(message); + } +} 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 new file mode 100644 index 0000000000000..3773cd498d32e --- /dev/null +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java @@ -0,0 +1,305 @@ +/* + * Copyright 2018 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap.resolver; + +import java.io.File; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.aether.RepositoryException; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.artifact.DefaultArtifact; +import org.eclipse.aether.collection.DependencyGraphTransformationContext; +import org.eclipse.aether.graph.Dependency; +import org.eclipse.aether.graph.DependencyNode; +import org.eclipse.aether.graph.DependencyVisitor; +import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.resolution.ArtifactRequest; +import org.eclipse.aether.resolution.ArtifactResult; +import org.eclipse.aether.resolution.VersionRangeResult; +import org.eclipse.aether.util.graph.transformer.ConflictIdSorter; +import org.eclipse.aether.util.graph.transformer.ConflictMarker; +import org.eclipse.aether.util.graph.visitor.TreeDependencyVisitor; +import org.eclipse.aether.version.Version; + +import io.quarkus.bootstrap.model.AppArtifact; +import io.quarkus.bootstrap.model.AppArtifactKey; +import io.quarkus.bootstrap.model.AppDependency; +import io.quarkus.bootstrap.model.AppModel; +import io.quarkus.bootstrap.resolver.maven.DeploymentInjectingDependencyVisitor; +import io.quarkus.bootstrap.resolver.maven.DeploymentInjectionException; +import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver; +import io.quarkus.bootstrap.resolver.maven.SimpleDependencyGraphTransformationContext; + +/** + * + * @author Alexey Loubyansky + */ +public class BootstrapAppModelResolver implements AppModelResolver { + + protected final MavenArtifactResolver mvn; + + public BootstrapAppModelResolver(MavenArtifactResolver mvn) throws AppModelResolverException { + this.mvn = mvn; + } + + public void addRemoteRepositories(List repos) { + mvn.addRemoteRepositories(repos); + } + + @Override + public void relink(AppArtifact artifact, Path path) throws AppModelResolverException { + if(mvn.getLocalRepositoryManager() == null) { + return; + } + mvn.getLocalRepositoryManager().relink(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), artifact.getType(), artifact.getVersion(), path); + artifact.setPath(path); + } + + @Override + public Path resolve(AppArtifact artifact) throws AppModelResolverException { + if(artifact.isResolved()) { + return artifact.getPath(); + } + final Path path = mvn.resolve(toAetherArtifact(artifact)).getArtifact().getFile().toPath(); + artifact.setPath(path); + return path; + } + + @Override + public AppModel resolveModel(AppArtifact coords) throws AppModelResolverException { + return injectDeploymentDependencies(coords, mvn.resolveDependencies(toAetherArtifact(coords)).getRoot()); + } + + @Override + public AppModel resolveModel(AppArtifact root, List coords) throws AppModelResolverException { + final List mvnDeps = new ArrayList<>(coords.size()); + for(AppDependency dep : coords) { + mvnDeps.add(new Dependency(toAetherArtifact(dep.getArtifact()), dep.getScope())); + } + return injectDeploymentDependencies(root, mvn.resolveDependencies(toAetherArtifact(root), mvnDeps).getRoot()); + } + + @Override + public List listLaterVersions(AppArtifact appArtifact, String upToVersion, boolean inclusive) throws AppModelResolverException { + final VersionRangeResult rangeResult = resolveVersionRangeResult(appArtifact, upToVersion, inclusive); + final List resolvedVersions = rangeResult.getVersions(); + final List versions = new ArrayList<>(resolvedVersions.size()); + for (Version v : resolvedVersions) { + versions.add(v.toString()); + } + return versions; + } + + @Override + public String getNextVersion(AppArtifact appArtifact, String upToVersion, boolean inclusive) throws AppModelResolverException { + final VersionRangeResult rangeResult = resolveVersionRangeResult(appArtifact, upToVersion, inclusive); + final List versions = rangeResult.getVersions(); + if(versions.isEmpty()) { + return appArtifact.getVersion(); + } + Version next = versions.get(0); + for(int i = 1; i < versions.size(); ++i) { + final Version candidate = versions.get(i); + if(next.compareTo(candidate) > 0) { + next = candidate; + } + } + return next.toString(); + } + + @Override + public String getLatestVersion(AppArtifact appArtifact, String upToVersion, boolean inclusive) throws AppModelResolverException { + final VersionRangeResult rangeResult = resolveVersionRangeResult(appArtifact, upToVersion, inclusive); + final List versions = rangeResult.getVersions(); + if(versions.isEmpty()) { + return appArtifact.getVersion(); + } + Version latest = versions.get(0); + for(int i = 1; i < versions.size(); ++i) { + final Version candidate = versions.get(i); + if(latest.compareTo(candidate) < 0) { + latest = candidate; + } + } + return latest.toString(); + } + + public List resolveArtifactRepos(AppArtifact appArtifact) throws AppModelResolverException { + return mvn.resolveDescriptor(new DefaultArtifact(appArtifact.getGroupId(), appArtifact.getArtifactId(), appArtifact.getClassifier(), appArtifact.getType(), appArtifact.getVersion())).getRepositories(); + } + + 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())); + } + + private AppModel injectDeploymentDependencies(AppArtifact appArtifact, DependencyNode root) throws AppModelResolverException { + + final Set appDeps = new HashSet<>(); + final List userDeps = new ArrayList<>(); + TreeDependencyVisitor visitor = new TreeDependencyVisitor(new DependencyVisitor() { + @Override + public boolean visitEnter(DependencyNode node) { + return true; + } + + @Override + public boolean visitLeave(DependencyNode node) { + final Dependency dep = node.getDependency(); + if(dep != null) { + final AppArtifact appArtifact = BootstrapAppModelResolver.toAppArtifact(dep.getArtifact()); + appDeps.add(appArtifact.getKey()); + userDeps.add(new AppDependency(appArtifact, dep.getScope(), dep.isOptional())); + } + return true; + }}); + for(DependencyNode child : root.getChildren()) { + child.accept(visitor); + } + + final DeploymentInjectingDependencyVisitor deploymentInjector = new DeploymentInjectingDependencyVisitor(mvn); + try { + root.accept(new TreeDependencyVisitor(deploymentInjector)); + } catch (DeploymentInjectionException e) { + throw new AppModelResolverException("Failed to inject extension deployment dependencies for " + root.getArtifact(), e.getCause()); + } + + List deploymentDeps = Collections.emptyList(); + if(deploymentInjector.isInjectedDeps()) { + final DependencyGraphTransformationContext context = new SimpleDependencyGraphTransformationContext(mvn.getSession()); + try { + // add conflict IDs to the added deployments + root = new ConflictMarker().transformGraph(root, context); + // resolves version conflicts + root = new ConflictIdSorter().transformGraph(root, context); + root = mvn.getSession().getDependencyGraphTransformer().transformGraph(root, context); + } catch (RepositoryException e) { + throw new AppModelResolverException("Failed to normalize the dependency graph", e); + } + List deploymentDepNodes = new ArrayList<>(); + final List requests = new ArrayList<>(); + visitor = new TreeDependencyVisitor(new DependencyVisitor() { + DependencyNode deploymentNode; + DependencyNode runtimeNode; + Artifact runtimeArtifact; + @Override + public boolean visitEnter(DependencyNode node) { + final Dependency dep = node.getDependency(); + if(dep != null) { + if(deploymentNode == null) { + runtimeArtifact = DeploymentInjectingDependencyVisitor.getInjectedDependency(node); + if(runtimeArtifact != null) { + deploymentNode = node; + } + } else if(runtimeArtifact != null && runtimeNode == null && runtimeArtifact.equals(dep.getArtifact())) { + runtimeNode = node; + } + } + return true; + } + + @Override + public boolean visitLeave(DependencyNode node) { + final Dependency dep = node.getDependency(); + if (dep != null) { + final Artifact artifact = dep.getArtifact(); + if (artifact.getFile() == null) { + requests.add(new ArtifactRequest(node)); + } + if (deploymentNode != null) { + if (runtimeNode == null && !appDeps.contains(new AppArtifactKey(artifact.getGroupId(), + artifact.getArtifactId(), artifact.getClassifier(), artifact.getExtension()))) { + deploymentDepNodes.add(node); + } else if (runtimeNode == node) { + runtimeNode = null; + runtimeArtifact = null; + } + if (deploymentNode == node) { + deploymentNode = null; + } + } + } + return true; + } + }); + for(DependencyNode child : root.getChildren()) { + child.accept(visitor); + } + if(!requests.isEmpty()) { + final List results = mvn.resolve(requests); + // update the artifacts in the graph + for (ArtifactResult result : results) { + final Artifact artifact = result.getArtifact(); + if (artifact != null) { + result.getRequest().getDependencyNode().setArtifact(artifact); + } + } + deploymentDeps = new ArrayList<>(deploymentDepNodes.size()); + for (DependencyNode dep : deploymentDepNodes) { + deploymentDeps.add(new AppDependency(BootstrapAppModelResolver.toAppArtifact(dep.getArtifact()), + dep.getDependency().getScope(), dep.getDependency().isOptional())); + } + } + } + + return new AppModel(appArtifact, userDeps, deploymentDeps); + } + + private VersionRangeResult resolveVersionRangeResult(AppArtifact appArtifact, String upToVersion, boolean inclusive) + throws AppModelResolverException { + return mvn.resolveVersionRange(new DefaultArtifact(appArtifact.getGroupId(), + appArtifact.getArtifactId(), appArtifact.getType(), + '(' + appArtifact.getVersion() + ',' + (upToVersion == null ? ')' : upToVersion + (inclusive ? ']' : ')')))); + } + + static List toAppDepList(DependencyNode rootNode) { + final List depNodes = rootNode.getChildren(); + if(depNodes.isEmpty()) { + return Collections.emptyList(); + } + final List appDeps = new ArrayList<>(); + collect(depNodes, appDeps); + return appDeps; + } + + private static void collect(List nodes, List appDeps) { + for(DependencyNode node : nodes) { + collect(node.getChildren(), appDeps); + final Dependency dep = node.getDependency(); + appDeps.add(new AppDependency(toAppArtifact(node.getArtifact()), dep.getScope(), dep.isOptional())); + } + } + + private static Artifact toAetherArtifact(AppArtifact artifact) { + return new DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), artifact.getType(), artifact.getVersion()); + } + + private static AppArtifact toAppArtifact(Artifact artifact) { + final AppArtifact appArtifact = new AppArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), artifact.getExtension(), artifact.getVersion()); + final File file = artifact.getFile(); + if(file != null) { + appArtifact.setPath(file.toPath()); + } + return appArtifact; + } +} diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/DependencyGraphParser.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/DependencyGraphParser.java new file mode 100644 index 0000000000000..eeb70524d18d1 --- /dev/null +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/DependencyGraphParser.java @@ -0,0 +1,206 @@ +/* + * Copyright 2019 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap.resolver.maven; + +import java.io.BufferedReader; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.artifact.DefaultArtifact; +import org.eclipse.aether.graph.DefaultDependencyNode; +import org.eclipse.aether.graph.Dependency; +import org.eclipse.aether.graph.DependencyNode; +import org.eclipse.aether.util.version.GenericVersionScheme; +import org.eclipse.aether.version.InvalidVersionSpecificationException; +import io.quarkus.bootstrap.BootstrapDependencyProcessingException; + +/** + * + * @author Alexey Loubyansky + */ +public class DependencyGraphParser { + + private DependencyNode root; + private List stack = new ArrayList<>(); + private int depth; + + public DependencyNode parse(Path p) throws BootstrapDependencyProcessingException { + root = null; + stack.clear(); + depth = 0; + try(BufferedReader reader = Files.newBufferedReader(p)) { + readGraph(reader); + return root; + } catch (IOException e) { + throw new BootstrapDependencyProcessingException("Failed to parse dependency graph " + p, e); + } + } + + private void readGraph(BufferedReader reader) throws IOException { + String line = reader.readLine(); + while(line != null) { + readNode(line); + line = reader.readLine(); + } + } + + private void readNode(String line) throws IOException { + int i = 0; + while(i < line.length()) { + if(line.charAt(i) != ' ') { + break; + } + ++i; + } + if(i > depth) { + throw new IllegalStateException("Unexpected offset for `" + line + "`"); + } + final DefaultDependencyNode node = new DefaultDependencyNode(toDependency(line, i)); + try { + node.setVersionConstraint(new GenericVersionScheme().parseVersionConstraint(node.getArtifact().getVersion())); + } catch (InvalidVersionSpecificationException e) { + throw new IllegalStateException(e); + } + if(depth == 0) { + root = node; + } else { + while (i < depth) { + stack.remove(--depth); + } + stack.get(depth - 1).getChildren().add(node); + } + stack.add(node); + ++depth; + } + + public static Artifact toArtifact(String str) { + return toArtifact(str, 0); + } + + private static Artifact toArtifact(String str, int offset) { + String groupId = null; + String artifactId = null; + String classifier = ""; + String type = "jar"; + String version = null; + + int colon = str.indexOf(':', offset); + final int length = str.length(); + if(colon < offset + 1 || colon == length - 1) { + illegalDependencyFormat(str); + } + groupId = str.substring(offset, colon); + offset = colon + 1; + colon = str.indexOf(':', offset); + if(colon < 0) { + artifactId = str.substring(offset, length); + } else { + if(colon == length - 1) { + illegalDependencyFormat(str); + } + artifactId = str.substring(offset, colon); + offset = colon + 1; + colon = str.indexOf(':', offset); + if(colon < 0) { + version = str.substring(offset, length); + } else { + if(colon == length - 1) { + illegalDependencyFormat(str); + } + type = str.substring(offset, colon); + offset = colon + 1; + colon = str.indexOf(':', offset); + if(colon < 0) { + version = str.substring(offset, length); + } else { + if (colon == length - 1) { + illegalDependencyFormat(str); + } + classifier = type; + type = str.substring(offset, colon); + version = str.substring(colon + 1); + } + } + } + return new DefaultArtifact(groupId, artifactId, classifier, type, version); + } + + private static Dependency toDependency(String str, int offset) { + String groupId = null; + String artifactId = null; + String classifier = ""; + String type = "jar"; + String version = null; + + int sep = str.indexOf(':', offset); + final int length = str.length(); + if(sep < offset + 1 || sep == length - 1) { + illegalDependencyFormat(str); + } + groupId = str.substring(offset, sep); + offset = sep + 1; + sep = str.indexOf(':', offset); + if(sep < 0) { + artifactId = str.substring(offset, length); + } else { + if(sep == length - 1) { + illegalDependencyFormat(str); + } + artifactId = str.substring(offset, sep); + offset = sep + 1; + sep = str.indexOf(':', offset); + if(sep < 0) { + version = str.substring(offset, length); + } else { + if(sep == length - 1) { + illegalDependencyFormat(str); + } + type = str.substring(offset, sep); + offset = sep + 1; + sep = str.indexOf(':', offset); + if(sep < 0) { + version = str.substring(offset, length); + } else { + if (sep == length - 1) { + illegalDependencyFormat(str); + } + classifier = type; + type = str.substring(offset, sep); + version = str.substring(sep + 1); + } + } + } + + String scope = null; + sep = version.lastIndexOf('('); + if(sep > 0) { + scope = version.substring(sep + 1, version.length() - 1); + version = version.substring(0, sep).trim(); + } + + return new Dependency(new DefaultArtifact(groupId, artifactId, classifier, type, version), scope); + } + + private static void illegalDependencyFormat(String str) { + throw new IllegalArgumentException("Bad artifact coordinates " + str + + ", expected format is :[:[:]]:"); + } +} 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 new file mode 100644 index 0000000000000..f92ebfff4e437 --- /dev/null +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/DeploymentInjectingDependencyVisitor.java @@ -0,0 +1,177 @@ +/* + * Copyright 2019 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap.resolver.maven; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.nio.file.FileSystem; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Properties; + +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.graph.DependencyNode; +import org.eclipse.aether.graph.DependencyVisitor; +import org.jboss.logging.Logger; +import io.quarkus.bootstrap.BootstrapConstants; +import io.quarkus.bootstrap.BootstrapDependencyProcessingException; +import io.quarkus.bootstrap.resolver.AppModelResolverException; +import io.quarkus.bootstrap.util.ZipUtils; + +/** + * + * @author Alexey Loubyansky + */ +public class DeploymentInjectingDependencyVisitor implements DependencyVisitor { + + private static final Logger log = Logger.getLogger(DeploymentInjectingDependencyVisitor.class); + + static final String INJECTED_DEPENDENCY = "injected.dep"; + + private static final DependencyGraphParser graphParser = new DependencyGraphParser(); + + public static Artifact getInjectedDependency(DependencyNode dep) { + return (Artifact) dep.getData().get(DeploymentInjectingDependencyVisitor.INJECTED_DEPENDENCY); + } + + private final MavenArtifactResolver resolver; + private DependencyNode node; + + boolean injectedDeps; + + public DeploymentInjectingDependencyVisitor(MavenArtifactResolver resolver) { + this.resolver = resolver; + } + + public boolean isInjectedDeps() { + return injectedDeps; + } + + @Override + public boolean visitEnter(DependencyNode node) { + + final Artifact artifact = node.getArtifact(); + if(!artifact.getExtension().equals("jar")) { + return true; + } + this.node = node; + + boolean processChildren = true; + final Path path = resolve(artifact); + try { + if (Files.isDirectory(path)) { + processChildren = !processQuarkusDir(path.resolve(BootstrapConstants.QUARKUS)); + } else { + try (FileSystem artifactFs = ZipUtils.newFileSystem(path)) { + processChildren = !processQuarkusDir(artifactFs.getPath(BootstrapConstants.QUARKUS)); + } + } + } catch (Throwable t) { + throw new DeploymentInjectionException("Failed to inject extension deplpyment dependencies", t); + } + return processChildren; + } + + private boolean processQuarkusDir(Path quarkusDir) throws BootstrapDependencyProcessingException { + if (Files.exists(quarkusDir)) { + Path p = quarkusDir.resolve(BootstrapConstants.DEPLOYMENT_DEPENDENCY_GRAPH); + if (Files.exists(p)) { + processDeploymentDependencyGraph(p); + return true; + } + p = quarkusDir.resolve(BootstrapConstants.DESCRIPTOR_PATH); + if (Files.exists(p)) { + processPlatformArtifact(p); + return true; + } + } + return false; + } + + private void processPlatformArtifact(Path descriptor) throws BootstrapDependencyProcessingException { + final Properties rtProps = resolveDescriptor(descriptor); + if(rtProps == null) { + return; + } + log.debugf("Processing platform dependency %s", node); + + String value = rtProps.getProperty(BootstrapConstants.PROP_DEPLOYMENT_ARTIFACT); + if(value != null) { + replaceWith(collectDependencies(DependencyGraphParser.toArtifact(value))); + } + } + + private void processDeploymentDependencyGraph(Path graphPath) throws BootstrapDependencyProcessingException { + final DependencyNode parsedGraph = graphParser.parse(graphPath); + //BootstrapDependencyGraphTransformer.log("Parsed graph", parsedGraph); + //BootstrapDependencyGraphTransformer.log("Resolved graph", collectDependencies(parsedGraph.getArtifact())); + replaceWith(parsedGraph); + } + + private void replaceWith(DependencyNode depNode) throws BootstrapDependencyProcessingException { + //BootstrapDependencyGraphTransformer.log("Replacing dependency " + depNode.getArtifact(), depNode); + node.setData(INJECTED_DEPENDENCY, node.getArtifact()); + node.setArtifact(depNode.getArtifact()); + node.getDependency().setArtifact(depNode.getArtifact()); + node.setChildren(depNode.getChildren()); + injectedDeps = true; + } + + private DependencyNode collectDependencies(Artifact artifact) throws BootstrapDependencyProcessingException { + if(artifact.getVersion().isEmpty()) { + artifact = artifact.setVersion(node.getArtifact().getVersion()); + } + try { + return resolver.collectDependencies(artifact).getRoot(); + } catch (AppModelResolverException e) { + throw new DeploymentInjectionException(e); + } + } + + private Path resolve(Artifact artifact) { + File file = artifact.getFile(); + if(file != null) { + return file.toPath(); + } + try { + return resolver.resolve(artifact).getArtifact().getFile().toPath(); + } catch (AppModelResolverException e) { + throw new DeploymentInjectionException(e); + } + } + + private Properties resolveDescriptor(final Path path) throws BootstrapDependencyProcessingException { + final Properties rtProps; + if (!Files.exists(path)) { + // not a platform artifact + return null; + } + rtProps = new Properties(); + try (BufferedReader reader = Files.newBufferedReader(path)) { + rtProps.load(reader); + } catch (IOException e) { + throw new BootstrapDependencyProcessingException("Failed to load " + path, e); + } + return rtProps; + } + + @Override + public boolean visitLeave(DependencyNode node) { + return true; + } +} diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/DeploymentInjectionException.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/DeploymentInjectionException.java new file mode 100644 index 0000000000000..d1badcd0a147b --- /dev/null +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/DeploymentInjectionException.java @@ -0,0 +1,41 @@ +/* + * Copyright 2019 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap.resolver.maven; + +/** + * + * @author Alexey Loubyansky + */ +public class DeploymentInjectionException extends RuntimeException { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public DeploymentInjectionException(String message, Throwable cause) { + super(message, cause); + } + + public DeploymentInjectionException(Throwable cause) { + super(cause); + } + + public DeploymentInjectionException(String message) { + super(message); + } +} diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java new file mode 100644 index 0000000000000..79c7c24f8168d --- /dev/null +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java @@ -0,0 +1,246 @@ +/** + * + */ +package io.quarkus.bootstrap.resolver.maven; + +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; +import org.eclipse.aether.DefaultRepositoryCache; +import org.eclipse.aether.DefaultRepositorySystemSession; +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.collection.CollectRequest; +import org.eclipse.aether.collection.CollectResult; +import org.eclipse.aether.collection.DependencyCollectionException; +import org.eclipse.aether.graph.Dependency; +import org.eclipse.aether.installation.InstallRequest; +import org.eclipse.aether.installation.InstallationException; +import org.eclipse.aether.repository.LocalRepository; +import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.resolution.ArtifactDescriptorException; +import org.eclipse.aether.resolution.ArtifactDescriptorRequest; +import org.eclipse.aether.resolution.ArtifactDescriptorResult; +import org.eclipse.aether.resolution.ArtifactRequest; +import org.eclipse.aether.resolution.ArtifactResolutionException; +import org.eclipse.aether.resolution.ArtifactResult; +import org.eclipse.aether.resolution.DependencyRequest; +import org.eclipse.aether.resolution.DependencyResolutionException; +import org.eclipse.aether.resolution.DependencyResult; +import org.eclipse.aether.resolution.VersionRangeRequest; +import org.eclipse.aether.resolution.VersionRangeResolutionException; +import org.eclipse.aether.resolution.VersionRangeResult; +import org.eclipse.aether.util.artifact.JavaScopes; + +import io.quarkus.bootstrap.resolver.AppModelResolverException; +import io.quarkus.bootstrap.resolver.maven.workspace.LocalWorkspace; + +/** + * + * @author Alexey Loubyansky + */ +public class MavenArtifactResolver { + + public static class Builder { + + private Path repoHome; + private RepositorySystem repoSystem; + private RepositorySystemSession repoSession; + private List remoteRepos = null; + private Boolean offline; + private LocalWorkspace workspace; + + private Builder() { + } + + public Builder setRepoHome(Path home) { + this.repoHome = home; + return this; + } + + public Builder setRepositorySystem(RepositorySystem system) { + this.repoSystem = system; + return this; + } + + public Builder setRepositorySystemSession(RepositorySystemSession session) { + this.repoSession = session; + return this; + } + + public Builder setRemoteRepositories(List repos) { + this.remoteRepos = repos; + return this; + } + + public Builder setOffline(boolean offline) { + this.offline = offline; + return this; + } + + public Builder setWorkspace(LocalWorkspace workspace) { + this.workspace = workspace; + return this; + } + + public MavenArtifactResolver build() throws AppModelResolverException { + return new MavenArtifactResolver(this); + } + } + + public static Builder builder() { + return new Builder(); + } + + protected final RepositorySystem repoSystem; + protected final RepositorySystemSession repoSession; + protected final List remoteRepos; + protected final MavenLocalRepositoryManager localRepoManager; + + private MavenArtifactResolver(Builder builder) throws AppModelResolverException { + + + this.repoSystem = builder.repoSystem == null ? MavenRepoInitializer.getRepositorySystem( + (builder.offline == null + ? (builder.repoSession == null ? MavenRepoInitializer.getSettings().isOffline() + : builder.repoSession.isOffline()) + : builder.offline), + builder.workspace) : builder.repoSystem; + final DefaultRepositorySystemSession newSession = builder.repoSession == null ? MavenRepoInitializer.newSession(repoSystem) : new DefaultRepositorySystemSession(builder.repoSession); + if(builder.offline != null) { + newSession.setOffline(builder.offline); + } + + if(builder.repoHome != null) { + final MavenLocalRepositoryManager appCreatorLocalRepoManager = new MavenLocalRepositoryManager( + repoSystem.newLocalRepositoryManager(newSession, new LocalRepository(builder.repoHome.toString())), + Paths.get(MavenRepoInitializer.getLocalRepo(MavenRepoInitializer.getSettings()))); + newSession.setLocalRepositoryManager(appCreatorLocalRepoManager); + localRepoManager = appCreatorLocalRepoManager; + } else { + localRepoManager = null; + } + + if(newSession.getCache() == null) { + newSession.setCache(new DefaultRepositoryCache()); + } + + if (builder.workspace != null) { + newSession.setWorkspaceReader(builder.workspace); + } + + this.repoSession = newSession; + this.remoteRepos = builder.remoteRepos == null ? MavenRepoInitializer.getRemoteRepos() : builder.remoteRepos; + } + + public MavenLocalRepositoryManager getLocalRepositoryManager() { + return localRepoManager; + } + + public RepositorySystemSession getSession() { + return repoSession; + } + + public void addRemoteRepositories(List repos) { + remoteRepos.addAll(repos); + } + + public ArtifactResult resolve(Artifact artifact) throws AppModelResolverException { + try { + return repoSystem.resolveArtifact(repoSession, + new ArtifactRequest() + .setArtifact(artifact) + .setRepositories(remoteRepos)); + } catch (ArtifactResolutionException e) { + throw new AppModelResolverException("Failed to resolve artifact " + artifact, e); + } + } + + public List resolve(List artifacts) throws AppModelResolverException { + try { + return repoSystem.resolveArtifacts(repoSession, artifacts); + } catch (ArtifactResolutionException e) { + throw new AppModelResolverException("Failed to resolve artifacts", e); + } + } + + public ArtifactDescriptorResult resolveDescriptor(final Artifact artifact) + throws AppModelResolverException { + try { + return repoSystem.readArtifactDescriptor(repoSession, + new ArtifactDescriptorRequest() + .setArtifact(artifact)); + } catch (ArtifactDescriptorException e) { + throw new AppModelResolverException("Failed to read descriptor of " + artifact, e); + } + } + + public VersionRangeResult resolveVersionRange(Artifact artifact) throws AppModelResolverException { + 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); + } + } + + public CollectResult collectDependencies(Artifact artifact) throws AppModelResolverException { + try { + return repoSystem.collectDependencies(repoSession, newCollectRequest(artifact)); + } catch (DependencyCollectionException e) { + throw new AppModelResolverException("Failed to collect dependencies for " + artifact, e); + } + } + + public DependencyResult resolveDependencies(Artifact artifact) throws AppModelResolverException { + try { + return repoSystem.resolveDependencies(repoSession, + new DependencyRequest() + .setCollectRequest(newCollectRequest(artifact))); + } catch (DependencyResolutionException e) { + throw new AppModelResolverException("Failed to resolve dependencies for " + artifact, e); + } + } + + public CollectResult collectDependencies(Artifact artifact, List deps) throws AppModelResolverException { + final CollectRequest request = newCollectRequest(artifact); + for(Dependency dep : deps) { + request.addDependency(dep); + } + try { + return repoSystem.collectDependencies(repoSession, request); + } catch (DependencyCollectionException e) { + throw new AppModelResolverException("Failed to collect dependencies for " + artifact, e); + } + } + + public DependencyResult resolveDependencies(Artifact artifact, List deps) throws AppModelResolverException { + final CollectRequest request = newCollectRequest(artifact); + for(Dependency dep : deps) { + request.addDependency(dep); + } + try { + return repoSystem.resolveDependencies(repoSession, + new DependencyRequest().setCollectRequest(request)); + } catch (DependencyResolutionException e) { + throw new AppModelResolverException("Failed to resolve dependencies for " + artifact, e); + } + } + + public void install(Artifact artifact) throws AppModelResolverException { + try { + repoSystem.install(repoSession, new InstallRequest().addArtifact(artifact)); + } catch (InstallationException ex) { + throw new AppModelResolverException("Failed to install " + artifact, ex); + } + } + + private CollectRequest newCollectRequest(Artifact artifact) throws AppModelResolverException { + return new CollectRequest() + .setRoot(new Dependency(artifact, JavaScopes.RUNTIME)) + .setRepositories(remoteRepos); + } +} diff --git a/core/creator/src/main/java/io/quarkus/creator/resolver/aether/AppCreatorLocalRepositoryManager.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenLocalRepositoryManager.java similarity index 85% rename from core/creator/src/main/java/io/quarkus/creator/resolver/aether/AppCreatorLocalRepositoryManager.java rename to independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenLocalRepositoryManager.java index 92dbeb704e21b..aad07e7e6b325 100644 --- a/core/creator/src/main/java/io/quarkus/creator/resolver/aether/AppCreatorLocalRepositoryManager.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenLocalRepositoryManager.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.quarkus.creator.resolver.aether; +package io.quarkus.bootstrap.resolver.maven; import java.io.IOException; import java.nio.file.Files; @@ -33,26 +33,24 @@ import org.eclipse.aether.repository.LocalRepository; import org.eclipse.aether.repository.LocalRepositoryManager; import org.eclipse.aether.repository.RemoteRepository; - -import io.quarkus.creator.util.IoUtils; +import io.quarkus.bootstrap.util.IoUtils; /** * * @author Alexey Loubyansky */ -public class AppCreatorLocalRepositoryManager implements LocalRepositoryManager { +public class MavenLocalRepositoryManager implements LocalRepositoryManager { private final LocalRepositoryManager delegate; private final Path userLocalRepo; private final Path appCreatorRepo; private final boolean relinkResolvedArtifacts; - public AppCreatorLocalRepositoryManager(LocalRepositoryManager delegate, Path userLocalRepo) { + public MavenLocalRepositoryManager(LocalRepositoryManager delegate, Path userLocalRepo) { this(delegate, userLocalRepo, false); } - public AppCreatorLocalRepositoryManager(LocalRepositoryManager delegate, Path userLocalRepo, - boolean relinkResolvedArtifacts) { + public MavenLocalRepositoryManager(LocalRepositoryManager delegate, Path userLocalRepo, boolean relinkResolvedArtifacts) { this.delegate = delegate; this.userLocalRepo = userLocalRepo; this.appCreatorRepo = delegate.getRepository().getBasedir().toPath(); @@ -84,7 +82,7 @@ public String getPathForRemoteMetadata(Metadata metadata, RemoteRepository repos return delegate.getPathForRemoteMetadata(metadata, repository, context); } - void relink(String groupId, String artifactId, String classifier, String type, String version, Path p) { + public void relink(String groupId, String artifactId, String classifier, String type, String version, Path p) { final Path creatorRepoPath = getLocalPath(appCreatorRepo, groupId, artifactId, classifier, type, version); try { IoUtils.copy(p, creatorRepoPath); @@ -96,16 +94,15 @@ void relink(String groupId, String artifactId, String classifier, String type, S @Override public LocalArtifactResult find(RepositorySystemSession session, LocalArtifactRequest request) { final LocalArtifactResult result = delegate.find(session, request); - if (result.isAvailable()) { + if(result.isAvailable()) { return result; } final Artifact artifact = request.getArtifact(); - final Path userRepoPath = getLocalPath(userLocalRepo, artifact.getGroupId(), artifact.getArtifactId(), - artifact.getClassifier(), artifact.getExtension(), artifact.getVersion()); - if (!Files.exists(userRepoPath)) { + final Path userRepoPath = getLocalPath(userLocalRepo, artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), artifact.getExtension(), artifact.getVersion()); + if(!Files.exists(userRepoPath)) { return result; } - if (relinkResolvedArtifacts) { + if(relinkResolvedArtifacts) { final Path creatorRepoPath = getLocalPath(appCreatorRepo, artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), artifact.getExtension(), artifact.getVersion()); try { @@ -130,13 +127,12 @@ public void add(RepositorySystemSession session, LocalArtifactRegistration reque @Override public LocalMetadataResult find(RepositorySystemSession session, LocalMetadataRequest request) { final LocalMetadataResult result = delegate.find(session, request); - if (result.getFile() != null && result.getFile().exists()) { + if(result.getFile() != null && result.getFile().exists()) { return result; } final Metadata metadata = request.getMetadata(); - final Path userRepoPath = getMetadataPath(userLocalRepo, metadata.getGroupId(), metadata.getArtifactId(), - metadata.getType(), metadata.getVersion()); - if (!Files.exists(userRepoPath)) { + final Path userRepoPath = getMetadataPath(userLocalRepo, metadata.getGroupId(), metadata.getArtifactId(), metadata.getType(), metadata.getVersion()); + if(!Files.exists(userRepoPath)) { return result; } if (relinkResolvedArtifacts) { @@ -166,17 +162,16 @@ private Path getMetadataPath(Path repoHome, String groupId, String artifactId, S for (String part : groupParts) { p = p.resolve(part); } - if (artifactId != null) { + if(artifactId != null) { p = p.resolve(artifactId); } - if (version != null) { + if(version != null) { p = p.resolve(version); } return p.resolve("maven-metadata-local.xml"); } - private Path getLocalPath(Path repoHome, String groupId, String artifactId, String classifier, String type, - String version) { + private Path getLocalPath(Path repoHome, String groupId, String artifactId, String classifier, String type, String version) { Path p = repoHome; final String[] groupParts = groupId.split("\\."); for (String part : groupParts) { diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenModelBuilder.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenModelBuilder.java new file mode 100644 index 0000000000000..d5ce56df6ac03 --- /dev/null +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenModelBuilder.java @@ -0,0 +1,74 @@ +/* + * Copyright 2019 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap.resolver.maven; + +import java.io.File; + +import org.apache.maven.model.Model; +import org.apache.maven.model.building.DefaultModelBuilderFactory; +import org.apache.maven.model.building.ModelBuilder; +import org.apache.maven.model.building.ModelBuildingException; +import org.apache.maven.model.building.ModelBuildingRequest; +import org.apache.maven.model.building.ModelBuildingResult; +import org.apache.maven.model.building.ModelProblemCollector; +import org.apache.maven.model.building.Result; +import org.apache.maven.model.resolution.WorkspaceModelResolver; +import org.apache.maven.model.validation.ModelValidator; + +/** + * + * @author Alexey Loubyansky + */ +public class MavenModelBuilder implements ModelBuilder { + + private final ModelBuilder builder; + private final WorkspaceModelResolver modelResolver; + + public MavenModelBuilder(WorkspaceModelResolver wsModelResolver) { + builder = new DefaultModelBuilderFactory().newInstance() + .setModelValidator(new ModelValidator() { + @Override + public void validateRawModel(Model model, ModelBuildingRequest request, ModelProblemCollector problems) { + } + + @Override + public void validateEffectiveModel(Model model, ModelBuildingRequest request, ModelProblemCollector problems) { + } + }); + + modelResolver = wsModelResolver; + } + + @Override + public ModelBuildingResult build(ModelBuildingRequest request) throws ModelBuildingException { + if(modelResolver != null) { + request.setWorkspaceModelResolver(modelResolver); + } + return builder.build(request); + } + + @Override + public ModelBuildingResult build(ModelBuildingRequest request, ModelBuildingResult result) throws ModelBuildingException { + return builder.build(request, result); + } + + @Override + public Result buildRawModel(File pomFile, int validationLevel, boolean locationTracking) { + return builder.buildRawModel(pomFile, validationLevel, locationTracking); + } + +} 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 new file mode 100644 index 0000000000000..d18091a4c561d --- /dev/null +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenRepoInitializer.java @@ -0,0 +1,289 @@ +/* + * Copyright 2018 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.quarkus.bootstrap.resolver.maven; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.apache.maven.model.building.ModelBuilder; +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.Repository; +import org.apache.maven.settings.Settings; +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.eclipse.aether.DefaultRepositorySystemSession; +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory; +import org.eclipse.aether.impl.DefaultServiceLocator; +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.file.FileTransporterFactory; +import org.eclipse.aether.transport.http.HttpTransporterFactory; +import org.eclipse.aether.util.repository.AuthenticationBuilder; +import org.eclipse.aether.util.repository.DefaultMirrorSelector; +import org.eclipse.aether.util.repository.DefaultProxySelector; +import org.jboss.logging.Logger; +import io.quarkus.bootstrap.resolver.AppModelResolverException; +import io.quarkus.bootstrap.util.PropertyUtils; + +/** + * + * @author Alexey Loubyansky + */ +public class MavenRepoInitializer { + + private static final String MAVEN_CMD_LINE_ARGS = "MAVEN_CMD_LINE_ARGS"; + private static final String DOT_M2 = ".m2"; + private static final String MAVEN_HOME = "maven.home"; + private static final String M2_HOME = "M2_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(M2_HOME); + private static final File USER_SETTINGS_FILE; + private static final File GLOBAL_SETTINGS_FILE; + + static { + final String mvnCmd = System.getenv(MAVEN_CMD_LINE_ARGS); + String userSettings = null; + String globalSettings = null; + if(mvnCmd != null) { + userSettings = getMvnCmdArg(mvnCmd, " -s "); + if(userSettings == null) { + userSettings = getMvnCmdArg(mvnCmd, "--settings "); + } + globalSettings = getMvnCmdArg(mvnCmd, " -gs "); + if(globalSettings == null) { + globalSettings = getMvnCmdArg(mvnCmd, "--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_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 List remoteRepos; + private static Settings settings; + + private static final Logger log = Logger.getLogger(MavenRepoInitializer.class); + + public static RepositorySystem getRepositorySystem() { + return getRepositorySystem(false, null); + } + + 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, FileTransporterFactory.class); + locator.addService(TransporterFactory.class, HttpTransporterFactory.class); + } + locator.setServices(ModelBuilder.class, new MavenModelBuilder(wsModelResolver)); + locator.setErrorHandler(new DefaultServiceLocator.ErrorHandler() { + @Override + public void serviceCreationFailed(Class type, Class impl, Throwable exception) { + System.err.println("Service creation failed"); + exception.printStackTrace(); + } + }); + + 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 org.apache.maven.settings.Proxy proxy = settings.getActiveProxy(); + if (proxy != null) { + Authentication auth = null; + if(proxy.getUsername() != null) { + auth = new AuthenticationBuilder() + .addUsername(proxy.getUsername()) + .addPassword(proxy.getPassword()) + .build(); + } + session.setProxySelector(new DefaultProxySelector() + .add(new Proxy(proxy.getProtocol(), proxy.getHost(), proxy.getPort(), auth), proxy.getNonProxyHosts())); + } + + 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()); + + return session; + } + + public static List getRemoteRepos() throws AppModelResolverException { + if(remoteRepos != null) { + return remoteRepos; + } + return remoteRepos = Collections.unmodifiableList(getRemoteRepos(getSettings())); + } + + public static List getRemoteRepos(Settings settings) throws AppModelResolverException { + final List remotes = new ArrayList<>(); + for (Profile profile : settings.getProfiles()) { + if (profile.getActivation() != null && profile.getActivation().isActiveByDefault()) { + addProfileRepos(profile, remotes); + } + } + final List activeProfiles = settings.getActiveProfiles(); + if (!activeProfiles.isEmpty()) { + final Map profilesMap = settings.getProfilesAsMap(); + for (String profileName : activeProfiles) { + addProfileRepos(profilesMap.get(profileName), remotes); + } + } + return remotes; + } + + private static void addProfileRepos(final Profile profile, final List all) { + final List repositories = profile.getRepositories(); + for (Repository repo : repositories) { + final RemoteRepository.Builder repoBuilder = new RemoteRepository.Builder(repo.getId(), repo.getLayout(), repo.getUrl()); + org.apache.maven.settings.RepositoryPolicy policy = repo.getReleases(); + if (policy != null) { + repoBuilder.setReleasePolicy( + new RepositoryPolicy(policy.isEnabled(), policy.getUpdatePolicy(), policy.getChecksumPolicy())); + } + policy = repo.getSnapshots(); + if (policy != null) { + repoBuilder.setSnapshotPolicy( + new RepositoryPolicy(policy.isEnabled(), policy.getUpdatePolicy(), policy.getChecksumPolicy())); + } + 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; + } + + private static String getMvnCmdArg(final String mvnCmd, String argName) { + final int argStart = mvnCmd.indexOf(argName); + if(argStart > 0) { + final StringBuilder buf = new StringBuilder(); + int i = argStart + argName.length(); + while(i < mvnCmd.length()) { + final char c = mvnCmd.charAt(i++); + if(Character.isWhitespace(c)) { + if(buf.length() > 0) { + return buf.toString(); + } + } else { + buf.append(c); + } + } + return buf.length() == 0 ? null : buf.toString(); + } + return null; + } + + public static String getLocalRepo(Settings settings) { + final String localRepo = settings.getLocalRepository(); + return localRepo == null ? getDefaultLocalRepo() : localRepo; + } + + private static String getDefaultLocalRepo() { + return new File(userMavenConfigurationHome, "repository").getAbsolutePath(); + } +} diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/SimpleDependencyGraphTransformationContext.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/SimpleDependencyGraphTransformationContext.java new file mode 100644 index 0000000000000..985f3f4195424 --- /dev/null +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/SimpleDependencyGraphTransformationContext.java @@ -0,0 +1,53 @@ +/* + * Copyright 2019 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap.resolver.maven; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.collection.DependencyGraphTransformationContext; + +/** + * + * @author Alexey Loubyansky + */ +public class SimpleDependencyGraphTransformationContext implements DependencyGraphTransformationContext { + + private final RepositorySystemSession session; + private final Map map = new HashMap<>(3); + + public SimpleDependencyGraphTransformationContext(RepositorySystemSession session) { + this.session = session; + } + + @Override + public RepositorySystemSession getSession() { + return session; + } + + @Override + public Object get(Object key) { + return map.get(key); + } + + @Override + public Object put(Object key, Object value) { + return map.put(key, value); + } + +} diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java new file mode 100644 index 0000000000000..a15bbc9fcee14 --- /dev/null +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java @@ -0,0 +1,185 @@ +/* + * Copyright 2019 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap.resolver.maven.workspace; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import org.apache.maven.model.Model; +import org.apache.maven.model.Parent; +import org.jboss.logging.Logger; +import io.quarkus.bootstrap.BootstrapException; +import io.quarkus.bootstrap.model.AppArtifact; +import io.quarkus.bootstrap.model.AppArtifactKey; + +/** + * + * @author Alexey Loubyansky + */ +public class LocalProject { + + private static final Logger log = Logger.getLogger(LocalProject.class); + + private static final String POM_XML = "pom.xml"; + + public static LocalProject resolveLocalProject(Path currentProjectDir) throws BootstrapException { + try { + return new LocalProject(currentProjectDir, null); + } catch (IOException e) { + throw new BootstrapException("Failed to resolve local Maven project for " + currentProjectDir, e); + } + } + + public static LocalProject resolveLocalProjectWithWorkspace(Path currentProjectDir) throws BootstrapException { + + final Path rootDir = locateRootProjectDir(currentProjectDir); + log.debugf("Root project dir %s", rootDir); + + final LocalWorkspace workspace = new LocalWorkspace(); + final LocalProject project; + try { + project = loadProject(workspace, rootDir, currentProjectDir); + } catch (IOException e) { + throw new BootstrapException("Failed to resolve local Maven projects for " + currentProjectDir, e); + } + if(project == null) { + throw new BootstrapException("Failed to locate current project among the loaded local projects"); + } + return project; + } + + private static LocalProject loadProject(LocalWorkspace workspace, Path dir, Path currentProjectDir) throws IOException { + final LocalProject project = new LocalProject(dir, workspace); + final Path projectDir = project.getDir(); + LocalProject result = currentProjectDir == null || !currentProjectDir.equals(projectDir) ? null : project; + final List modules = project.getRawModel().getModules(); + if (!modules.isEmpty()) { + Path dirArg = result == null ? currentProjectDir : null; + for (String module : modules) { + final LocalProject loaded = loadProject(workspace, projectDir.resolve(module), dirArg); + if(loaded != null && result == null) { + result = loaded; + dirArg = null; + } + } + } + return result; + } + + private static Path locateRootProjectDir(Path currentProjectDir) throws BootstrapException { + Path p = currentProjectDir; + while(true) { + final Path parentDir = p.getParent(); + if(parentDir == null) { + return p; + } + if(!Files.exists(parentDir.resolve(POM_XML))) { + return p; + } + p = parentDir; + } + } + + public static Path locateCurrentProjectDir(Path path) throws BootstrapException { + Path p = path; + while(p != null) { + if(Files.exists(p.resolve(POM_XML))) { + return p; + } + p = p.getParent(); + } + throw new BootstrapException("Failed to locate project pom.xml for " + path); + } + + private final Model rawModel; + private final String groupId; + private final String artifactId; + private final String version; + private final Path dir; + private final LocalWorkspace workspace; + + private LocalProject(Path dir, LocalWorkspace workspace) throws IOException { + this.dir = dir; + this.workspace = workspace; + final Path pomXml = dir.resolve(POM_XML); + rawModel = ModelUtils.readModel(pomXml); + rawModel.setPomFile(pomXml.toFile()); + final Parent parent = rawModel.getParent(); + String groupId = rawModel.getGroupId(); + if(groupId == null) { + if(parent == null) { + throw new IOException("Failed to determine groupId for " + pomXml); + } + this.groupId = parent.getGroupId(); + } else { + this.groupId = groupId; + } + + this.artifactId = rawModel.getArtifactId(); + String version = rawModel.getVersion(); + if(version == null) { + if(parent == null) { + throw new IOException("Failed to determine version for " + pomXml); + } + this.version = parent.getVersion(); + } else { + this.version = version; + } + if(workspace != null) { + workspace.addProject(this, pomXml.toFile().lastModified()); + } + } + + public String getGroupId() { + return groupId; + } + + public String getArtifactId() { + return artifactId; + } + + public String getVersion() { + return version; + } + + public Path getDir() { + return dir; + } + + public Path getClassesDir() { + return dir.resolve("target").resolve("classes"); + } + + public Model getRawModel() { + return rawModel; + } + + public LocalWorkspace getWorkspace() { + return workspace; + } + + public AppArtifactKey getKey() { + return new AppArtifactKey(groupId, artifactId); + } + + public AppArtifact getAppArtifact() { + final AppArtifact appArtifact = new AppArtifact(groupId, artifactId, "", rawModel.getPackaging(), version); + appArtifact.setPath(getClassesDir()); + return appArtifact; + } +} diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java new file mode 100644 index 0000000000000..50d4caa704986 --- /dev/null +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java @@ -0,0 +1,124 @@ +/* + * Copyright 2019 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap.resolver.maven.workspace; + +import java.io.File; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.maven.model.Model; +import org.apache.maven.model.resolution.UnresolvableModelException; +import org.apache.maven.model.resolution.WorkspaceModelResolver; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.repository.WorkspaceReader; +import org.eclipse.aether.repository.WorkspaceRepository; + +import io.quarkus.bootstrap.model.AppArtifactCoords; +import io.quarkus.bootstrap.model.AppArtifactKey; + +/** + * + * @author Alexey Loubyansky + */ +public class LocalWorkspace implements WorkspaceModelResolver, WorkspaceReader { + + private final Map projects = new HashMap<>(); + + private final WorkspaceRepository wsRepo = new WorkspaceRepository(); + private AppArtifactKey lastFindVersionsKey; + private List lastFindVersions; + private long lastModified; + + protected void addProject(LocalProject project, long lastModified) { + projects.put(project.getKey(), project); + if(lastModified > this.lastModified) { + this.lastModified = lastModified; + } + } + + public LocalProject getProject(String groupId, String artifactId) { + return getProject(new AppArtifactKey(groupId, artifactId)); + } + + public LocalProject getProject(AppArtifactKey key) { + return projects.get(key); + } + + public long getLastModified() { + return lastModified; + } + + @Override + public Model resolveRawModel(String groupId, String artifactId, String versionConstraint) + throws UnresolvableModelException { + final LocalProject project = getProject(groupId, artifactId); + if(project == null || !project.getVersion().equals(versionConstraint)) { + return null; + } + return project.getRawModel(); + } + + @Override + public Model resolveEffectiveModel(String groupId, String artifactId, String versionConstraint) + throws UnresolvableModelException { + return null; + } + + @Override + public WorkspaceRepository getRepository() { + return wsRepo; + } + + @Override + public File findArtifact(Artifact artifact) { + final LocalProject lp = getProject(artifact.getGroupId(), artifact.getArtifactId()); + if (lp == null || !lp.getVersion().equals(artifact.getVersion())) { + return null; + } + final String type = artifact.getExtension(); + if (type.equals(AppArtifactCoords.TYPE_JAR)) { + final File file = lp.getClassesDir().toFile(); + if (file.exists()) { + return file; + } + } else if (type.equals(AppArtifactCoords.TYPE_POM)) { + final File file = lp.getDir().resolve("pom.xml").toFile(); + if (file.exists()) { + return file; + } + } + return null; + } + + @Override + public List findVersions(Artifact artifact) { + if (lastFindVersionsKey != null && artifact.getVersion().equals(lastFindVersions.get(0)) + && lastFindVersionsKey.getArtifactId().equals(artifact.getArtifactId()) + && lastFindVersionsKey.getGroupId().equals(artifact.getGroupId())) { + return lastFindVersions; + } + lastFindVersionsKey = new AppArtifactKey(artifact.getGroupId(), artifact.getArtifactId()); + final LocalProject lp = getProject(lastFindVersionsKey); + if (lp == null || !lp.getVersion().equals(artifact.getVersion())) { + lastFindVersionsKey = null; + return Collections.emptyList(); + } + return lastFindVersions = Collections.singletonList(artifact.getVersion()); + } +} diff --git a/core/creator/src/main/java/io/quarkus/creator/phase/curate/Utils.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtils.java similarity index 50% rename from core/creator/src/main/java/io/quarkus/creator/phase/curate/Utils.java rename to independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtils.java index 826e4f37a22df..80b6c923d7f0e 100644 --- a/core/creator/src/main/java/io/quarkus/creator/phase/curate/Utils.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/ModelUtils.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.quarkus.creator.phase.curate; +package io.quarkus.bootstrap.resolver.maven.workspace; import java.io.BufferedReader; import java.io.BufferedWriter; @@ -38,25 +38,26 @@ import org.apache.maven.model.io.xpp3.MavenXpp3Writer; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; -import io.quarkus.creator.AppArtifact; -import io.quarkus.creator.AppCreatorException; -import io.quarkus.creator.AppDependency; +import io.quarkus.bootstrap.model.AppArtifact; +import io.quarkus.bootstrap.model.AppArtifactKey; +import io.quarkus.bootstrap.model.AppDependency; + /** * * @author Alexey Loubyansky */ -public class Utils { +public class ModelUtils { private static final String STATE_ARTIFACT_INITIAL_VERSION = "1"; /** * Returns the provisioning state artifact for the given application artifact * - * @param appArtifact application artifact - * @return provisioning state artifact + * @param appArtifact application artifact + * @return provisioning state artifact */ - static AppArtifact getStateArtifact(AppArtifact appArtifact) { + public static AppArtifact getStateArtifact(AppArtifact appArtifact) { return new AppArtifact(appArtifact.getGroupId() + ".quarkus.curate", appArtifact.getArtifactId(), "", @@ -67,25 +68,25 @@ static AppArtifact getStateArtifact(AppArtifact appArtifact) { /** * Filters out non-platform from application POM dependencies. * - * @param deps POM model application dependencies - * @param appDeps resolved application dependencies - * @return dependencies that can be checked for updates - * @throws AppCreatorException in case of a failure + * @param deps POM model application dependencies + * @param appDeps resolved application dependencies + * @return dependencies that can be checked for updates + * @throws AppCreatorException in case of a failure */ - static List getUpdateCandidates(List deps, List appDeps, Set groupIds) - throws AppCreatorException { - final Map appDepMap = new LinkedHashMap<>(appDeps.size()); - for (AppDependency appDep : appDeps) { - appDepMap.put(new ArtifactKey(appDep.getArtifact()), appDep); + public static List getUpdateCandidates(List deps, List appDeps, Set groupIds) throws IOException { + final Map appDepMap = new LinkedHashMap<>(appDeps.size()); + for(AppDependency appDep : appDeps) { + final AppArtifact appArt = appDep.getArtifact(); + appDepMap.put(new AppArtifactKey(appArt.getGroupId(), appArt.getArtifactId(), appArt.getClassifier()), appDep); } final List updateCandidates = new ArrayList<>(deps.size()); // it's critical to preserve the order of the dependencies from the pom - for (Dependency dep : deps) { - if (!groupIds.contains(dep.getGroupId()) || "test".equals(dep.getScope())) { + for(Dependency dep : deps) { + if(!groupIds.contains(dep.getGroupId()) || "test".equals(dep.getScope())) { continue; } - final AppDependency appDep = appDepMap.remove(new ArtifactKey(dep)); - if (appDep == null) { + final AppDependency appDep = appDepMap.remove(new AppArtifactKey(dep.getGroupId(), dep.getArtifactId(), dep.getClassifier())); + if(appDep == null) { // This normally would be a dependency that's missing test in the artifact's pom // but is marked as such in one of artifact's parent poms //throw new AppCreatorException("Failed to locate dependency " + new AppArtifact(dep.getGroupId(), dep.getArtifactId(), dep.getClassifier(), dep.getType(), dep.getVersion()) + " present in pom.xml among resolved application dependencies"); @@ -93,15 +94,15 @@ static List getUpdateCandidates(List deps, List//pom.properties in " + appJar); - } catch (IOException e) { - throw new AppCreatorException("Failed to load pom.properties from " + appJar, e); + throw new IOException("Failed to located META-INF/maven///pom.properties in " + appJar); } } - static Model readAppModel(Path appJar, AppArtifact appArtifact) throws AppCreatorException { + public static Model readAppModel(Path appJar, AppArtifact appArtifact) throws IOException { try (FileSystem fs = FileSystems.newFileSystem(appJar, null)) { - final Path pomXml = fs.getPath("META-INF", "maven", appArtifact.getGroupId(), appArtifact.getArtifactId(), - "pom.xml"); - if (!Files.exists(pomXml)) { - throw new AppCreatorException("Failed to located META-INF/maven///pom.xml in " + appJar); - } - try { - return readModel(pomXml); - } catch (IOException e) { - throw new AppCreatorException("Failed to read " + pomXml, e); + final Path pomXml = fs.getPath("META-INF", "maven", appArtifact.getGroupId(), appArtifact.getArtifactId(), "pom.xml"); + if(!Files.exists(pomXml)) { + throw new IOException("Failed to located META-INF/maven///pom.xml in " + appJar); } - } catch (IOException e) { - throw new AppCreatorException("Failed to load pom.xml from " + appJar, e); + return readModel(pomXml); } } - static Model readAppModel(Path appJar) throws AppCreatorException { + static Model readAppModel(Path appJar) throws IOException { try (FileSystem fs = FileSystems.newFileSystem(appJar, null)) { final Path metaInfMaven = fs.getPath("META-INF", "maven"); if (Files.exists(metaInfMaven)) { @@ -166,29 +156,23 @@ static Model readAppModel(Path appJar) throws AppCreatorException { } final Path pomXml = artifactIdPath.resolve("pom.xml"); if (Files.exists(pomXml)) { - final Model model; - try { - model = readModel(pomXml); - } catch (IOException e) { - throw new AppCreatorException("Failed to read " + pomXml, e); - } + final Model model = readModel(pomXml); Properties props = null; - if (model.getGroupId() == null) { + if(model.getGroupId() == null) { props = loadPomProps(appJar, artifactIdPath); final String groupId = props.getProperty("groupId"); - if (groupId == null) { - throw new AppCreatorException("Failed to determine groupId for " + appJar); + if(groupId == null) { + throw new IOException("Failed to determine groupId for " + appJar); } model.setGroupId(groupId); } - if (model.getVersion() == null) { - if (props == null) { + if(model.getVersion() == null) { + if(props == null) { props = loadPomProps(appJar, artifactIdPath); } final String version = props.getProperty("version"); - if (version == null) { - throw new AppCreatorException( - "Failed to determine the artifact version for " + appJar); + if(version == null) { + throw new IOException("Failed to determine the artifact version for " + appJar); } model.setVersion(version); } @@ -199,99 +183,35 @@ static Model readAppModel(Path appJar) throws AppCreatorException { } } } - throw new AppCreatorException("Failed to located META-INF/maven///pom.xml in " + appJar); - } catch (IOException e) { - throw new AppCreatorException("Failed to load pom.xml from " + appJar, e); + throw new IOException("Failed to located META-INF/maven///pom.xml in " + appJar); } } - private static Properties loadPomProps(Path appJar, Path artifactIdPath) throws AppCreatorException { + private static Properties loadPomProps(Path appJar, Path artifactIdPath) throws IOException { final Path propsPath = artifactIdPath.resolve("pom.properties"); - if (!Files.exists(propsPath)) { - throw new AppCreatorException( - "Failed to located META-INF/maven///pom.properties in " + appJar); + if(!Files.exists(propsPath)) { + throw new IOException("Failed to located META-INF/maven///pom.properties in " + appJar); } final Properties props = new Properties(); - try (BufferedReader reader = Files.newBufferedReader(propsPath)) { + try(BufferedReader reader = Files.newBufferedReader(propsPath)) { props.load(reader); - } catch (IOException e) { - throw new AppCreatorException("Failed to read " + propsPath, e); } return props; } - static Model readModel(final Path pomXml) throws IOException, AppCreatorException { - try (BufferedReader reader = Files.newBufferedReader(pomXml)) { + public static Model readModel(final Path pomXml) throws IOException { + try(BufferedReader reader = Files.newBufferedReader(pomXml)) { final MavenXpp3Reader xpp3Reader = new MavenXpp3Reader(); return xpp3Reader.read(reader); } catch (XmlPullParserException e) { - throw new AppCreatorException("Failed to parse application POM model", e); + throw new IOException("Failed to parse application POM model", e); } } - public static void persistModel(Path pomFile, Model model) throws AppCreatorException { + public static void persistModel(Path pomFile, Model model) throws IOException { final MavenXpp3Writer xpp3Writer = new MavenXpp3Writer(); try (BufferedWriter pomFileWriter = Files.newBufferedWriter(pomFile)) { xpp3Writer.write(pomFileWriter, model); - } catch (IOException e) { - throw new AppCreatorException("Faile to write the pom.xml file", e); - } - } - - private static class ArtifactKey { - final String groupId; - final String artifactId; - final String classifier; - - ArtifactKey(AppArtifact artifact) { - this.groupId = artifact.getGroupId(); - this.artifactId = artifact.getArtifactId(); - this.classifier = artifact.getClassifier(); - } - - ArtifactKey(Dependency artifact) { - this.groupId = artifact.getGroupId(); - this.artifactId = artifact.getArtifactId(); - final String classifier = artifact.getClassifier(); - this.classifier = classifier == null ? "" : classifier; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((artifactId == null) ? 0 : artifactId.hashCode()); - result = prime * result + ((classifier == null) ? 0 : classifier.hashCode()); - result = prime * result + ((groupId == null) ? 0 : groupId.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - ArtifactKey other = (ArtifactKey) obj; - if (artifactId == null) { - if (other.artifactId != null) - return false; - } else if (!artifactId.equals(other.artifactId)) - return false; - if (classifier == null) { - if (other.classifier != null) - return false; - } else if (!classifier.equals(other.classifier)) - return false; - if (groupId == null) { - if (other.groupId != null) - return false; - } else if (!groupId.equals(other.groupId)) - return false; - return true; } } - } diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/BootstrapUtils.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/BootstrapUtils.java new file mode 100644 index 0000000000000..fb2a78c48df03 --- /dev/null +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/BootstrapUtils.java @@ -0,0 +1,168 @@ +/* + * Copyright 2019 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap.util; + +import java.io.InputStream; +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.file.FileSystem; +import java.nio.file.FileSystems; +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.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.jar.Attributes; +import java.util.jar.Manifest; + +/** + * + * @author Alexey Loubyansky + */ +public class BootstrapUtils { + + public static int logUrls(ClassLoader cl) { + int depth = 0; + if(cl.getParent() != null) { + depth += logUrls(cl.getParent()); + } + final StringBuilder buf = new StringBuilder(); + final String offset; + if(depth == 0) { + offset = ""; + } else { + for (int i = 0; i < depth; ++i) { + buf.append(" "); + } + offset = buf.toString(); + } + if(!(cl instanceof java.net.URLClassLoader)) { + System.out.println(buf.append(cl.getClass().getName()).toString()); + } else { + final java.net.URL[] urls = ((java.net.URLClassLoader) cl).getURLs(); + final String[] urlStrs; + if (urls.length == 1) { + final Path p = Paths.get(urls[0].getFile()); + if(Files.isDirectory(p)) { + urlStrs = new String[] {urls[0].toExternalForm()}; + } else { + try (FileSystem fs = FileSystems.newFileSystem(p, null)) { + Path path = fs.getPath("META-INF/MANIFEST.MF"); + if (!Files.exists(path)) { + throw new IllegalStateException("Failed to locate the manifest"); + } + + final Manifest manifest; + try (InputStream input = Files.newInputStream(path)) { + manifest = new Manifest(input); + } + Attributes attrs = manifest.getMainAttributes(); + urlStrs = attrs.getValue("Class-Path").split("\\s+"); + } catch (Exception e1) { + throw new IllegalStateException("Failed to read MANIFEST.MF from " + urls[0]); + } + } + } else { + urlStrs = new String[urls.length]; + for (int i = 0; i < urls.length; ++i) { + final java.net.URL url = urls[i]; + urlStrs[i] = url.toExternalForm(); + } + } + java.util.Arrays.sort(urlStrs); + int i = 0; + System.out.println(offset + cl); + while(i < urlStrs.length) { + System.out.println(offset + (i + 1) + ") " + urlStrs[i++]); + } + + } + return depth + 1; + } + + public static void logUrlDiff(ClassLoader cl1, String cl1Header, ClassLoader cl2, String cl2Header) { + + final Set cl1Urls = new HashSet<>(); + collectUrls(cl1, cl1Urls); +/* + URLClassLoader classLoader = (URLClassLoader) cl1; + try(FileSystem fs = FileSystems.newFileSystem(Paths.get(classLoader.getURLs()[0].getFile()), null)) { + Path path = fs.getPath("META-INF/MANIFEST.MF"); + if(!Files.exists(path)) { + throw new IllegalStateException("Failed to locate the manifest"); + } + + final Manifest manifest; + try(InputStream input = Files.newInputStream(path)) { + manifest = new Manifest(input); + } + Attributes attrs = manifest.getMainAttributes(); + String[] urlStrs = attrs.getValue("Class-Path").split("\\s+"); + for(String urlStr : urlStrs) { + cl1Urls.add(new URL(urlStr).getFile()); + } + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } +*/ + final Set cl2Urls = new HashSet<>(); + collectUrls(cl2, cl2Urls); + + int commonUrls = 0; + Iterator i = cl1Urls.iterator(); + while(i.hasNext()) { + String next = i.next(); + if(cl2Urls.remove(next)) { + i.remove(); + ++commonUrls; + } + } + System.out.println("URLs not in " + cl2Header + ":"); + List list = new ArrayList<>(cl1Urls); + Collections.sort(list); + for(String s: list) { + System.out.println(s); + } + + System.out.println("URLs not in " + cl1Header + ":"); + list = new ArrayList<>(cl2Urls); + Collections.sort(list); + for(String s : list) { + System.out.println(s); + } + System.out.println("Common URLs: " + commonUrls); + } + + private static void collectUrls(ClassLoader cl, Set set) { + final ClassLoader parent = cl.getParent(); + if(parent != null) { + collectUrls(parent, set); + } + if(!(cl instanceof URLClassLoader)) { + return; + } + final URL[] urls = ((URLClassLoader)cl).getURLs(); + for(URL url : urls) { + set.add(url.getFile()); + } + } +} diff --git a/core/creator/src/main/java/io/quarkus/creator/util/IoUtils.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/IoUtils.java similarity index 94% rename from core/creator/src/main/java/io/quarkus/creator/util/IoUtils.java rename to independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/IoUtils.java index 59705591461ec..4c7919918b62c 100644 --- a/core/creator/src/main/java/io/quarkus/creator/util/IoUtils.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/IoUtils.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.quarkus.creator.util; +package io.quarkus.bootstrap.util; import java.io.BufferedReader; import java.io.IOException; @@ -36,6 +36,7 @@ import java.util.EnumSet; import java.util.UUID; + /** * * @author Alexey Loubyansky @@ -86,10 +87,9 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) } return FileVisitResult.CONTINUE; } - @Override public FileVisitResult postVisitDirectory(Path dir, IOException e) - throws IOException { + throws IOException { if (e == null) { try { Files.delete(dir); @@ -107,7 +107,7 @@ public FileVisitResult postVisitDirectory(Path dir, IOException e) } public static Path copy(Path source, Path target) throws IOException { - if (Files.isDirectory(source)) { + if(Files.isDirectory(source)) { Files.createDirectories(target); } else { Files.createDirectories(target.getParent()); @@ -116,21 +116,20 @@ public static Path copy(Path source, Path target) throws IOException { new SimpleFileVisitor() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) - throws IOException { + throws IOException { final Path targetDir = target.resolve(source.relativize(dir)); try { Files.copy(dir, targetDir); } catch (FileAlreadyExistsException e) { - if (!Files.isDirectory(targetDir)) { - throw e; - } + if (!Files.isDirectory(targetDir)) { + throw e; + } } return FileVisitResult.CONTINUE; } - @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) - throws IOException { + throws IOException { Files.copy(file, target.resolve(source.relativize(file)), StandardCopyOption.REPLACE_EXISTING); return FileVisitResult.CONTINUE; } diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/PropertyUtils.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/PropertyUtils.java new file mode 100644 index 0000000000000..d0cfaf18f5aa0 --- /dev/null +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/PropertyUtils.java @@ -0,0 +1,80 @@ +/* + * Copyright 2018 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap.util; + +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.Locale; + +/** +* +* @author Alexey Loubyansky +*/ +public class PropertyUtils { + + private static final String OS_NAME = "os.name"; + private static final String USER_HOME = "user.home"; + private static final String WINDOWS = "windows"; + + private static final String FALSE = "false"; + private static final String TRUE = "true"; + + private PropertyUtils() { + } + + public static boolean isWindows() { + return getProperty(OS_NAME).toLowerCase(Locale.ENGLISH).indexOf(WINDOWS) >= 0; + } + + public static String getUserHome() { + return getProperty(USER_HOME); + } + + public static String getProperty(final String name, String defValue) { + assert name != null : "name is null"; + final SecurityManager sm = System.getSecurityManager(); + if(sm != null) { + return AccessController.doPrivileged(new PrivilegedAction(){ + @Override + public String run() { + return System.getProperty(name, defValue); + }}); + } else { + return System.getProperty(name, defValue); + } + } + + public static String getProperty(final String name) { + assert name != null : "name is null"; + final SecurityManager sm = System.getSecurityManager(); + if(sm != null) { + return AccessController.doPrivileged(new PrivilegedAction(){ + @Override + public String run() { + return System.getProperty(name); + }}); + } else { + return System.getProperty(name); + } + } + + public static final boolean getBoolean(String name, boolean notFoundValue) { + final String value = getProperty(name, (notFoundValue ? TRUE : FALSE)); + return value.isEmpty() ? true : Boolean.parseBoolean(value); + } +} diff --git a/core/creator/src/main/java/io/quarkus/creator/util/ZipUtils.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/ZipUtils.java similarity index 84% rename from core/creator/src/main/java/io/quarkus/creator/util/ZipUtils.java rename to independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/ZipUtils.java index 294ba447f556b..5681715ae92b7 100644 --- a/core/creator/src/main/java/io/quarkus/creator/util/ZipUtils.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/ZipUtils.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.quarkus.creator.util; +package io.quarkus.bootstrap.util; import java.io.IOException; import java.net.URI; @@ -45,7 +45,9 @@ public class ZipUtils { public static void unzip(Path zipFile, Path targetDir) throws IOException { try { - Files.createDirectories(targetDir); + if (!Files.exists(targetDir)) { + Files.createDirectories(targetDir); + } } catch (FileAlreadyExistsException fae) { throw new IOException("Could not create directory '" + targetDir + "' as a file already exists with the same name"); } @@ -71,22 +73,20 @@ public static void copyFromZip(Path source, Path target) throws IOException { new SimpleFileVisitor() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) - throws IOException { + throws IOException { final Path targetDir = target.resolve(source.relativize(dir).toString()); try { Files.copy(dir, targetDir); } catch (FileAlreadyExistsException e) { - if (!Files.isDirectory(targetDir)) - throw e; + if (!Files.isDirectory(targetDir)) + throw e; } return FileVisitResult.CONTINUE; } - @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) - throws IOException { - Files.copy(file, target.resolve(source.relativize(file).toString()), - StandardCopyOption.REPLACE_EXISTING); + throws IOException { + Files.copy(file, target.resolve(source.relativize(file).toString()), StandardCopyOption.REPLACE_EXISTING); return FileVisitResult.CONTINUE; } }); @@ -94,9 +94,9 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) public static void zip(Path src, Path zipFile) throws IOException { try (FileSystem zipfs = newZip(zipFile)) { - if (Files.isDirectory(src)) { + if(Files.isDirectory(src)) { try (DirectoryStream stream = Files.newDirectoryStream(src)) { - for (Path srcPath : stream) { + for(Path srcPath : stream) { copyToZip(src, srcPath, zipfs); } } @@ -115,23 +115,21 @@ private static void copyToZip(Path srcRoot, Path srcPath, FileSystem zipfs) thro new SimpleFileVisitor() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) - throws IOException { + throws IOException { final Path targetDir = zipfs.getPath(srcRoot.relativize(dir).toString()); try { Files.copy(dir, targetDir); } catch (FileAlreadyExistsException e) { - if (!Files.isDirectory(targetDir)) { - throw e; - } + if (!Files.isDirectory(targetDir)) { + throw e; + } } return FileVisitResult.CONTINUE; } - @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) - throws IOException { - Files.copy(file, zipfs.getPath(srcRoot.relativize(file).toString()), - StandardCopyOption.REPLACE_EXISTING); + throws IOException { + Files.copy(file, zipfs.getPath(srcRoot.relativize(file).toString()), StandardCopyOption.REPLACE_EXISTING); return FileVisitResult.CONTINUE; } }); @@ -140,11 +138,10 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) /** * This call is not thread safe, a single of FileSystem can be created for the * profided uri until it is closed. - * * @param uri The uri to the zip file. * @param env Env map. * @return A new FileSystem. - * @throws IOException in case of a failure + * @throws IOException in case of a failure */ public static FileSystem newFileSystem(URI uri, Map env) throws IOException { // If Multi threading required, logic should be added to wrap this fs @@ -155,12 +152,11 @@ public static FileSystem newFileSystem(URI uri, Map env) throws IOExc /** * This call is thread safe, a new FS is created for each invocation. - * * @param path The zip file. * @return A new FileSystem instance - * @throws IOException in case of a failure + * @throws IOException in case of a failure */ - public static FileSystem newFileSystem(Path path) throws IOException { - return FileSystems.newFileSystem(path, null); - } + public static FileSystem newFileSystem(Path path) throws IOException { + return FileSystems.newFileSystem(path, null); + } } diff --git a/core/creator/src/test/java/io/quarkus/creator/resolver/test/CollectDependenciesBase.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/CollectDependenciesBase.java similarity index 55% rename from core/creator/src/test/java/io/quarkus/creator/resolver/test/CollectDependenciesBase.java rename to independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/CollectDependenciesBase.java index 9904eb458306a..0b4c1c60b28dc 100644 --- a/core/creator/src/test/java/io/quarkus/creator/resolver/test/CollectDependenciesBase.java +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/CollectDependenciesBase.java @@ -14,17 +14,18 @@ * limitations under the License. */ -package io.quarkus.creator.resolver.test; +package io.quarkus.bootstrap.resolver; import static org.junit.Assert.assertEquals; +import java.nio.file.Path; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.junit.Test; -import io.quarkus.creator.AppDependency; +import io.quarkus.bootstrap.model.AppDependency; /** * @@ -42,20 +43,33 @@ public void setup() throws Exception { setupDependencies(); } - protected abstract void setupDependencies(); + protected abstract void setupDependencies() throws Exception; @Test public void testCollectedDependencies() throws Exception { install(root); - final List resolvedDeps = resolver.collectDependencies(root.toAppArtifact()); + final List resolvedDeps = resolver.resolveModel(root.toAppArtifact()).getAllDependencies(); assertEquals(expectedResult, resolvedDeps); } - protected void install(TsArtifact dep, boolean collected) { - install(dep); - if (collected) { - addCollectedDep(dep); + protected TsArtifact install(TsArtifact dep, boolean collected) { + return install(dep, collected ? "compile" : null); + } + + protected TsArtifact install(TsArtifact dep, String collectedInScope) { + return install(dep, null, collectedInScope); + } + + protected TsArtifact install(TsArtifact dep, Path p, boolean collected) { + return install(dep, p, collected ? "compile" : null); + } + + protected TsArtifact install(TsArtifact dep, Path p, String collectedInScope) { + install(dep, p); + if(collectedInScope != null) { + addCollectedDep(dep, collectedInScope, false); } + return dep; } protected void installAsDep(TsArtifact dep) { @@ -63,31 +77,43 @@ protected void installAsDep(TsArtifact dep) { } protected void installAsDep(TsArtifact dep, boolean collected) { - installAsDep(new TsDependency(dep), collected); + installAsDep(dep, null, collected); + } + + protected void installAsDep(TsArtifact dep, Path p, boolean collected) { + installAsDep(new TsDependency(dep), p, collected); } protected void installAsDep(TsDependency dep) { - installAsDep(dep, true); + installAsDep(dep, null); + } + + protected void installAsDep(TsDependency dep, Path p) { + installAsDep(dep, p, true); } protected void installAsDep(TsDependency dep, boolean collected) { + installAsDep(dep, null, collected); + } + + protected void installAsDep(TsDependency dep, Path p, boolean collected) { final TsArtifact artifact = dep.artifact; - install(artifact); + install(artifact, p); root.addDependency(dep); - if (!collected) { + if(!collected) { return; } - addCollectedDep(artifact, dep.scope == null ? "compile" : dep.scope); + addCollectedDep(artifact, dep.scope == null ? "compile" : dep.scope, dep.optional); } protected void addCollectedDep(final TsArtifact artifact) { - addCollectedDep(artifact, "compile"); + addCollectedDep(artifact, "compile", false); } - protected void addCollectedDep(final TsArtifact artifact, final String scope) { - if (expectedResult.isEmpty()) { + protected void addCollectedDep(final TsArtifact artifact, final String scope, boolean optional) { + if(expectedResult.isEmpty()) { expectedResult = new ArrayList<>(); } - expectedResult.add(new AppDependency(artifact.toAppArtifact(), scope)); + expectedResult.add(new AppDependency(artifact.toAppArtifact(), scope, optional)); } } diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/PropsBuilder.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/PropsBuilder.java new file mode 100644 index 0000000000000..864c49fa15004 --- /dev/null +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/PropsBuilder.java @@ -0,0 +1,44 @@ +/* + * Copyright 2019 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap.resolver; + +import java.util.Properties; + +/** + * + * @author Alexey Loubyansky + */ +public class PropsBuilder { + + public static PropsBuilder init(String name, String value) { + return new PropsBuilder().set(name, value); + } + + private final Properties props = new Properties(); + + private PropsBuilder() { + } + + public PropsBuilder set(String name, String value) { + props.setProperty(name, value); + return this; + } + + public Properties build() { + return props; + } +} diff --git a/core/creator/src/test/java/io/quarkus/creator/resolver/test/ResolverSetupCleanup.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/ResolverSetupCleanup.java similarity index 62% rename from core/creator/src/test/java/io/quarkus/creator/resolver/test/ResolverSetupCleanup.java rename to independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/ResolverSetupCleanup.java index c135f91e91b73..096e3dc7139cd 100644 --- a/core/creator/src/test/java/io/quarkus/creator/resolver/test/ResolverSetupCleanup.java +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/ResolverSetupCleanup.java @@ -15,20 +15,17 @@ * limitations under the License. */ -package io.quarkus.creator.resolver.test; +package io.quarkus.bootstrap.resolver; import java.nio.file.Path; -import java.util.Collections; -import java.util.List; +import java.util.UUID; +import io.quarkus.bootstrap.resolver.AppModelResolverException; +import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver; +import io.quarkus.bootstrap.util.IoUtils; import org.junit.After; import org.junit.Before; -import io.quarkus.creator.AppCreatorException; -import io.quarkus.creator.AppDependency; -import io.quarkus.creator.resolver.aether.AetherArtifactResolver; -import io.quarkus.creator.util.IoUtils; - /** * * @author Alexey Loubyansky @@ -37,30 +34,42 @@ public class ResolverSetupCleanup { protected Path workDir; protected Path repoHome; - protected AetherArtifactResolver resolver; + protected BootstrapAppModelResolver resolver; protected TsRepoBuilder repo; @Before public void setup() throws Exception { workDir = IoUtils.createRandomTmpDir(); repoHome = IoUtils.mkdirs(workDir.resolve("repo")); - resolver = AetherArtifactResolver.getInstance(repoHome, Collections.emptyList()); + resolver = initResolver(); repo = TsRepoBuilder.getInstance(resolver, workDir); } @After public void cleanup() { - if (workDir != null) { + if(workDir != null) { IoUtils.recursiveDelete(workDir); } } + protected BootstrapAppModelResolver initResolver() throws AppModelResolverException { + return new BootstrapAppModelResolver(MavenArtifactResolver.builder() + .setRepoHome(repoHome) + .setOffline(true) + .build()); + } + + protected TsJar newJar() { + return new TsJar(workDir.resolve(UUID.randomUUID().toString())); + } + protected TsArtifact install(TsArtifact artifact) { repo.install(artifact); return artifact; } - protected List collectDeps(TsArtifact artifact) throws AppCreatorException { - return resolver.collectDependencies(artifact.toAppArtifact()); + protected TsArtifact install(TsArtifact artifact, Path p) { + repo.install(artifact, p); + return artifact; } } diff --git a/core/creator/src/test/java/io/quarkus/creator/resolver/test/TsArtifact.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/TsArtifact.java similarity index 72% rename from core/creator/src/test/java/io/quarkus/creator/resolver/test/TsArtifact.java rename to independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/TsArtifact.java index a5afc0dfa04fb..53c138850dd5e 100644 --- a/core/creator/src/test/java/io/quarkus/creator/resolver/test/TsArtifact.java +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/TsArtifact.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.quarkus.creator.resolver.test; +package io.quarkus.bootstrap.resolver; import java.util.ArrayList; import java.util.Collections; @@ -22,7 +22,7 @@ import org.apache.maven.model.Model; -import io.quarkus.creator.AppArtifact; +import io.quarkus.bootstrap.model.AppArtifact; /** * @@ -30,14 +30,23 @@ */ public class TsArtifact { - static final String DEFAULT_GROUP_ID = "org.quarkus.creator.test"; + public static final String DEFAULT_GROUP_ID = "org.quarkus.creator.test"; + public static final String DEFAULT_VERSION = "1"; - public static TsArtifact getGa(String groupId, String artifactId) { + public static TsArtifact ga(String artifactId) { + return ga(DEFAULT_GROUP_ID, artifactId); + } + + public static TsArtifact ga(String groupId, String artifactId) { return new TsArtifact(groupId, artifactId, null); } - public static TsArtifact getGa(String artifactId) { - return getGa(DEFAULT_GROUP_ID, artifactId); + public static TsArtifact jar(String artifactId) { + return jar(artifactId, DEFAULT_VERSION); + } + + public static TsArtifact jar(String artifactId, String version) { + return new TsArtifact(DEFAULT_GROUP_ID, artifactId, "", "jar", version); } protected final String groupId; @@ -49,7 +58,7 @@ public static TsArtifact getGa(String artifactId) { private List deps = Collections.emptyList(); public TsArtifact(String artifactId) { - this(artifactId, "1"); + this(artifactId, DEFAULT_VERSION); } public TsArtifact(String artifactId, String version) { @@ -73,7 +82,7 @@ public TsArtifact addDependency(TsArtifact dep) { } public TsArtifact addDependency(TsDependency dep) { - if (deps.isEmpty()) { + if(deps.isEmpty()) { deps = new ArrayList<>(); } deps.add(dep); @@ -81,18 +90,18 @@ public TsArtifact addDependency(TsDependency dep) { } public String getArtifactFileName() { - if (artifactId == null) { + if(artifactId == null) { throw new IllegalArgumentException("artifactId is missing"); } - if (version == null) { + if(version == null) { throw new IllegalArgumentException("version is missing"); } - if (type == null) { + if(type == null) { throw new IllegalArgumentException("type is missing"); } final StringBuilder fileName = new StringBuilder(); fileName.append(artifactId).append('-').append(version); - if (classifier != null && !classifier.isEmpty()) { + if(classifier != null && !classifier.isEmpty()) { fileName.append('-').append(classifier); } fileName.append('.').append(type); @@ -112,7 +121,7 @@ public Model getPomModel() { model.setPackaging(type); model.setVersion(version); - if (!deps.isEmpty()) { + if(!deps.isEmpty()) { for (TsDependency dep : deps) { model.addDependency(dep.toPomDependency()); } @@ -124,4 +133,11 @@ public Model getPomModel() { public AppArtifact toAppArtifact() { return new AppArtifact(groupId, artifactId, classifier, type, version); } + + @Override + public String toString() { + final StringBuilder buf = new StringBuilder(128); + buf.append(groupId).append(':').append(artifactId).append(':').append(classifier).append(':').append(type).append(':').append(version); + return buf.toString(); + } } diff --git a/core/creator/src/test/java/io/quarkus/creator/resolver/test/TsDependency.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/TsDependency.java similarity index 88% rename from core/creator/src/test/java/io/quarkus/creator/resolver/test/TsDependency.java rename to independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/TsDependency.java index f9e307be6dfe7..aa4333dc52985 100644 --- a/core/creator/src/test/java/io/quarkus/creator/resolver/test/TsDependency.java +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/TsDependency.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.quarkus.creator.resolver.test; +package io.quarkus.bootstrap.resolver; import java.util.ArrayList; import java.util.Collections; @@ -53,15 +53,15 @@ public TsDependency(TsArtifact artifact, String scope, boolean optional) { } public TsDependency exclude(String artifactId) { - return exclude(TsArtifact.getGa(artifactId)); + return exclude(TsArtifact.ga(artifactId)); } public TsDependency exclude(String groupId, String artifactId) { - return exclude(TsArtifact.getGa(groupId, artifactId)); + return exclude(TsArtifact.ga(groupId, artifactId)); } public TsDependency exclude(TsArtifact artifact) { - if (excluded.isEmpty()) { + if(excluded.isEmpty()) { excluded = new ArrayList<>(); } excluded.add(artifact); @@ -78,14 +78,14 @@ public Dependency toPomDependency() { } dep.setType(artifact.type); dep.setVersion(artifact.version); - if (scope != null) { + if(scope != null) { dep.setScope(scope); } - if (optional) { + if(optional) { dep.setOptional(optional); } - if (!excluded.isEmpty()) { - for (TsArtifact excluded : excluded) { + if(!excluded.isEmpty()) { + for(TsArtifact excluded : excluded) { final Exclusion exclusion = new Exclusion(); exclusion.setGroupId(excluded.groupId); exclusion.setArtifactId(excluded.artifactId); diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/TsJar.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/TsJar.java new file mode 100644 index 0000000000000..431d536dc466b --- /dev/null +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/TsJar.java @@ -0,0 +1,85 @@ +/* + * Copyright 2019 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap.resolver; + +import java.io.BufferedWriter; +import java.io.IOException; +import java.nio.file.FileSystem; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Properties; + +import io.quarkus.bootstrap.util.ZipUtils; + +/** + * + * @author Alexey Loubyansky + */ +public class TsJar { + + private final Path target; + + public TsJar(Path target) { + this.target = target; + } + + public Path getPath() { + return target; + } + + public TsJar addFile(String content, String... path) throws IOException { + try (FileSystem zip = openZip()) { + try (BufferedWriter writer = Files.newBufferedWriter(getPath(zip, path))) { + writer.write(content); + } + } catch (Throwable t) { + throw t; + } + return this; + } + + public TsJar addFile(Properties props, String... path) throws IOException { + try (FileSystem zip = openZip()) { + final Path p = getPath(zip, path); + Files.createDirectories(p.getParent()); + try (BufferedWriter writer = Files.newBufferedWriter(p)) { + props.store(writer, "Written by TsJarBuilder"); + } + } catch (Throwable t) { + throw t; + } + return this; + } + + private Path getPath(FileSystem zip, String... path) { + Path p = zip.getPath(path[0]); + if(path.length > 1) { + for(int i = 1; i < path.length; ++i) { + p = p.resolve(path[i]); + } + } + return p; + } + + private FileSystem openZip() throws IOException { + if(Files.exists(target)) { + return ZipUtils.newFileSystem(target); + } + Files.createDirectories(target.getParent()); + return ZipUtils.newZip(target); + } +} diff --git a/core/creator/src/test/java/io/quarkus/creator/resolver/test/TsRepoBuilder.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/TsRepoBuilder.java similarity index 70% rename from core/creator/src/test/java/io/quarkus/creator/resolver/test/TsRepoBuilder.java rename to independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/TsRepoBuilder.java index 9dd5850ac8d5e..ecd2277fa70d3 100644 --- a/core/creator/src/test/java/io/quarkus/creator/resolver/test/TsRepoBuilder.java +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/TsRepoBuilder.java @@ -15,17 +15,16 @@ * limitations under the License. */ -package io.quarkus.creator.resolver.test; +package io.quarkus.bootstrap.resolver; import java.io.BufferedWriter; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import io.quarkus.creator.AppArtifact; -import io.quarkus.creator.AppCreatorException; -import io.quarkus.creator.phase.curate.Utils; -import io.quarkus.creator.resolver.aether.AetherArtifactResolver; +import io.quarkus.bootstrap.model.AppArtifact; +import io.quarkus.bootstrap.resolver.AppModelResolverException; +import io.quarkus.bootstrap.resolver.maven.workspace.ModelUtils; /** * @@ -37,43 +36,47 @@ private static void error(String message, Throwable t) { throw new IllegalStateException(message, t); } - public static TsRepoBuilder getInstance(AetherArtifactResolver resolver, Path workDir) { + public static TsRepoBuilder getInstance(BootstrapAppModelResolver resolver, Path workDir) { return new TsRepoBuilder(resolver, workDir); } private final Path workDir; - private final AetherArtifactResolver resolver; + private final BootstrapAppModelResolver resolver; - private TsRepoBuilder(AetherArtifactResolver resolver, Path workDir) { + private TsRepoBuilder(BootstrapAppModelResolver resolver, Path workDir) { this.resolver = resolver; this.workDir = workDir; } public void install(TsArtifact artifact) { + install(artifact, null); + } + + public void install(TsArtifact artifact, Path p) { final Path pomXml = workDir.resolve(artifact.getArtifactFileName() + ".pom"); try { - Utils.persistModel(pomXml, artifact.getPomModel()); - } catch (AppCreatorException e) { + ModelUtils.persistModel(pomXml, artifact.getPomModel()); + } catch (Exception e) { error("Failed to persist pom.xml for " + artifact, e); } install(artifact.toPomArtifact().toAppArtifact(), pomXml); - install(artifact.toAppArtifact(), newTxt(artifact)); + install(artifact.toAppArtifact(), p == null ? newTxt(artifact) : p); } protected void install(AppArtifact artifact, Path file) { try { resolver.install(artifact, file); - } catch (AppCreatorException e) { + } catch (AppModelResolverException e) { error("Failed to install " + artifact, e); } } protected Path newTxt(TsArtifact artifact) { final Path tmpFile = workDir.resolve(artifact.getArtifactFileName()); - if (Files.exists(tmpFile)) { + if(Files.exists(tmpFile)) { throw new IllegalStateException("File already exists " + tmpFile); } - try (BufferedWriter writer = Files.newBufferedWriter(tmpFile)) { + try(BufferedWriter writer = Files.newBufferedWriter(tmpFile)) { writer.write(tmpFile.getFileName().toString()); } catch (IOException e) { throw new IllegalStateException("Failed to create file " + tmpFile, e); 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 new file mode 100644 index 0000000000000..0a86813e81258 --- /dev/null +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/graph/parser/test/DependencyGraphParserTestCase.java @@ -0,0 +1,12 @@ +/** + * + */ +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/replace/test/SimpleReplacedDependencyTestCase.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/replace/test/SimpleReplacedDependencyTestCase.java new file mode 100644 index 0000000000000..5a45e269c3f9b --- /dev/null +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/replace/test/SimpleReplacedDependencyTestCase.java @@ -0,0 +1,46 @@ +/* + * Copyright 2019 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.bootstrap.resolver.replace.test; + +import io.quarkus.bootstrap.BootstrapConstants; +import io.quarkus.bootstrap.resolver.CollectDependenciesBase; +import io.quarkus.bootstrap.resolver.PropsBuilder; +import io.quarkus.bootstrap.resolver.TsArtifact; + +/** + * + * @author Alexey Loubyansky + */ +public class SimpleReplacedDependencyTestCase extends CollectDependenciesBase { + + @Override + protected void setupDependencies() throws Exception { + + final TsArtifact extension = TsArtifact.jar("extension"); + final TsArtifact deployment = new TsArtifact("deployment").addDependency(extension); + + installAsDep( + extension, + newJar().addFile( + PropsBuilder.init(BootstrapConstants.PROP_DEPLOYMENT_ARTIFACT, deployment.toString()).build(), + BootstrapConstants.QUARKUS, BootstrapConstants.DESCRIPTOR_PATH) + .getPath(), + true); + + install(deployment, true); + } +} diff --git a/core/creator/src/test/java/io/quarkus/creator/resolver/test/DependenciesOnDifferentVersionsOfAnArtifactTestCase.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DependenciesOnDifferentVersionsOfAnArtifactTestCase.java similarity index 87% rename from core/creator/src/test/java/io/quarkus/creator/resolver/test/DependenciesOnDifferentVersionsOfAnArtifactTestCase.java rename to independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DependenciesOnDifferentVersionsOfAnArtifactTestCase.java index 33c2ec2e92065..133dceaf2ec4f 100644 --- a/core/creator/src/test/java/io/quarkus/creator/resolver/test/DependenciesOnDifferentVersionsOfAnArtifactTestCase.java +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DependenciesOnDifferentVersionsOfAnArtifactTestCase.java @@ -14,7 +14,10 @@ * limitations under the License. */ -package io.quarkus.creator.resolver.test; +package io.quarkus.bootstrap.resolver.test; + +import io.quarkus.bootstrap.resolver.CollectDependenciesBase; +import io.quarkus.bootstrap.resolver.TsArtifact; /** * diff --git a/core/creator/src/test/java/io/quarkus/creator/resolver/test/DependencyPresentTwiceInTheGraphInCompileAndProvidedScopesTestCase.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DependencyPresentTwiceInTheGraphInCompileAndProvidedScopesTestCase.java similarity index 86% rename from core/creator/src/test/java/io/quarkus/creator/resolver/test/DependencyPresentTwiceInTheGraphInCompileAndProvidedScopesTestCase.java rename to independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DependencyPresentTwiceInTheGraphInCompileAndProvidedScopesTestCase.java index 3a9b9cdd0284d..996f07baee2b1 100644 --- a/core/creator/src/test/java/io/quarkus/creator/resolver/test/DependencyPresentTwiceInTheGraphInCompileAndProvidedScopesTestCase.java +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DependencyPresentTwiceInTheGraphInCompileAndProvidedScopesTestCase.java @@ -14,7 +14,11 @@ * limitations under the License. */ -package io.quarkus.creator.resolver.test; +package io.quarkus.bootstrap.resolver.test; + +import io.quarkus.bootstrap.resolver.CollectDependenciesBase; +import io.quarkus.bootstrap.resolver.TsArtifact; +import io.quarkus.bootstrap.resolver.TsDependency; /** * diff --git a/core/creator/src/test/java/io/quarkus/creator/resolver/test/DependencyPresentTwiceInTheGraphInCompileAndTestScopesTestCase.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DependencyPresentTwiceInTheGraphInCompileAndTestScopesTestCase.java similarity index 84% rename from core/creator/src/test/java/io/quarkus/creator/resolver/test/DependencyPresentTwiceInTheGraphInCompileAndTestScopesTestCase.java rename to independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DependencyPresentTwiceInTheGraphInCompileAndTestScopesTestCase.java index 25fd014d29859..8d65cd2ad6bb3 100644 --- a/core/creator/src/test/java/io/quarkus/creator/resolver/test/DependencyPresentTwiceInTheGraphInCompileAndTestScopesTestCase.java +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DependencyPresentTwiceInTheGraphInCompileAndTestScopesTestCase.java @@ -14,7 +14,11 @@ * limitations under the License. */ -package io.quarkus.creator.resolver.test; +package io.quarkus.bootstrap.resolver.test; + +import io.quarkus.bootstrap.resolver.CollectDependenciesBase; +import io.quarkus.bootstrap.resolver.TsArtifact; +import io.quarkus.bootstrap.resolver.TsDependency; /** * diff --git a/core/creator/src/test/java/io/quarkus/creator/resolver/test/DependencyPresentTwiceInTheGraphTestCase.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DependencyPresentTwiceInTheGraphTestCase.java similarity index 87% rename from core/creator/src/test/java/io/quarkus/creator/resolver/test/DependencyPresentTwiceInTheGraphTestCase.java rename to independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DependencyPresentTwiceInTheGraphTestCase.java index e8cc87d55e427..519a3214b6a64 100644 --- a/core/creator/src/test/java/io/quarkus/creator/resolver/test/DependencyPresentTwiceInTheGraphTestCase.java +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DependencyPresentTwiceInTheGraphTestCase.java @@ -14,7 +14,10 @@ * limitations under the License. */ -package io.quarkus.creator.resolver.test; +package io.quarkus.bootstrap.resolver.test; + +import io.quarkus.bootstrap.resolver.CollectDependenciesBase; +import io.quarkus.bootstrap.resolver.TsArtifact; /** * diff --git a/core/creator/src/test/java/io/quarkus/creator/resolver/test/DependencyPresentTwiceInTheGraphWithDifferentClassifierAndTypeTestCase.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DependencyPresentTwiceInTheGraphWithDifferentClassifierAndTypeTestCase.java similarity index 90% rename from core/creator/src/test/java/io/quarkus/creator/resolver/test/DependencyPresentTwiceInTheGraphWithDifferentClassifierAndTypeTestCase.java rename to independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DependencyPresentTwiceInTheGraphWithDifferentClassifierAndTypeTestCase.java index 578fa31233983..27a5bf1e8029d 100644 --- a/core/creator/src/test/java/io/quarkus/creator/resolver/test/DependencyPresentTwiceInTheGraphWithDifferentClassifierAndTypeTestCase.java +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DependencyPresentTwiceInTheGraphWithDifferentClassifierAndTypeTestCase.java @@ -14,7 +14,10 @@ * limitations under the License. */ -package io.quarkus.creator.resolver.test; +package io.quarkus.bootstrap.resolver.test; + +import io.quarkus.bootstrap.resolver.CollectDependenciesBase; +import io.quarkus.bootstrap.resolver.TsArtifact; /** * diff --git a/core/creator/src/test/java/io/quarkus/creator/resolver/test/DirectDependencyVersionOverridesTransitiveVersionTestCase.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DirectDependencyVersionOverridesTransitiveVersionTestCase.java similarity index 86% rename from core/creator/src/test/java/io/quarkus/creator/resolver/test/DirectDependencyVersionOverridesTransitiveVersionTestCase.java rename to independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DirectDependencyVersionOverridesTransitiveVersionTestCase.java index f94444c29c0a9..64d7ef66f0db6 100644 --- a/core/creator/src/test/java/io/quarkus/creator/resolver/test/DirectDependencyVersionOverridesTransitiveVersionTestCase.java +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DirectDependencyVersionOverridesTransitiveVersionTestCase.java @@ -14,7 +14,10 @@ * limitations under the License. */ -package io.quarkus.creator.resolver.test; +package io.quarkus.bootstrap.resolver.test; + +import io.quarkus.bootstrap.resolver.CollectDependenciesBase; +import io.quarkus.bootstrap.resolver.TsArtifact; /** * diff --git a/core/creator/src/test/java/io/quarkus/creator/resolver/test/TransitiveNonOptionalOverridesDirectOptionalVersionTestCase.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DirectOptionalOverridesTransitiveNonOptionalVersionTestCase.java similarity index 70% rename from core/creator/src/test/java/io/quarkus/creator/resolver/test/TransitiveNonOptionalOverridesDirectOptionalVersionTestCase.java rename to independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DirectOptionalOverridesTransitiveNonOptionalVersionTestCase.java index 6d3a932381736..65a54010ce1d3 100644 --- a/core/creator/src/test/java/io/quarkus/creator/resolver/test/TransitiveNonOptionalOverridesDirectOptionalVersionTestCase.java +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/DirectOptionalOverridesTransitiveNonOptionalVersionTestCase.java @@ -14,23 +14,24 @@ * limitations under the License. */ -package io.quarkus.creator.resolver.test; +package io.quarkus.bootstrap.resolver.test; + +import io.quarkus.bootstrap.resolver.CollectDependenciesBase; +import io.quarkus.bootstrap.resolver.TsArtifact; +import io.quarkus.bootstrap.resolver.TsDependency; /** * * @author Alexey Loubyansky */ -public class TransitiveNonOptionalOverridesDirectOptionalVersionTestCase extends CollectDependenciesBase { +public class DirectOptionalOverridesTransitiveNonOptionalVersionTestCase extends CollectDependenciesBase { @Override protected void setupDependencies() { - final TsArtifact common1 = new TsArtifact("common", "1"); - install(common1, true); - installAsDep(new TsArtifact("required-a") - .addDependency(common1), true); + .addDependency(new TsArtifact("common", "1")), true); - installAsDep(new TsDependency(new TsArtifact("common", "2"), true), false); + installAsDep(new TsDependency(new TsArtifact("common", "2"), true), true); } } diff --git a/core/creator/src/test/java/io/quarkus/creator/resolver/test/ExclusionsTestCase.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/ExclusionsTestCase.java similarity index 72% rename from core/creator/src/test/java/io/quarkus/creator/resolver/test/ExclusionsTestCase.java rename to independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/ExclusionsTestCase.java index 8646561656e4b..ee068cc79593b 100644 --- a/core/creator/src/test/java/io/quarkus/creator/resolver/test/ExclusionsTestCase.java +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/ExclusionsTestCase.java @@ -14,7 +14,11 @@ * limitations under the License. */ -package io.quarkus.creator.resolver.test; +package io.quarkus.bootstrap.resolver.test; + +import io.quarkus.bootstrap.resolver.CollectDependenciesBase; +import io.quarkus.bootstrap.resolver.TsArtifact; +import io.quarkus.bootstrap.resolver.TsDependency; /** * @@ -28,7 +32,8 @@ protected void setupDependencies() { final TsArtifact requiredTransitive = new TsArtifact("required-transitive") .addDependency( new TsArtifact("excluded-dep", "2") - .addDependency(new TsArtifact("other-dep"))); + .addDependency(new TsArtifact("other-dep")) + ); install(requiredTransitive, true); final TsArtifact otherDep2 = new TsArtifact("other-dep", "2"); @@ -40,9 +45,10 @@ protected void setupDependencies() { installAsDep( new TsArtifact("required-dep1") - .addDependency( - new TsDependency(requiredTransitive) - .exclude("excluded-dep")) - .addDependency(otherRequiredTransitive)); + .addDependency( + new TsDependency(requiredTransitive) + .exclude("excluded-dep")) + .addDependency(otherRequiredTransitive) + ); } } diff --git a/core/creator/src/test/java/io/quarkus/creator/resolver/test/OptionalDepsNotCollectedTestCase.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/OnlyDirectOptionalDepsAreCollectedTestCase.java similarity index 66% rename from core/creator/src/test/java/io/quarkus/creator/resolver/test/OptionalDepsNotCollectedTestCase.java rename to independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/OnlyDirectOptionalDepsAreCollectedTestCase.java index dcfa974bfb1eb..b6cd2a8e40aed 100644 --- a/core/creator/src/test/java/io/quarkus/creator/resolver/test/OptionalDepsNotCollectedTestCase.java +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/OnlyDirectOptionalDepsAreCollectedTestCase.java @@ -14,13 +14,17 @@ * limitations under the License. */ -package io.quarkus.creator.resolver.test; +package io.quarkus.bootstrap.resolver.test; + +import io.quarkus.bootstrap.resolver.CollectDependenciesBase; +import io.quarkus.bootstrap.resolver.TsArtifact; +import io.quarkus.bootstrap.resolver.TsDependency; /** * * @author Alexey Loubyansky */ -public class OptionalDepsNotCollectedTestCase extends CollectDependenciesBase { +public class OnlyDirectOptionalDepsAreCollectedTestCase extends CollectDependenciesBase { @Override protected void setupDependencies() { @@ -30,13 +34,12 @@ protected void setupDependencies() { installAsDep( new TsDependency( new TsArtifact("optional-dep") - .addDependency(new TsArtifact("common", "1")), + .addDependency(new TsDependency(new TsArtifact("common", "1"), true)) + .addDependency(new TsDependency(new TsArtifact("other", "1"), true)), true), - false); - - final TsArtifact common2 = new TsArtifact("common", "2"); - install(common2, true); + true); + TsArtifact common2 = install(new TsArtifact("common", "2"), true); installAsDep(new TsArtifact("required-dep-c") .addDependency(common2), true); } diff --git a/core/creator/src/test/java/io/quarkus/creator/resolver/test/OnlyDirectProvidedDepsAreCollectedTestCase.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/ProvidedScopeDepsAreNotCollectedTestCase.java similarity index 69% rename from core/creator/src/test/java/io/quarkus/creator/resolver/test/OnlyDirectProvidedDepsAreCollectedTestCase.java rename to independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/ProvidedScopeDepsAreNotCollectedTestCase.java index 68a347a913574..ddb3bf6696799 100644 --- a/core/creator/src/test/java/io/quarkus/creator/resolver/test/OnlyDirectProvidedDepsAreCollectedTestCase.java +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/ProvidedScopeDepsAreNotCollectedTestCase.java @@ -14,13 +14,17 @@ * limitations under the License. */ -package io.quarkus.creator.resolver.test; +package io.quarkus.bootstrap.resolver.test; + +import io.quarkus.bootstrap.resolver.CollectDependenciesBase; +import io.quarkus.bootstrap.resolver.TsArtifact; +import io.quarkus.bootstrap.resolver.TsDependency; /** * * @author Alexey Loubyansky */ -public class OnlyDirectProvidedDepsAreCollectedTestCase extends CollectDependenciesBase { +public class ProvidedScopeDepsAreNotCollectedTestCase extends CollectDependenciesBase { @Override protected void setupDependencies() { @@ -31,7 +35,8 @@ protected void setupDependencies() { final TsArtifact common1 = new TsArtifact("common", "1") .addDependency( new TsDependency( - notCollected, "provided")); + notCollected, "provided") + ); install(common1, true); installAsDep(new TsArtifact("required-dep") @@ -41,9 +46,10 @@ protected void setupDependencies() { installAsDep( new TsDependency( new TsArtifact("provided-dep") - .addDependency( - new TsArtifact("common", "2")), + .addDependency( + new TsArtifact("common", "2") + ), "provided"), - true); + false); } } diff --git a/core/creator/src/test/java/io/quarkus/creator/resolver/test/TestScopeNotCollectedTestCase.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/TestScopeIsNotAmongRuntimeDependenciesTestCase.java similarity index 62% rename from core/creator/src/test/java/io/quarkus/creator/resolver/test/TestScopeNotCollectedTestCase.java rename to independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/TestScopeIsNotAmongRuntimeDependenciesTestCase.java index b4554dee6a054..68df26b0b2d18 100644 --- a/core/creator/src/test/java/io/quarkus/creator/resolver/test/TestScopeNotCollectedTestCase.java +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/TestScopeIsNotAmongRuntimeDependenciesTestCase.java @@ -14,13 +14,17 @@ * limitations under the License. */ -package io.quarkus.creator.resolver.test; +package io.quarkus.bootstrap.resolver.test; + +import io.quarkus.bootstrap.resolver.CollectDependenciesBase; +import io.quarkus.bootstrap.resolver.TsArtifact; +import io.quarkus.bootstrap.resolver.TsDependency; /** * * @author Alexey Loubyansky */ -public class TestScopeNotCollectedTestCase extends CollectDependenciesBase { +public class TestScopeIsNotAmongRuntimeDependenciesTestCase extends CollectDependenciesBase { @Override protected void setupDependencies() { @@ -29,17 +33,17 @@ protected void setupDependencies() { installAsDep( new TsDependency( - new TsArtifact("test-dep") - .addDependency(new TsArtifact("common", "1")), + new TsArtifact("direct-test-dep") + .addDependency(new TsArtifact("common", "1") + .addDependency(new TsDependency(new TsArtifact("not-collected"), "test"))), "test"), false); - final TsArtifact common2 = new TsArtifact("common", "2"); - install(common2, true); + final TsArtifact common = install(new TsArtifact("common", "2"), true); installAsDep( new TsArtifact("required-dep-c") - .addDependency(common2), + .addDependency(common), true); } } diff --git a/core/creator/src/test/java/io/quarkus/creator/resolver/test/TransitiveVersionOverridesTestCase.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/TransitiveVersionOverridesTestCase.java similarity index 89% rename from core/creator/src/test/java/io/quarkus/creator/resolver/test/TransitiveVersionOverridesTestCase.java rename to independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/TransitiveVersionOverridesTestCase.java index b33f46f146402..f43fa7d68d14d 100644 --- a/core/creator/src/test/java/io/quarkus/creator/resolver/test/TransitiveVersionOverridesTestCase.java +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/resolver/test/TransitiveVersionOverridesTestCase.java @@ -14,7 +14,10 @@ * limitations under the License. */ -package io.quarkus.creator.resolver.test; +package io.quarkus.bootstrap.resolver.test; + +import io.quarkus.bootstrap.resolver.CollectDependenciesBase; +import io.quarkus.bootstrap.resolver.TsArtifact; /** * diff --git a/independent-projects/bootstrap/maven-plugin/pom.xml b/independent-projects/bootstrap/maven-plugin/pom.xml new file mode 100644 index 0000000000000..44d2198181808 --- /dev/null +++ b/independent-projects/bootstrap/maven-plugin/pom.xml @@ -0,0 +1,77 @@ + + + + 4.0.0 + + + io.quarkus.bootstrap + bootstrap-parent + 999-SNAPSHOT + ../ + + + bootstrap-maven-plugin + Quarkus Bootstrap Maven plugin + maven-plugin + + + 3.5.2 + + + + + + org.apache.maven.plugins + maven-plugin-plugin + ${version.maven-plugin-plugin} + + + default-descriptor + process-classes + + + + + + + + + + ${project.groupId} + bootstrap-core + + + + org.apache.maven + maven-plugin-api + + + + org.apache.maven.plugin-tools + maven-plugin-annotations + + + + org.apache.maven + maven-core + + + + + 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 new file mode 100644 index 0000000000000..6e011ac505db5 --- /dev/null +++ b/independent-projects/bootstrap/maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java @@ -0,0 +1,170 @@ +/* + * Copyright 2019 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.quarkus.maven; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.Properties; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.collection.CollectRequest; +import org.eclipse.aether.collection.DependencyCollectionException; +import org.eclipse.aether.graph.Dependency; +import org.eclipse.aether.graph.DependencyNode; +import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.resolution.ArtifactDescriptorException; +import org.eclipse.aether.resolution.ArtifactDescriptorRequest; +import org.eclipse.aether.resolution.ArtifactDescriptorResult; +import io.quarkus.bootstrap.BootstrapConstants; +import io.quarkus.bootstrap.resolver.maven.DependencyGraphParser; + +/** + * + * @author Alexey Loubyansky + */ +@Mojo(name = "extension-descriptor", defaultPhase = LifecyclePhase.COMPILE, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) +public class ExtensionDescriptorMojo extends AbstractMojo { + + /** + * The entry point to Aether, i.e. the component doing all the work. + * + * @component + */ + @Component + private RepositorySystem repoSystem; + + /** + * The current repository/network configuration of Maven. + * + * @parameter default-value="${repositorySystemSession}" + * @readonly + */ + @Parameter(defaultValue = "${repositorySystemSession}", readonly = true) + private RepositorySystemSession repoSession; + + /** + * The project's remote repositories to use for the resolution of artifacts and their dependencies. + * + * @parameter default-value="${project.remoteProjectRepositories}" + * @readonly + */ + @Parameter( defaultValue = "${project.remoteProjectRepositories}", readonly = true, required = true ) + private List repos; + + /** + * The directory for compiled classes. + */ + @Parameter(readonly = true, required = true, defaultValue = "${project.build.outputDirectory}") + private File outputDirectory; + + @Parameter(required = true) + private String deployment; + + @Override + public void execute() throws MojoExecutionException, MojoFailureException { + + final Properties props = new Properties(); + props.setProperty(BootstrapConstants.PROP_DEPLOYMENT_ARTIFACT, deployment); + + final Path output = outputDirectory.toPath().resolve(BootstrapConstants.QUARKUS); + try { + Files.createDirectories(output); + try (BufferedWriter writer = Files.newBufferedWriter(output.resolve(BootstrapConstants.DESCRIPTOR_FILE_NAME))) { + props.store(writer, "Generated by extension-descriptor"); + } + } catch(IOException e) { + throw new MojoExecutionException("Failed to persist extension descriptor " + output.resolve(BootstrapConstants.DESCRIPTOR_FILE_NAME), e); + } + + persistDependencyGraph(output); + } + + private void persistDependencyGraph(Path output) throws MojoExecutionException { + + final Artifact artifact = DependencyGraphParser.toArtifact(deployment); + + final ArtifactDescriptorRequest descrReq = new ArtifactDescriptorRequest(); + descrReq.setArtifact(artifact); + final ArtifactDescriptorResult artDescr; + try { + artDescr = repoSystem.readArtifactDescriptor(repoSession, descrReq); + } catch (ArtifactDescriptorException e) { + throw new MojoExecutionException("Failed to read descriptor of " + artifact, e); + } + + final CollectRequest collectRequest = new CollectRequest(); + collectRequest.setRoot(new Dependency(artifact, "runtime")); + collectRequest.setRepositories(artDescr.getRepositories()); + final DependencyNode root; + try { + root = repoSystem.collectDependencies(repoSession, collectRequest).getRoot(); + } catch (DependencyCollectionException e) { + throw new MojoExecutionException("Failed to collect dependencies for " + artifact, e); + } + + try(BufferedWriter writer = Files.newBufferedWriter(output.resolve(BootstrapConstants.DEPLOYMENT_DEPENDENCY_GRAPH))) { + persistNode(root, writer, 0); + } catch (IOException e) { + throw new MojoExecutionException("Failed to persist " + BootstrapConstants.DEPLOYMENT_DEPENDENCY_GRAPH, e); + } + } + + private static void persistNode(DependencyNode node, BufferedWriter writer, int depth) throws IOException { + for(int i = 0; i < depth; ++i) { + writer.append(' '); + } + final Artifact artifact= node.getArtifact(); + writer.write(artifact.getGroupId()); + writer.write(':'); + writer.write(artifact.getArtifactId()); + writer.write(':'); + final String classifier = artifact.getClassifier(); + if(classifier != null && !classifier.isEmpty()) { + writer.write(classifier); + writer.write(':'); + } + writer.write(artifact.getExtension()); + writer.write(':'); + writer.write(artifact.getVersion()); + writer.write('('); + writer.write(node.getDependency().getScope()); + writer.write(')'); + writer.newLine(); + final List children = node.getChildren(); + if(children.isEmpty()) { + return; + } + ++depth; + for(DependencyNode child : children) { + persistNode(child, writer, depth); + } + } +} diff --git a/independent-projects/bootstrap/pom.xml b/independent-projects/bootstrap/pom.xml new file mode 100644 index 0000000000000..62b1400a98c8c --- /dev/null +++ b/independent-projects/bootstrap/pom.xml @@ -0,0 +1,200 @@ + + + + 4.0.0 + + + org.jboss + jboss-parent + 31 + + io.quarkus.bootstrap + bootstrap-parent + Quarkus Bootstrap Parent + pom + 999-SNAPSHOT + + + + Apache License, Version 2.0 + repo + http://www.apache.org/licenses/LICENSE-2.0.html + + + + + UTF-8 + 1.8 + 1.8 + + 3.3.2.Final + 4.12 + 3.5.4 + 3.5.2 + 1.1.1 + + + + core + maven-plugin + + + + + + ${project.groupId} + bootstrap-core + ${project.version} + + + ${project.groupId} + bootstrap-maven-plugin + ${project.version} + + + + org.apache.maven + maven-plugin-api + ${maven-core.version} + + + org.apache.maven + maven-model + ${maven-core.version} + + + org.apache.maven + maven-core + ${maven-core.version} + + + org.apache.maven + maven-resolver-provider + ${maven-core.version} + + + org.apache.maven + maven-settings-builder + ${maven-core.version} + + + org.apache.maven.plugin-tools + maven-plugin-annotations + ${maven-plugin-annotations.version} + + + org.apache.maven + maven-artifact + + + + + org.apache.maven.resolver + maven-resolver-connector-basic + ${maven-resolver.version} + + + org.apache.maven.resolver + maven-resolver-transport-file + ${maven-resolver.version} + + + org.apache.maven.resolver + maven-resolver-transport-http + ${maven-resolver.version} + + + org.jboss.logging + jboss-logging + ${jboss-logging.version} + + + + junit + junit + test + ${junit.version} + + + + + + + + + maven-javadoc-plugin + + true + none + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce + + + + + + org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec + org.jboss.spec.javax.annotation:jboss-annotations-api_1.3_spec + + + + + + enforce + + + + + + + + + + + jboss + http://repository.jboss.org/nexus/content/groups/public/ + + true + + + true + + + + + + + quarkus-nexus-release + Quarkus AWS Nexus - Releases + http://ec2-18-234-117-118.compute-1.amazonaws.com:8081/nexus/content/repositories/releases/ + + + quarkus-nexus-snapshot + Quarkus AWS Nexus - Snapshots + http://ec2-18-234-117-118.compute-1.amazonaws.com:8081/nexus/content/repositories/snapshots/ + + + + diff --git a/integration-tests/camel-aws-s3/pom.xml b/integration-tests/camel-aws-s3/pom.xml index af5d619a6e0dd..1a3622e819cc1 100644 --- a/integration-tests/camel-aws-s3/pom.xml +++ b/integration-tests/camel-aws-s3/pom.xml @@ -17,55 +17,29 @@ io.quarkus quarkus-arc - provided io.quarkus quarkus-resteasy - provided io.quarkus quarkus-core - provided - - - io.quarkus - quarkus-core-runtime - provided io.quarkus quarkus-camel-core - provided - - - io.quarkus - quarkus-camel-core-runtime - provided io.quarkus quarkus-camel-aws-s3 - provided - - - io.quarkus - quarkus-camel-aws-s3-runtime - provided - + io.quarkus quarkus-caffeine - provided - - - io.quarkus - quarkus-caffeine-runtime - provided diff --git a/integration-tests/camel-core/pom.xml b/integration-tests/camel-core/pom.xml index 28147dcbd4312..fba98871f17ad 100644 --- a/integration-tests/camel-core/pom.xml +++ b/integration-tests/camel-core/pom.xml @@ -17,32 +17,26 @@ io.quarkus quarkus-arc - provided io.quarkus quarkus-resteasy - provided io.quarkus quarkus-core - provided io.quarkus quarkus-camel-core - provided io.quarkus quarkus-camel-netty4-http - provided io.quarkus quarkus-camel-infinispan - provided @@ -83,6 +77,12 @@ io.rest-assured rest-assured test + + + org.apache.commons + commons-lang3 + + diff --git a/integration-tests/camel-salesforce/pom.xml b/integration-tests/camel-salesforce/pom.xml index 45c7da338c73e..1a7e1e2743df6 100644 --- a/integration-tests/camel-salesforce/pom.xml +++ b/integration-tests/camel-salesforce/pom.xml @@ -17,44 +17,24 @@ io.quarkus quarkus-arc - provided io.quarkus quarkus-resteasy - provided io.quarkus quarkus-core - provided - - - io.quarkus - quarkus-core-runtime - provided io.quarkus quarkus-camel-core - provided - - - io.quarkus - quarkus-camel-core-runtime - provided io.quarkus quarkus-camel-salesforce - provided - - - io.quarkus - quarkus-camel-salesforce-runtime - provided @@ -84,6 +64,12 @@ io.rest-assured rest-assured test + + + org.apache.commons + commons-lang3 + + diff --git a/integration-tests/class-transformer/deployment/pom.xml b/integration-tests/class-transformer/deployment/pom.xml new file mode 100644 index 0000000000000..891639c7dab72 --- /dev/null +++ b/integration-tests/class-transformer/deployment/pom.xml @@ -0,0 +1,56 @@ + + + + + + quarkus-integration-test-class-transformer-parent + io.quarkus + 999-SNAPSHOT + ../ + + 4.0.0 + + quarkus-integration-test-class-transformer-deployment + Quarkus - Integration Tests - Class tranformer - Deployment + + + + io.quarkus + quarkus-core-deployment + + + + + + + maven-compiler-plugin + + + + io.quarkus + quarkus-extension-processor + ${project.version} + + + + + + + + diff --git a/integration-tests/class-transformer/src/main/java/io/quarkus/example/classtransformer/ClassTransformerProcessor.java b/integration-tests/class-transformer/deployment/src/main/java/io/quarkus/example/classtransformer/ClassTransformerProcessor.java similarity index 100% rename from integration-tests/class-transformer/src/main/java/io/quarkus/example/classtransformer/ClassTransformerProcessor.java rename to integration-tests/class-transformer/deployment/src/main/java/io/quarkus/example/classtransformer/ClassTransformerProcessor.java diff --git a/integration-tests/class-transformer/pom.xml b/integration-tests/class-transformer/pom.xml index 6e6e047769c91..980998b3bff97 100644 --- a/integration-tests/class-transformer/pom.xml +++ b/integration-tests/class-transformer/pom.xml @@ -26,7 +26,7 @@ 4.0.0 - quarkus-integration-test-class-transformer + quarkus-integration-test-class-transformer-parent Quarkus - Integration Tests - Class tranformer @@ -37,31 +37,12 @@ This should probably be deleted once we have a proper test framework. - - - io.quarkus - quarkus-core - - - - - - maven-dependency-plugin - - - maven-compiler-plugin - - - - io.quarkus - quarkus-extension-processor - ${project.version} - - - - - - + pom + + + deployment + runtime + diff --git a/integration-tests/class-transformer/runtime/pom.xml b/integration-tests/class-transformer/runtime/pom.xml new file mode 100644 index 0000000000000..fb12fab17c693 --- /dev/null +++ b/integration-tests/class-transformer/runtime/pom.xml @@ -0,0 +1,40 @@ + + + + + + quarkus-integration-test-class-transformer-parent + io.quarkus + 999-SNAPSHOT + ../ + + 4.0.0 + + quarkus-integration-test-class-transformer + Quarkus - Integration Tests - Class tranformer - Runtime + + + + + io.quarkus.bootstrap + bootstrap-maven-plugin + + + + diff --git a/integration-tests/elytron-security/pom.xml b/integration-tests/elytron-security/pom.xml index 6c8ba96e5b8f5..aae09d1803638 100644 --- a/integration-tests/elytron-security/pom.xml +++ b/integration-tests/elytron-security/pom.xml @@ -38,19 +38,12 @@ io.quarkus quarkus-elytron-security - provided io.quarkus quarkus-resteasy-jsonb - provided - - - io.quarkus - quarkus-resteasy-jsonb - provided @@ -63,6 +56,12 @@ io.rest-assured rest-assured test + + + org.apache.commons + commons-lang3 + + diff --git a/integration-tests/hibernate-orm-panache/pom.xml b/integration-tests/hibernate-orm-panache/pom.xml index a47d8b24ba6b8..f2dbdf95951c8 100644 --- a/integration-tests/hibernate-orm-panache/pom.xml +++ b/integration-tests/hibernate-orm-panache/pom.xml @@ -32,34 +32,29 @@ io.quarkus quarkus-hibernate-orm-panache - provided io.quarkus quarkus-hibernate-orm - provided io.quarkus quarkus-resteasy - provided io.quarkus quarkus-core - provided io.quarkus quarkus-jdbc-h2 - provided org.junit.jupiter junit-jupiter-api compile - + io.quarkus @@ -70,6 +65,12 @@ io.rest-assured rest-assured test + + + org.apache.commons + commons-lang3 + + io.quarkus diff --git a/integration-tests/hibernate-validator/pom.xml b/integration-tests/hibernate-validator/pom.xml index 4259ca0b4308e..ec72b3df4b71e 100644 --- a/integration-tests/hibernate-validator/pom.xml +++ b/integration-tests/hibernate-validator/pom.xml @@ -17,17 +17,14 @@ io.quarkus quarkus-resteasy - provided io.quarkus quarkus-hibernate-validator - provided io.quarkus quarkus-arc - provided @@ -46,6 +43,12 @@ io.rest-assured rest-assured test + + + org.apache.commons + commons-lang3 + + diff --git a/integration-tests/infinispan-cache-jpa-stress/pom.xml b/integration-tests/infinispan-cache-jpa-stress/pom.xml index d043199bfe04f..21d9cc5c9c381 100644 --- a/integration-tests/infinispan-cache-jpa-stress/pom.xml +++ b/integration-tests/infinispan-cache-jpa-stress/pom.xml @@ -39,19 +39,16 @@ io.quarkus quarkus-hibernate-orm - provided io.quarkus quarkus-jdbc-h2 - provided io.quarkus quarkus-resteasy - provided @@ -64,6 +61,12 @@ io.rest-assured rest-assured test + + + org.apache.commons + commons-lang3 + + org.apache.logging.log4j diff --git a/integration-tests/infinispan-cache-jpa/pom.xml b/integration-tests/infinispan-cache-jpa/pom.xml index ebb942f5b956e..52c0fc18627cd 100644 --- a/integration-tests/infinispan-cache-jpa/pom.xml +++ b/integration-tests/infinispan-cache-jpa/pom.xml @@ -34,19 +34,16 @@ io.quarkus quarkus-hibernate-orm - provided io.quarkus quarkus-jdbc-h2 - provided io.quarkus quarkus-resteasy - provided @@ -64,6 +61,12 @@ io.rest-assured rest-assured test + + + org.apache.commons + commons-lang3 + + diff --git a/integration-tests/infinispan-client/pom.xml b/integration-tests/infinispan-client/pom.xml index 4d03c671009e6..6b052a8f96575 100644 --- a/integration-tests/infinispan-client/pom.xml +++ b/integration-tests/infinispan-client/pom.xml @@ -33,20 +33,17 @@ io.quarkus quarkus-infinispan-client - provided io.quarkus quarkus-arc - provided io.quarkus quarkus-resteasy - provided @@ -60,6 +57,12 @@ io.rest-assured rest-assured test + + + org.apache.commons + commons-lang3 + + diff --git a/integration-tests/jpa-h2/pom.xml b/integration-tests/jpa-h2/pom.xml index afb43bb217180..fcc00e49416e8 100644 --- a/integration-tests/jpa-h2/pom.xml +++ b/integration-tests/jpa-h2/pom.xml @@ -34,19 +34,16 @@ io.quarkus quarkus-hibernate-orm - provided io.quarkus quarkus-jdbc-h2 - provided io.quarkus quarkus-resteasy - provided @@ -64,6 +61,12 @@ io.rest-assured rest-assured test + + + org.apache.commons + commons-lang3 + + diff --git a/integration-tests/jpa-mariadb/pom.xml b/integration-tests/jpa-mariadb/pom.xml index a471fc1cd5d45..75d85a0ea340a 100644 --- a/integration-tests/jpa-mariadb/pom.xml +++ b/integration-tests/jpa-mariadb/pom.xml @@ -38,17 +38,14 @@ io.quarkus quarkus-resteasy - provided io.quarkus quarkus-hibernate-orm - provided io.quarkus quarkus-jdbc-mariadb - provided @@ -61,6 +58,12 @@ io.rest-assured rest-assured test + + + org.apache.commons + commons-lang3 + + diff --git a/integration-tests/jpa-mssql/pom.xml b/integration-tests/jpa-mssql/pom.xml index 7ce2ec6c523a9..f2b5544f5a641 100644 --- a/integration-tests/jpa-mssql/pom.xml +++ b/integration-tests/jpa-mssql/pom.xml @@ -40,19 +40,16 @@ io.quarkus quarkus-hibernate-orm - provided io.quarkus quarkus-jdbc-mssql - provided io.quarkus quarkus-resteasy - provided @@ -65,6 +62,12 @@ io.rest-assured rest-assured test + + + org.apache.commons + commons-lang3 + + diff --git a/integration-tests/jpa-postgresql/pom.xml b/integration-tests/jpa-postgresql/pom.xml index 65b37c63039a4..a886ca294930f 100644 --- a/integration-tests/jpa-postgresql/pom.xml +++ b/integration-tests/jpa-postgresql/pom.xml @@ -33,17 +33,14 @@ io.quarkus quarkus-resteasy - provided io.quarkus quarkus-hibernate-orm - provided io.quarkus quarkus-jdbc-postgresql - provided @@ -56,6 +53,12 @@ io.rest-assured rest-assured test + + + org.apache.commons + commons-lang3 + + diff --git a/integration-tests/jpa/pom.xml b/integration-tests/jpa/pom.xml index 4ad89ddb3e274..94c1881e0a855 100644 --- a/integration-tests/jpa/pom.xml +++ b/integration-tests/jpa/pom.xml @@ -17,17 +17,14 @@ io.quarkus quarkus-resteasy - provided io.quarkus quarkus-hibernate-orm - provided io.quarkus quarkus-jdbc-h2 - provided @@ -45,6 +42,12 @@ io.rest-assured rest-assured test + + + org.apache.commons + commons-lang3 + + diff --git a/integration-tests/main/pom.xml b/integration-tests/main/pom.xml index d7cbb70a0fcfe..319d21a0cd2ea 100644 --- a/integration-tests/main/pom.xml +++ b/integration-tests/main/pom.xml @@ -42,7 +42,6 @@ io.quarkus quarkus-integration-test-class-transformer - provided io.quarkus @@ -51,79 +50,64 @@ io.quarkus quarkus-smallrye-metrics - provided io.quarkus quarkus-smallrye-openapi - provided io.quarkus quarkus-smallrye-opentracing - provided io.quarkus quarkus-amazon-lambda - provided io.quarkus quarkus-arc - provided io.quarkus quarkus-smallrye-health - provided io.quarkus quarkus-smallrye-reactive-streams-operators - provided io.quarkus quarkus-hibernate-validator - provided io.quarkus quarkus-narayana-jta - provided io.quarkus quarkus-undertow-websockets - provided io.quarkus quarkus-smallrye-fault-tolerance - provided io.quarkus quarkus-scheduler - provided io.quarkus quarkus-elytron-security - provided io.quarkus quarkus-resteasy - provided io.quarkus quarkus-resteasy-jsonb - provided org.jboss.resteasy @@ -136,19 +120,16 @@ io.quarkus quarkus-smallrye-rest-client - provided io.quarkus quarkus-hibernate-orm - provided io.quarkus quarkus-jdbc-h2 - provided io.quarkus @@ -158,7 +139,6 @@ io.quarkus quarkus-kafka-client - provided @@ -176,6 +156,12 @@ io.rest-assured rest-assured test + + + org.apache.commons + commons-lang3 + + io.debezium @@ -238,7 +224,6 @@ io.quarkus quarkus-jdbc-postgresql - provided diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index c996ef63ced7c..c2233dc0f5ae3 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -70,4 +70,19 @@ + + + + + io.quarkus + quarkus-integration-test-class-transformer-deployment + ${project.version} + + + io.quarkus + quarkus-integration-test-class-transformer + ${project.version} + + + diff --git a/integration-tests/spring-di/pom.xml b/integration-tests/spring-di/pom.xml index a398f88ab4f38..6c59b87bbc27a 100644 --- a/integration-tests/spring-di/pom.xml +++ b/integration-tests/spring-di/pom.xml @@ -33,17 +33,14 @@ io.quarkus quarkus-resteasy - provided io.quarkus quarkus-arc - provided io.quarkus quarkus-spring-di - provided io.quarkus @@ -66,6 +63,12 @@ io.rest-assured rest-assured test + + + org.apache.commons + commons-lang3 + + diff --git a/integration-tests/vertx/pom.xml b/integration-tests/vertx/pom.xml index 59199bc891f60..f13a2e3553452 100644 --- a/integration-tests/vertx/pom.xml +++ b/integration-tests/vertx/pom.xml @@ -18,17 +18,14 @@ io.quarkus quarkus-resteasy - provided io.quarkus quarkus-arc - provided io.quarkus quarkus-vertx - provided @@ -40,6 +37,12 @@ io.rest-assured rest-assured test + + + org.apache.commons + commons-lang3 + + diff --git a/pom.xml b/pom.xml index 36fdd8350009a..6482a2a79bd4e 100644 --- a/pom.xml +++ b/pom.xml @@ -61,14 +61,15 @@ core test-framework - - integration-tests - extensions + + integration-tests + independent-projects/arc + independent-projects/bootstrap devtools diff --git a/test-framework/common/pom.xml b/test-framework/common/pom.xml index b0778236b18e2..d649e4706fa3a 100644 --- a/test-framework/common/pom.xml +++ b/test-framework/common/pom.xml @@ -33,11 +33,11 @@ io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus - quarkus-jsonp + quarkus-jsonp-deployment org.jboss diff --git a/test-framework/junit5/pom.xml b/test-framework/junit5/pom.xml index 5ec2347673494..e94ca94bab6e1 100644 --- a/test-framework/junit5/pom.xml +++ b/test-framework/junit5/pom.xml @@ -31,6 +31,10 @@ Quarkus - Test framework - JUnit 5 + + io.quarkus.bootstrap + bootstrap-core + io.quarkus quarkus-test-common diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java index 444d371711e65..0e4f568affcb6 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java @@ -26,6 +26,7 @@ import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.net.URL; +import java.net.URLClassLoader; import java.nio.file.Files; import java.nio.file.Path; import java.util.Enumeration; @@ -50,6 +51,9 @@ import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.ClassWriter; +import io.quarkus.bootstrap.BootstrapClassLoaderFactory; +import io.quarkus.bootstrap.BootstrapException; +import io.quarkus.bootstrap.util.PropertyUtils; import io.quarkus.deployment.ClassOutput; import io.quarkus.deployment.QuarkusClassWriter; import io.quarkus.deployment.builditem.TestClassPredicateBuildItem; @@ -67,8 +71,12 @@ public class QuarkusTestExtension implements BeforeAllCallback, BeforeEachCallback, AfterEachCallback, TestInstanceFactory { + private URLClassLoader appCl; + private ClassLoader originalCl; + @Override public void beforeAll(ExtensionContext context) throws Exception { + ExtensionContext root = context.getRoot(); ExtensionContext.Store store = root.getStore(ExtensionContext.Namespace.GLOBAL); ExtensionState state = (ExtensionState) store.get(ExtensionState.class.getName()); @@ -102,9 +110,24 @@ private ExtensionState doJavaStart(ExtensionContext context, TestResourceManager Path testClassLocation = getTestClassesLocation(context.getRequiredTestClass()); ClassLoader testClassLoader = context.getRequiredTestClass().getClassLoader(); + try { + appCl = BootstrapClassLoaderFactory.newInstance() + .setAppClasses(appClassLocation) + .addToClassPath(testClassLocation) + .setParent(getClass().getClassLoader()) + .setOffline(PropertyUtils.getBoolean(BootstrapClassLoaderFactory.PROP_OFFLINE, true)) + .setLocalProjectsDiscovery( + PropertyUtils.getBoolean(BootstrapClassLoaderFactory.PROP_PROJECT_DISCOVERY, true)) + .setClasspathCache(PropertyUtils.getBoolean(BootstrapClassLoaderFactory.PROP_CP_CACHE, true)) + .newDeploymentClassLoader(); + } catch (BootstrapException e) { + throw new IllegalStateException("Failed to create the boostrap class loader", e); + } + originalCl = setCCL(appCl); + RuntimeRunner runtimeRunner = RuntimeRunner.builder() .setLaunchMode(LaunchMode.TEST) - .setClassLoader(getClass().getClassLoader()) + .setClassLoader(appCl) .setTarget(appClassLocation) .addAdditionalArchive(testClassLocation) .setClassOutput(new ClassOutput() { @@ -130,7 +153,8 @@ public void writeResource(String name, byte[] data) throws IOException { }) .setTransformerTarget(new TransformerTarget() { @Override - public void setTransformers(Map>> functions) { + public void setTransformers( + Map>> functions) { ClassLoader main = Thread.currentThread().getContextClassLoader(); //we need to use a temp class loader, or the old resource location will be cached @@ -158,7 +182,8 @@ public Enumeration getResources(String name) throws IOException { return main.getResources(name); } }; - for (Map.Entry>> e : functions.entrySet()) { + for (Map.Entry>> e : functions + .entrySet()) { String resourceName = e.getKey().replace('.', '/') + ".class"; try (InputStream stream = temp.getResourceAsStream(resourceName)) { if (stream == null) { @@ -267,7 +292,14 @@ public Object createTestInstance(TestInstanceFactoryContext factoryContext, Exte } } - static class ExtensionState implements ExtensionContext.Store.CloseableResource { + private static ClassLoader setCCL(ClassLoader cl) { + final Thread thread = Thread.currentThread(); + final ClassLoader original = thread.getContextClassLoader(); + thread.setContextClassLoader(cl); + return original; + } + + class ExtensionState implements ExtensionContext.Store.CloseableResource { private final TestResourceManager testResourceManager; private final Closeable resource; @@ -281,8 +313,17 @@ static class ExtensionState implements ExtensionContext.Store.CloseableResource @Override public void close() throws Throwable { - resource.close(); testResourceManager.stop(); + try { + resource.close(); + } finally { + if (QuarkusTestExtension.this.originalCl != null) { + setCCL(QuarkusTestExtension.this.originalCl); + } + } + if (appCl != null) { + appCl.close(); + } } public boolean isSubstrate() { diff --git a/war-launcher/launcher/pom.xml b/war-launcher/launcher/pom.xml index f2cb55af3bac6..a5effe72fa6da 100644 --- a/war-launcher/launcher/pom.xml +++ b/war-launcher/launcher/pom.xml @@ -33,7 +33,7 @@ io.quarkus - quarkus-core + quarkus-core-deployment io.quarkus @@ -42,40 +42,40 @@ io.quarkus - quarkus-undertow + quarkus-undertow-deployment io.quarkus - quarkus-arc + quarkus-arc-deployment io.quarkus - quarkus-narayana-jta + quarkus-narayana-jta-deployment io.quarkus - quarkus-resteasy + quarkus-resteasy-deployment io.quarkus - quarkus-smallrye-rest-client + quarkus-smallrye-rest-client-deployment io.quarkus - quarkus-smallrye-health + quarkus-smallrye-health-deployment io.quarkus - quarkus-hibernate-orm + quarkus-hibernate-orm-deployment io.quarkus - quarkus-smallrye-metrics + quarkus-smallrye-metrics-deployment io.quarkus - quarkus-smallrye-openapi + quarkus-smallrye-openapi-deployment diff --git a/war-launcher/runner/pom.xml b/war-launcher/runner/pom.xml index 6d68b97de089c..0e312c89abc26 100644 --- a/war-launcher/runner/pom.xml +++ b/war-launcher/runner/pom.xml @@ -33,7 +33,7 @@ io.quarkus - quarkus-core + quarkus-core-deployment