diff --git a/plugin/pom.xml b/plugin/pom.xml index caf62c92..949f8b02 100644 --- a/plugin/pom.xml +++ b/plugin/pom.xml @@ -112,10 +112,6 @@ provided true - - org.apache.maven.shared - maven-common-artifact-filters - org.jboss.galleon galleon-maven-plugin diff --git a/plugin/src/main/java/org/wildfly/plugin/provision/PackageServerMojo.java b/plugin/src/main/java/org/wildfly/plugin/provision/PackageServerMojo.java index b6117d91..fe1ea26d 100644 --- a/plugin/src/main/java/org/wildfly/plugin/provision/PackageServerMojo.java +++ b/plugin/src/main/java/org/wildfly/plugin/provision/PackageServerMojo.java @@ -17,27 +17,16 @@ import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.Collections; -import java.util.LinkedHashMap; import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.stream.Collectors; import javax.inject.Inject; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.resolver.filter.AndArtifactFilter; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; 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.apache.maven.shared.artifact.filter.PatternExcludesArtifactFilter; -import org.apache.maven.shared.artifact.filter.PatternIncludesArtifactFilter; -import org.apache.maven.shared.artifact.filter.ScopeArtifactFilter; import org.jboss.galleon.ProvisioningException; import org.jboss.galleon.api.GalleonBuilder; import org.jboss.galleon.api.config.GalleonProvisioningConfig; @@ -54,16 +43,6 @@ /** * Provision a server, copy extra content and deploy primary artifact if it exists. - *

- * Additional deployments can also be resolved from the dependencies. Use the {@code }, - * {@code }, {@code } and/or {@code } - * to deploy additional artifacts to the packaged server. - *

- *

- * Note the {@code }, {@code }, {@code included-dependency-scope} and - * {@code } configuration properties are chained together and all checks must pass to be - * included as additional deployments. - *

* * @author jfdenise * @since 3.0 @@ -190,7 +169,7 @@ public class PackageServerMojo extends AbstractProvisionServerMojo { private boolean skip; /** - * Skip deploying the deployments after the server is provisioned ({@code false} by default). + * Skip deploying the deployment after the server is provisioned ({@code false} by default). */ @Parameter(defaultValue = "false", property = PropertyNames.SKIP_PACKAGE_DEPLOYMENT) protected boolean skipDeployment; @@ -231,66 +210,6 @@ public class PackageServerMojo extends AbstractProvisionServerMojo { @Parameter(alias = "bootable-jar-install-artifact-classifier", property = PropertyNames.BOOTABLE_JAR_INSTALL_CLASSIFIER, defaultValue = BootableJarSupport.BOOTABLE_SUFFIX) private String bootableJarInstallArtifactClassifier; - /** - * A list of the dependencies to include as deployments. These dependencies must be defined as dependencies in the - * project. - * - *

- * The pattern is {@code groupId:artifactId:type:classifier:version}. Each type may be left blank. A pattern can - * be prefixed with a {@code !} to negatively match the pattern. Note that it is best practice to place negative - * checks first. - *

- * - *
-     *     <included-dependencies>
-     *         <included>!org.wildfly.examples:*test*</included>
-     *         <included>::war</included>
-     *         <included>org.wildfly.examples</included>
-     *     </included-dependencies>
-     * 
- * - * @since 5.1 - */ - @Parameter(alias = "included-dependencies", property = "wildfly.included.dependencies") - private Set includedDependencies = Set.of(); - - /** - * A list of the dependencies to exclude as deployments. - * - *

- * The pattern is {@code groupId:artifactId:type:classifier:version}. Each type may be left blank. A pattern can - * be prefixed with a {@code !} to negatively match the pattern. Note that it is best practice to place negative - * checks first. - *

- * - *
-     *     <excluded-dependencies>
-     *         <excluded>!org.wildfly.examples:*test*</excluded>
-     *         <excluded>::jar</excluded>
-     *     </excluded-dependencies>
-     * 
- * - * @since 5.1 - */ - @Parameter(alias = "excluded-dependencies", property = "wildfly.excluded.dependencies") - private Set excludedDependencies = Set.of(); - - /** - * Defines the scope of the dependencies to be included as deployments. This will deploy all dependencies defined - * in the scope to the packaged server. However, this does assume the dependency passes the - * {@code }, {@code } and {@code } checks. - */ - @Parameter(alias = "included-dependency-scope", property = "wildfly.included.dependency.scope") - private String includedDependencyScope; - - /** - * Defines the scope of the dependencies to be excluded as deployments. This will deploy all dependencies - * not defined in the scope to the packaged server. However, this does assume the dependency passes the - * {@code }, {@code } and {@code } checks. - */ - @Parameter(alias = "excluded-dependency-scope", property = "wildfly.excluded.dependency.scope") - private String excludedDependencyScope; - @Inject private OfflineCommandExecutor commandExecutor; @@ -340,36 +259,6 @@ private void deploy(Path deploymentContent, String targetName) throws MojoDeploy } } - private Map getDeployments() throws MojoExecutionException { - final List filters = new ArrayList<>(); - if (!includedDependencies.isEmpty()) { - filters.add(new PatternIncludesArtifactFilter(includedDependencies)); - } - if (!excludedDependencies.isEmpty()) { - filters.add(new PatternExcludesArtifactFilter(excludedDependencies)); - } - if (includedDependencyScope != null) { - filters.add(createScopeFilter(includedDependencyScope, true)); - } - if (excludedDependencyScope != null) { - filters.add(createScopeFilter(excludedDependencyScope, false)); - } - final ArtifactFilter filter = new AndArtifactFilter(filters); - final Set deployments = project.getArtifacts().stream() - .filter(filter::include) - .collect(Collectors.toSet()); - final Map deploymentPaths = new LinkedHashMap<>(); - for (var artifact : deployments) { - final File f = artifact.getFile(); - if (f == null) { - throw new MojoExecutionException("Deployment not found " + artifact); - } - final Path p = f.toPath(); - deploymentPaths.put(p.getFileName().toString(), p); - } - return deploymentPaths; - } - @Override protected void serverProvisioned(Path jbossHome) throws MojoExecutionException, MojoFailureException { try { @@ -391,15 +280,6 @@ protected void serverProvisioned(Path jbossHome) throws MojoExecutionException, if (primaryDeployment != null) { deploy(primaryDeployment, getDeploymentTargetName()); } - // Handle extra deployments - try { - Map extraPaths = getDeployments(); - for (Entry p : extraPaths.entrySet()) { - deploy(p.getValue(), p.getKey()); - } - } catch (Exception ex) { - throw new MojoExecutionException(ex.getLocalizedMessage(), ex); - } } // CLI execution @@ -585,28 +465,6 @@ private static void cleanupServer(Path jbossHome) throws IOException { IoUtils.recursiveDelete(log); } - private static ArtifactFilter createScopeFilter(final String scope, final boolean includeScope) { - final ScopeArtifactFilter filter = new ScopeArtifactFilter(); - switch (scope) { - case Artifact.SCOPE_COMPILE: - filter.setIncludeCompileScope(true); - break; - case Artifact.SCOPE_PROVIDED: - filter.setIncludeProvidedScope(true); - break; - case Artifact.SCOPE_RUNTIME: - filter.setIncludeRuntimeScope(true); - break; - case Artifact.SCOPE_TEST: - filter.setIncludeTestScope(true); - break; - case Artifact.SCOPE_SYSTEM: - filter.setIncludeSystemScope(true); - break; - } - return includeScope ? filter : artifact -> !filter.include(artifact); - } - @Override protected void enrichRepositories() throws MojoExecutionException { // NO-OP diff --git a/pom.xml b/pom.xml index 605f184a..3c08527e 100644 --- a/pom.xml +++ b/pom.xml @@ -90,7 +90,6 @@ 3.7.0 0.10.1 - 3.4.0 1.9.18 3.5.1 @@ -288,11 +287,6 @@ maven-resolver-connector-basic ${version.org.apache.maven.resolver}
- - org.apache.maven.shared - maven-common-artifact-filters - ${version.org.apache.maven.shared.filter} - org.apache.maven.wagon wagon-http diff --git a/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/PackageTest.java b/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/PackageTest.java index e10532d4..6114d213 100644 --- a/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/PackageTest.java +++ b/tests/standalone-tests/src/test/java/org/wildfly/plugin/provision/PackageTest.java @@ -142,25 +142,4 @@ public void testInvalidDeployment2() throws Exception { + "A runtime-name has been set that indicates that a deployment is expected. ")); } } - - @Test - public void testMultipleDeploymentsPackage() throws Exception { - final Mojo packageMojo = lookupConfiguredMojo( - AbstractWildFlyMojoTest.getPomFile("package-multiple-deployments-pom.xml").toFile(), "package"); - String[] layers = { "jaxrs-server" }; - packageMojo.execute(); - Path jbossHome = AbstractWildFlyMojoTest.getBaseDir().resolve("target").resolve("packaged-multiple-deployments-server"); - checkStandaloneWildFlyHome(jbossHome, 2, layers, null, true); - } - - @Test - public void testMultipleDeploymentsMissingPackage() throws Exception { - final Mojo packageMojo = lookupConfiguredMojo( - AbstractWildFlyMojoTest.getPomFile("package-multiple-deployments-missing-pom.xml").toFile(), "package"); - String[] layers = { "jaxrs-server" }; - packageMojo.execute(); - Path jbossHome = AbstractWildFlyMojoTest.getBaseDir().resolve("target") - .resolve("packaged-multiple-deployments-missing-server"); - checkStandaloneWildFlyHome(jbossHome, 1, layers, null, true); - } }