From 1e18480dc8a343727f5cf8b5cfeba5996dccff92 Mon Sep 17 00:00:00 2001 From: Marat Abrarov Date: Mon, 12 Oct 2020 20:56:39 +0300 Subject: [PATCH 1/9] [MEAR-216] - Handling test JARs as regular JARs --- pom.xml | 2 + .../maven/plugins/ear/EarModuleFactory.java | 4 +- .../maven/plugins/ear/it/EarMojoIT.java | 20 +++++ .../ear/expected-META-INF/application.xml | 29 +++++++ .../projects/project-092/ear/pom.xml | 57 ++++++++++++++ .../projects/project-092/jar/pom.xml | 54 +++++++++++++ .../resources/projects/project-092/pom.xml | 76 +++++++++++++++++++ .../projects/project-092/war/pom.xml | 40 ++++++++++ .../war/src/main/webapp/WEB-INF/web.xml | 24 ++++++ 9 files changed, 304 insertions(+), 2 deletions(-) create mode 100644 src/test/resources/projects/project-092/ear/expected-META-INF/application.xml create mode 100644 src/test/resources/projects/project-092/ear/pom.xml create mode 100644 src/test/resources/projects/project-092/jar/pom.xml create mode 100644 src/test/resources/projects/project-092/pom.xml create mode 100644 src/test/resources/projects/project-092/war/pom.xml create mode 100644 src/test/resources/projects/project-092/war/src/main/webapp/WEB-INF/web.xml diff --git a/pom.xml b/pom.xml index ac064353..14a4da40 100644 --- a/pom.xml +++ b/pom.xml @@ -89,6 +89,7 @@ 2.1.1 2.5.1 2.3 + 3.2.0 false ${invoker.skip} ${invoker.skip} @@ -286,6 +287,7 @@ org.apache.maven.plugins:maven-war-plugin:${mavenWarPluginVersion}:jar org.apache.maven.plugins:maven-compiler-plugin:${mavenCompilerPluginVersion}:jar org.apache.maven.plugins:maven-ejb-plugin:${mavenEjbPluginVersion}:jar + org.apache.maven.plugins:maven-jar-plugin:${mavenJarPluginVersion}:jar ${invoker.install.skip} ${invoker.it.skip} diff --git a/src/main/java/org/apache/maven/plugins/ear/EarModuleFactory.java b/src/main/java/org/apache/maven/plugins/ear/EarModuleFactory.java index 161e6bc6..be8bfc20 100644 --- a/src/main/java/org/apache/maven/plugins/ear/EarModuleFactory.java +++ b/src/main/java/org/apache/maven/plugins/ear/EarModuleFactory.java @@ -39,7 +39,7 @@ public final class EarModuleFactory */ public static final List STANDARD_ARTIFACT_TYPE = Collections.unmodifiableList( Arrays.asList( "jar", "ejb", "par", "ejb-client", "app-client", "rar", "war", - "sar", "wsr", "har" ) ); + "sar", "wsr", "har", "test-jar" ) ); /** * Creates a new {@link EarModule} based on the specified {@link Artifact} and the specified execution @@ -70,7 +70,7 @@ public static EarModule newEarModule( Artifact artifact, JavaEEVersion javaEEVer throw new UnknownArtifactTypeException( e.getMessage() + " for " + artifact.getArtifactId() ); } - if ( "jar".equals( artifactType ) ) + if ( "jar".equals( artifactType ) || "test-jar".equals( artifactType ) ) { return new JarModule( artifact, defaultLibBundleDir, includeInApplicationXml ); } diff --git a/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java b/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java index 91ca4be2..7d7a959c 100644 --- a/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java +++ b/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java @@ -995,4 +995,24 @@ public void testProject091() new String[][] { { "jar-sample-two-1.0.jar" }, { jarSampleThreeLibrary, jarSampleTwoLibrary } }, true ); } + + /** + * Ensures that test JAR dependency of WAR is handled as regular JAR in terms of packaging and manifest modification + * when skinnyWars option is turned on. + */ + public void testProject092() + throws Exception + { + final String warModule = "eartest-war-sample-two-1.0.war"; + final String jarSampleTwoLibrary = "lib/eartest-jar-sample-two-1.0.jar"; + final String jarSampleThreeLibrary = "lib/eartest-jar-sample-three-with-deps-1.0.jar"; + final String jarSampleFourTestLibrary = "lib/eartest-jar-sample-four-1.0-tests.jar"; + doTestProject( "project-092", "ear", + new String[] { warModule, jarSampleTwoLibrary, jarSampleThreeLibrary, jarSampleFourTestLibrary }, + new boolean[] { false, false, false, false }, + new String[] { warModule }, + new boolean[] { false }, + new String[][] { { jarSampleFourTestLibrary, jarSampleThreeLibrary, jarSampleTwoLibrary } }, + true ); + } } diff --git a/src/test/resources/projects/project-092/ear/expected-META-INF/application.xml b/src/test/resources/projects/project-092/ear/expected-META-INF/application.xml new file mode 100644 index 00000000..bfbbff0c --- /dev/null +++ b/src/test/resources/projects/project-092/ear/expected-META-INF/application.xml @@ -0,0 +1,29 @@ + + + + maven-ear-plugin-test-project-092 + + + eartest-war-sample-two-1.0.war + /war-sample-two + + + lib + diff --git a/src/test/resources/projects/project-092/ear/pom.xml b/src/test/resources/projects/project-092/ear/pom.xml new file mode 100644 index 00000000..8839f0c5 --- /dev/null +++ b/src/test/resources/projects/project-092/ear/pom.xml @@ -0,0 +1,57 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-092-parent + 99.0 + + maven-ear-plugin-test-project-092 + ear + + + eartest + war-sample-two + war + + + eartest + war-sample-two + pom + + + + + + org.apache.maven.plugins + maven-ear-plugin + @project.version@ + + 6 + lib + true + + + + + diff --git a/src/test/resources/projects/project-092/jar/pom.xml b/src/test/resources/projects/project-092/jar/pom.xml new file mode 100644 index 00000000..b012806f --- /dev/null +++ b/src/test/resources/projects/project-092/jar/pom.xml @@ -0,0 +1,54 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-092-parent + 99.0 + + eartest + jar-sample-four + 1.0 + + + eartest + jar-sample-three-with-deps + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + test-jar + + test-jar + + + + + + + diff --git a/src/test/resources/projects/project-092/pom.xml b/src/test/resources/projects/project-092/pom.xml new file mode 100644 index 00000000..1ab7d0b5 --- /dev/null +++ b/src/test/resources/projects/project-092/pom.xml @@ -0,0 +1,76 @@ + + + + + 4.0.0 + ear + maven-ear-plugin-test-project-092-parent + 99.0 + pom + + jar + war + ear + + + + + eartest + jar-sample-three-with-deps + 1.0 + + + eartest + jar-sample-four + 1.0 + test-jar + + + eartest + war-sample-two + 1.0 + war + + + eartest + war-sample-two + 1.0 + pom + + + + + + + + org.apache.maven.plugins + maven-war-plugin + @mavenWarPluginVersion@ + + + org.apache.maven.plugins + maven-jar-plugin + @mavenJarPluginVersion@ + + + + + diff --git a/src/test/resources/projects/project-092/war/pom.xml b/src/test/resources/projects/project-092/war/pom.xml new file mode 100644 index 00000000..2199dae0 --- /dev/null +++ b/src/test/resources/projects/project-092/war/pom.xml @@ -0,0 +1,40 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-092-parent + 99.0 + + eartest + war-sample-two + 1.0 + war + + + eartest + jar-sample-four + test-jar + + + diff --git a/src/test/resources/projects/project-092/war/src/main/webapp/WEB-INF/web.xml b/src/test/resources/projects/project-092/war/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..fbbf3070 --- /dev/null +++ b/src/test/resources/projects/project-092/war/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + From b6ea8e67ee661d1c1e991f942c6bdf967aefbba7 Mon Sep 17 00:00:00 2001 From: Marat Abrarov Date: Thu, 22 Oct 2020 19:08:31 +0300 Subject: [PATCH 2/9] [MEAR-216] - Fixed dependency on test JAR in test to follow https://maven.apache.org/guides/mini/guide-attached-tests.html. --- src/test/resources/projects/project-092/pom.xml | 1 + src/test/resources/projects/project-092/war/pom.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/src/test/resources/projects/project-092/pom.xml b/src/test/resources/projects/project-092/pom.xml index 1ab7d0b5..2672123f 100644 --- a/src/test/resources/projects/project-092/pom.xml +++ b/src/test/resources/projects/project-092/pom.xml @@ -41,6 +41,7 @@ under the License. eartest jar-sample-four 1.0 + tests test-jar diff --git a/src/test/resources/projects/project-092/war/pom.xml b/src/test/resources/projects/project-092/war/pom.xml index 2199dae0..02ec4413 100644 --- a/src/test/resources/projects/project-092/war/pom.xml +++ b/src/test/resources/projects/project-092/war/pom.xml @@ -34,6 +34,7 @@ under the License. eartest jar-sample-four + tests test-jar From b5b239450464c82dbde05c0fe868c6b47e1041ec Mon Sep 17 00:00:00 2001 From: Marat Abrarov Date: Thu, 22 Oct 2020 19:10:11 +0300 Subject: [PATCH 3/9] [MEAR-216] - Generation of deployment descriptor for test JARs --- .../maven/plugins/ear/AbstractEarModule.java | 11 ++ .../apache/maven/plugins/ear/AcrModule.java | 119 -------------- .../maven/plugins/ear/AppClientModule.java | 10 +- .../maven/plugins/ear/EjbClientModule.java | 11 +- .../apache/maven/plugins/ear/EjbModule.java | 11 +- .../apache/maven/plugins/ear/HarModule.java | 11 +- .../apache/maven/plugins/ear/JarModule.java | 12 +- .../apache/maven/plugins/ear/ParModule.java | 11 +- .../apache/maven/plugins/ear/RarModule.java | 11 +- .../apache/maven/plugins/ear/SarModule.java | 11 +- .../apache/maven/plugins/ear/WebModule.java | 11 +- .../apache/maven/plugins/ear/WsrModule.java | 11 +- src/site/apt/modules.apt.vm | 152 ++++++++++-------- .../maven/plugins/ear/it/EarMojoIT.java | 21 +++ .../ear/expected-META-INF/application.xml | 34 ++++ .../projects/project-093/ear/pom.xml | 69 ++++++++ .../projects/project-093/jar-five/pom.xml | 38 +++++ .../projects/project-093/jar-four/pom.xml | 54 +++++++ .../resources/projects/project-093/pom.xml | 84 ++++++++++ .../projects/project-093/war/pom.xml | 46 ++++++ .../war/src/main/webapp/WEB-INF/web.xml | 24 +++ 21 files changed, 489 insertions(+), 273 deletions(-) delete mode 100644 src/main/java/org/apache/maven/plugins/ear/AcrModule.java create mode 100644 src/test/resources/projects/project-093/ear/expected-META-INF/application.xml create mode 100644 src/test/resources/projects/project-093/ear/pom.xml create mode 100644 src/test/resources/projects/project-093/jar-five/pom.xml create mode 100644 src/test/resources/projects/project-093/jar-four/pom.xml create mode 100644 src/test/resources/projects/project-093/pom.xml create mode 100644 src/test/resources/projects/project-093/war/pom.xml create mode 100644 src/test/resources/projects/project-093/war/src/main/webapp/WEB-INF/web.xml diff --git a/src/main/java/org/apache/maven/plugins/ear/AbstractEarModule.java b/src/main/java/org/apache/maven/plugins/ear/AbstractEarModule.java index 8ceb14be..723d83bd 100644 --- a/src/main/java/org/apache/maven/plugins/ear/AbstractEarModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/AbstractEarModule.java @@ -60,6 +60,8 @@ public abstract class AbstractEarModule private String artifactId; + protected String type; + private String classifier; /** @@ -115,6 +117,7 @@ public AbstractEarModule( Artifact a ) this.artifact = a; this.groupId = a.getGroupId(); this.artifactId = a.getArtifactId(); + this.type = a.getType(); this.classifier = a.getClassifier(); this.bundleDir = null; } @@ -194,6 +197,14 @@ public String getUri() return uri; } + /** + * {@inheritDoc} + */ + public String getType() + { + return type; + } + /** * Returns the artifact's groupId. * diff --git a/src/main/java/org/apache/maven/plugins/ear/AcrModule.java b/src/main/java/org/apache/maven/plugins/ear/AcrModule.java deleted file mode 100644 index 33421269..00000000 --- a/src/main/java/org/apache/maven/plugins/ear/AcrModule.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.apache.maven.plugins.ear; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. - */ - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.plugin.MojoFailureException; -import org.codehaus.plexus.util.xml.XMLWriter; - -import java.util.Set; - -/** - * The {@link EarModule} implementation for an Acr Module. - * - * @author Karl Heinz Marbaise - * @since 3.0.0 - */ -public class AcrModule - extends AbstractEarModule -{ - private Boolean includeInApplicationXml = Boolean.FALSE; - - private static final String APP_CLIENT = "app-client"; - - /** - * Create an instance. - */ - public AcrModule() - { - super(); - } - - /** - * @param a {@link Artifact} - * @param defaultLibBundleDir The default library bundle directory. - * @param includeInApplicationXml Include the application xml or not. - */ - public AcrModule( Artifact a, String defaultLibBundleDir, Boolean includeInApplicationXml ) - { - super( a ); - setLibBundleDir( defaultLibBundleDir ); - this.includeInApplicationXml = includeInApplicationXml; - - } - - /** - * {@inheritDoc} - */ - public void appendModule( XMLWriter writer, String version, Boolean generateId ) - { - // Generates an entry in the application.xml only if - // includeInApplicationXml is set - if ( includeInApplicationXml ) - { - startModuleElement( writer, generateId ); - writer.startElement( APP_CLIENT ); - writer.writeText( getUri() ); - writer.endElement(); - - writeAltDeploymentDescriptor( writer, version ); - - writer.endElement(); - } - } - - /** - * {@inheritDoc} - */ - public void resolveArtifact( Set artifacts ) - throws EarPluginException, MojoFailureException - { - // Let's resolve the artifact - super.resolveArtifact( artifacts ); - - // If the defaultLibBundleDir is set and no bundle dir is - // set, set the default as bundle dir - setLibBundleDir( earExecutionContext.getDefaultLibBundleDir() ); - } - - /** - * {@inheritDoc} - */ - public String getType() - { - return APP_CLIENT; - } - - private void setLibBundleDir( String defaultLibBundleDir ) - { - if ( defaultLibBundleDir != null && bundleDir == null ) - { - this.bundleDir = defaultLibBundleDir; - } - } - - /** - * {@inheritDoc} - */ - public boolean changeManifestClasspath() - { - return false; - } -} diff --git a/src/main/java/org/apache/maven/plugins/ear/AppClientModule.java b/src/main/java/org/apache/maven/plugins/ear/AppClientModule.java index 5c537b7f..14c5b6dc 100644 --- a/src/main/java/org/apache/maven/plugins/ear/AppClientModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/AppClientModule.java @@ -30,12 +30,14 @@ public class AppClientModule extends AbstractEarModule { + private static final String DEFAULT_ARTIFACT_TYPE = "app-client"; /** * Create an instance. */ public AppClientModule() { + this.type = DEFAULT_ARTIFACT_TYPE; } /** @@ -60,12 +62,4 @@ public void appendModule( XMLWriter writer, String version, Boolean generateId ) writer.endElement(); } - - /** - * @return The type of the module. - */ - public String getType() - { - return "app-client"; - } } diff --git a/src/main/java/org/apache/maven/plugins/ear/EjbClientModule.java b/src/main/java/org/apache/maven/plugins/ear/EjbClientModule.java index 186f893b..ac610653 100644 --- a/src/main/java/org/apache/maven/plugins/ear/EjbClientModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/EjbClientModule.java @@ -29,13 +29,14 @@ public class EjbClientModule extends JarModule { + private static final String DEFAULT_ARTIFACT_TYPE = "ejb-client"; /** * Create an instance. */ public EjbClientModule() { - super(); + this.type = DEFAULT_ARTIFACT_TYPE; } /** @@ -46,12 +47,4 @@ public EjbClientModule( Artifact a, String defaultLibBundleDir ) { super( a, defaultLibBundleDir, Boolean.FALSE ); } - - /** - * {@inheritDoc} - */ - public String getType() - { - return "ejb-client"; - } } diff --git a/src/main/java/org/apache/maven/plugins/ear/EjbModule.java b/src/main/java/org/apache/maven/plugins/ear/EjbModule.java index d74b62de..fef44dc9 100644 --- a/src/main/java/org/apache/maven/plugins/ear/EjbModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/EjbModule.java @@ -30,6 +30,8 @@ public class EjbModule extends AbstractEarModule { + private static final String DEFAULT_ARTIFACT_TYPE = "ejb"; + private static final String EJB_MODULE = "ejb"; /** @@ -37,6 +39,7 @@ public class EjbModule */ public EjbModule() { + this.type = DEFAULT_ARTIFACT_TYPE; } /** @@ -61,12 +64,4 @@ public void appendModule( XMLWriter writer, String version, Boolean generateId ) writer.endElement(); } - - /** - * {@inheritDoc} - */ - public String getType() - { - return EJB_MODULE; - } } diff --git a/src/main/java/org/apache/maven/plugins/ear/HarModule.java b/src/main/java/org/apache/maven/plugins/ear/HarModule.java index 335b293a..1925204f 100644 --- a/src/main/java/org/apache/maven/plugins/ear/HarModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/HarModule.java @@ -31,11 +31,14 @@ public class HarModule extends AbstractEarModule implements JbossEarModule { + private static final String DEFAULT_ARTIFACT_TYPE = "har"; + /** * Create an instance. */ public HarModule() { + this.type = DEFAULT_ARTIFACT_TYPE; } /** @@ -67,12 +70,4 @@ public void appendJbossModule( XMLWriter writer, String version ) writer.endElement(); writer.endElement(); } - - /** - * {@inheritDoc} - */ - public String getType() - { - return "har"; - } } diff --git a/src/main/java/org/apache/maven/plugins/ear/JarModule.java b/src/main/java/org/apache/maven/plugins/ear/JarModule.java index baf30ffd..92756e73 100644 --- a/src/main/java/org/apache/maven/plugins/ear/JarModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/JarModule.java @@ -38,6 +38,8 @@ public class JarModule extends AbstractEarModule { + private static final String DEFAULT_ARTIFACT_TYPE = "jar"; + private Boolean includeInApplicationXml = Boolean.FALSE; /** @@ -45,7 +47,7 @@ public class JarModule */ public JarModule() { - super(); + this.type = DEFAULT_ARTIFACT_TYPE; } /** @@ -95,14 +97,6 @@ public void resolveArtifact( Set artifacts ) setLibBundleDir( earExecutionContext.getDefaultLibBundleDir() ); } - /** - * {@inheritDoc} - */ - public String getType() - { - return "jar"; - } - private void setLibBundleDir( String defaultLibBundleDir ) { if ( defaultLibBundleDir != null && bundleDir == null ) diff --git a/src/main/java/org/apache/maven/plugins/ear/ParModule.java b/src/main/java/org/apache/maven/plugins/ear/ParModule.java index f88b479c..ba9b045e 100644 --- a/src/main/java/org/apache/maven/plugins/ear/ParModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/ParModule.java @@ -29,13 +29,14 @@ public class ParModule extends EjbModule { + private static final String DEFAULT_ARTIFACT_TYPE = "par"; /** * Create an instance. */ public ParModule() { - super(); + this.type = DEFAULT_ARTIFACT_TYPE; } /** @@ -45,12 +46,4 @@ public ParModule( Artifact a ) { super( a ); } - - /** - * {@inheritDoc} - */ - public String getType() - { - return "par"; - } } diff --git a/src/main/java/org/apache/maven/plugins/ear/RarModule.java b/src/main/java/org/apache/maven/plugins/ear/RarModule.java index e9af1cbb..297ab65a 100644 --- a/src/main/java/org/apache/maven/plugins/ear/RarModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/RarModule.java @@ -30,6 +30,8 @@ public class RarModule extends AbstractEarModule { + private static final String DEFAULT_ARTIFACT_TYPE = "rar"; + private static final String RAR_MODULE = "connector"; /** @@ -37,6 +39,7 @@ public class RarModule */ public RarModule() { + this.type = DEFAULT_ARTIFACT_TYPE; } /** @@ -61,12 +64,4 @@ public void appendModule( XMLWriter writer, String version, Boolean generateId ) writer.endElement(); } - - /** - * {@inheritDoc} - */ - public String getType() - { - return "rar"; - } } diff --git a/src/main/java/org/apache/maven/plugins/ear/SarModule.java b/src/main/java/org/apache/maven/plugins/ear/SarModule.java index 624ad804..849f9f8c 100644 --- a/src/main/java/org/apache/maven/plugins/ear/SarModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/SarModule.java @@ -37,6 +37,8 @@ public class SarModule extends AbstractEarModule implements JbossEarModule { + private static final String DEFAULT_ARTIFACT_TYPE = "sar"; + private static final String SAR_MODULE = "connector"; /** @@ -44,6 +46,7 @@ public class SarModule */ public SarModule() { + this.type = DEFAULT_ARTIFACT_TYPE; } /** @@ -81,12 +84,4 @@ public void appendJbossModule( XMLWriter writer, String version ) writer.endElement(); writer.endElement(); } - - /** - * {@inheritDoc} - */ - public String getType() - { - return "sar"; - } } diff --git a/src/main/java/org/apache/maven/plugins/ear/WebModule.java b/src/main/java/org/apache/maven/plugins/ear/WebModule.java index a7194745..8ee897ab 100644 --- a/src/main/java/org/apache/maven/plugins/ear/WebModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/WebModule.java @@ -33,6 +33,8 @@ public class WebModule extends AbstractEarModule { + private static final String DEFAULT_ARTIFACT_TYPE = "war"; + private static final String WEB_MODULE = "web"; private static final String WEB_URI_FIELD = "web-uri"; @@ -46,6 +48,7 @@ public class WebModule */ public WebModule() { + this.type = DEFAULT_ARTIFACT_TYPE; } /** @@ -107,14 +110,6 @@ public String getContextRoot() return contextRoot; } - /** - * {@inheritDoc} - */ - public String getType() - { - return "war"; - } - /** * Generates a default context root for the given artifact, based on the artifactId. * diff --git a/src/main/java/org/apache/maven/plugins/ear/WsrModule.java b/src/main/java/org/apache/maven/plugins/ear/WsrModule.java index b1844a15..4ff16b10 100644 --- a/src/main/java/org/apache/maven/plugins/ear/WsrModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/WsrModule.java @@ -29,11 +29,14 @@ public class WsrModule extends RarModule { + private static final String DEFAULT_ARTIFACT_TYPE = "wsr"; + /** * Create an instance. */ public WsrModule() { + this.type = DEFAULT_ARTIFACT_TYPE; } /** @@ -43,12 +46,4 @@ public WsrModule( Artifact a ) { super( a ); } - - /** - * {@inheritDoc} - */ - public String getType() - { - return "wsr"; - } } \ No newline at end of file diff --git a/src/site/apt/modules.apt.vm b/src/site/apt/modules.apt.vm index ff5b532d..eb87749a 100644 --- a/src/site/apt/modules.apt.vm +++ b/src/site/apt/modules.apt.vm @@ -85,16 +85,17 @@ EAR Modules The following configuration options are available for EjbClientModule: - * <> - sets the groupId of the ejb-client artifact you want to - configure. + * <> - sets the groupId of the artifact you want to configure. - * <> - sets the artifactId of the ejb-client artifact you want to - configure. + * <> - sets the artifactId of the artifact you want to configure. - * <> - sets the classifier of the ejb-client artifact you want to - configure if multiple ejb-client artifacts matches the groupId/artifact. Use + * <> - sets the type of the artifact you want to configure. + Default is 'ejb-client'. + + * <> - sets the classifier of the artifact you want to + configure if multiple artifacts matches the groupId/artifactId/type. Use the mainArtifactId ('none' by default) to define the main artifact (e.g. - the artifact without a classifier) + the artifact without a classifier). * <> - sets the location of this artifact inside the ear archive. If not set, this artifact will be packaged in the root of the archive. @@ -121,16 +122,17 @@ EAR Modules The following configuration options are available for EjbModule: - * <> - sets the groupId of the ejb artifact you want to - configure. + * <> - sets the groupId of the artifact you want to configure. + + * <> - sets the artifactId of the artifact you want to configure. - * <> - sets the artifactId of the ejb artifact you want to - configure. + * <> - sets the type of the artifact you want to configure. + Default is 'ejb'. - * <> - sets the classifier of the ejb artifact you want to - configure if multiple ejb artifacts matches the groupId/artifact. Use + * <> - sets the classifier of the artifact you want to + configure if multiple artifacts matches the groupId/artifactId/type. Use the mainArtifactId ('none' by default) to define the main artifact (e.g. - the artifact without a classifier) + the artifact without a classifier). * <> - sets the location of this artifact inside the ear archive. If not set, this artifact will be packaged in the root of the archive. @@ -157,16 +159,17 @@ EAR Modules The following configuration options are available for JarModule: - * <> - sets the groupId of the jar artifact you want to - configure. + * <> - sets the groupId of the artifact you want to configure. + + * <> - sets the artifactId of the artifact you want to configure. - * <> - sets the artifactId of the jar artifact you want to - configure. + * <> - sets the type of the artifact you want to configure. + Default is 'jar'. Use 'test-jar' if the artifact of the module is test JAR. - * <> - sets the classifier of the jar artifact you want to - configure if multiple jar artifacts matches the groupId/artifact. Use + * <> - sets the classifier of the artifact you want to + configure if multiple artifacts matches the groupId/artifactId/type. Use the mainArtifactId ('none' by default) to define the main artifact (e.g. - the artifact without a classifier) + the artifact without a classifier). * <> - sets the location of this artifact inside the ear archive. If not set, this artifact will be packaged in the root of the archive. @@ -196,16 +199,17 @@ EAR Modules The following configuration options are available for ParModule: - * <> - sets the groupId of the par artifact you want to - configure. + * <> - sets the groupId of the artifact you want to configure. - * <> - sets the artifactId of the par artifact you want to - configure. + * <> - sets the artifactId of the artifact you want to configure. - * <> - sets the classifier of the par artifact you want to - configure if multiple par artifacts matches the groupId/artifact. Use + * <> - sets the type of the artifact you want to configure. + Default is 'par'. + + * <> - sets the classifier of the artifact you want to + configure if multiple artifacts matches the groupId/artifactId/type. Use the mainArtifactId ('none' by default) to define the main artifact (e.g. - the artifact without a classifier) + the artifact without a classifier). * <> - sets the location of this artifact inside the ear archive. If not set, this artifact will be packaged in the root of the archive. @@ -232,16 +236,17 @@ EAR Modules The following configuration options are available for RarModule: - * <> - sets the groupId of the rar artifact you want to - configure. + * <> - sets the groupId of the artifact you want to configure. + + * <> - sets the artifactId of the artifact you want to configure. - * <> - sets the artifactId of the rar artifact you want to - configure. + * <> - sets the type of the artifact you want to configure. + Default is 'rar'. - * <> - sets the classifier of the rar artifact you want to - configure if multiple rar artifacts matches the groupId/artifact. Use + * <> - sets the classifier of the artifact you want to + configure if multiple artifacts matches the groupId/artifactId/type. Use the mainArtifactId ('none' by default) to define the main artifact (e.g. - the artifact without a classifier) + the artifact without a classifier). * <> - sets the location of this artifact inside the ear archive. If not set, this artifact will be packaged in the root of the archive. @@ -268,16 +273,17 @@ EAR Modules The following configuration options are available for SarModule: - * <> - sets the groupId of the sar artifact you want to - configure. + * <> - sets the groupId of the artifact you want to configure. + + * <> - sets the artifactId of the artifact you want to configure. - * <> - sets the artifactId of the sar artifact you want to - configure. + * <> - sets the type of the artifact you want to configure. + Default is 'sar'. - * <> - sets the classifier of the sar artifact you want to - configure if multiple sar artifacts matches the groupId/artifact. Use + * <> - sets the classifier of the artifact you want to + configure if multiple artifacts matches the groupId/artifactId/type. Use the mainArtifactId ('none' by default) to define the main artifact (e.g. - the artifact without a classifier) + the artifact without a classifier). * <> - sets the location of this artifact inside the ear archive. If not set, this artifact will be packaged in the root of the archive. @@ -301,16 +307,17 @@ EAR Modules The following configuration options are available for WebModule: - * <> - sets the groupId of the web artifact you want to - configure. + * <> - sets the groupId of the artifact you want to configure. - * <> - sets the artifactId of the web artifact you want to - configure. + * <> - sets the artifactId of the artifact you want to configure. - * <> - sets the classifier of the web artifact you want to - configure if multiple web artifacts matches the groupId/artifact. Use + * <> - sets the type of the artifact you want to configure. + Default is 'war'. + + * <> - sets the classifier of the artifact you want to + configure if multiple artifacts matches the groupId/artifactId/type. Use the mainArtifactId ('none' by default) to define the main artifact (e.g. - the artifact without a classifier) + the artifact without a classifier). * <> - sets the location of this artifact inside the ear archive. If not set, this artifact will be packaged in the root of the archive. @@ -339,16 +346,17 @@ EAR Modules The following configuration options are available for WsrModule: - * <> - sets the groupId of the wsr artifact you want to - configure. + * <> - sets the groupId of the artifact you want to configure. + + * <> - sets the artifactId of the artifact you want to configure. - * <> - sets the artifactId of the wsr artifact you want to - configure. + * <> - sets the type of the artifact you want to configure. + Default is 'wsr'. - * <> - sets the classifier of the wst artifact you want to - configure if multiple wsr artifacts matches the groupId/artifact. Use + * <> - sets the classifier of the artifact you want to + configure if multiple artifacts matches the groupId/artifactId/type. Use the mainArtifactId ('none' by default) to define the main artifact (e.g. - the artifact without a classifier) + the artifact without a classifier). * <> - sets the location of this artifact inside the ear archive. If not set, this artifact will be packaged in the root of the archive. @@ -375,16 +383,17 @@ EAR Modules The following configuration options are available for HarModule: - * <> - sets the groupId of the hibernate archive artifact you - want to configure. + * <> - sets the groupId of the artifact you want to configure. - * <> - sets the artifactId of the hibernate archive artifact - you want to configure. + * <> - sets the artifactId of artifact you want to configure. - * <> - sets the classifier of the hibernate archive artifact - you want to configure if multiple hibernate archive artifacts matches - the groupId/artifact. Use the mainArtifactId ('none' by default) to define - the main artifact (e.g. the artifact without a classifier) + * <> - sets the type of the artifact you want to configure. + Default is 'har'. + + * <> - sets the classifier of the artifact you want to + configure if multiple artifacts matches the groupId/artifactId/type. Use + the mainArtifactId ('none' by default) to define the main artifact (e.g. + the artifact without a classifier). * <> - sets the location of this artifact inside the ear archive. If not set, this artifact will be packaged in the root of the archive. @@ -405,16 +414,17 @@ EAR Modules The following configuration options are available for AppClientModule: - * <> - sets the groupId of the application client artifact you want to - configure. + * <> - sets the groupId of the artifact you want to configure. + + * <> - sets the artifactId of the artifact you want to configure. - * <> - sets the artifactId of the applicant client artifact you want to - configure. + * <> - sets the type of the artifact you want to configure. + Default is 'app-client'. - * <> - sets the classifier of the application client artifact you want to - configure if multiple application client artifacts matches the groupId/artifact. Use + * <> - sets the classifier of the artifact you want to + configure if multiple artifacts matches the groupId/artifactId/type. Use the mainArtifactId ('none' by default) to define the main artifact (e.g. - the artifact without a classifier) + the artifact without a classifier). * <> - sets the location of this artifact inside the ear archive. If not set, this artifact will be packaged in the root of the archive. diff --git a/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java b/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java index 7d7a959c..308ee5f0 100644 --- a/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java +++ b/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java @@ -1015,4 +1015,25 @@ public void testProject092() new String[][] { { jarSampleFourTestLibrary, jarSampleThreeLibrary, jarSampleTwoLibrary } }, true ); } + + /** + * Ensures that test JAR dependency representing Java module is described in deployment descriptor + * if includeInApplicationXml property of module is {@code true}. + */ + public void testProject093() + throws Exception + { + final String warModule = "eartest-war-sample-two-1.0.war"; + final String jarSampleTwoLibrary = "eartest-jar-sample-two-1.0.jar"; + final String jarSampleThreeLibrary = "eartest-jar-sample-three-with-deps-1.0.jar"; + final String jarSampleFourTestLibrary = "eartest-jar-sample-four-1.0-tests.jar"; + final String jarSampleFiveLibrary = "eartest-jar-sample-five-1.0.jar"; + doTestProject( "project-093", "ear", + new String[] { warModule, jarSampleTwoLibrary, jarSampleThreeLibrary, jarSampleFourTestLibrary, jarSampleFiveLibrary }, + new boolean[] { false, false, false, false, false }, + new String[] { warModule }, + new boolean[] { false }, + new String[][] { { jarSampleFourTestLibrary, jarSampleFiveLibrary, jarSampleThreeLibrary, jarSampleTwoLibrary } }, + true ); + } } diff --git a/src/test/resources/projects/project-093/ear/expected-META-INF/application.xml b/src/test/resources/projects/project-093/ear/expected-META-INF/application.xml new file mode 100644 index 00000000..417d1745 --- /dev/null +++ b/src/test/resources/projects/project-093/ear/expected-META-INF/application.xml @@ -0,0 +1,34 @@ + + + + maven-ear-plugin-test-project-093 + + eartest-jar-sample-four-1.0-tests.jar + + + eartest-jar-sample-five-1.0.jar + + + + eartest-war-sample-two-1.0.war + /war-sample-two + + + diff --git a/src/test/resources/projects/project-093/ear/pom.xml b/src/test/resources/projects/project-093/ear/pom.xml new file mode 100644 index 00000000..423818af --- /dev/null +++ b/src/test/resources/projects/project-093/ear/pom.xml @@ -0,0 +1,69 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-093-parent + 99.0 + + maven-ear-plugin-test-project-093 + ear + + + eartest + war-sample-two + war + + + eartest + war-sample-two + pom + + + + + + org.apache.maven.plugins + maven-ear-plugin + @project.version@ + + 6 + true + + + eartest + jar-sample-four + test-jar + true + + + eartest + jar-sample-five + true + + + + + + + diff --git a/src/test/resources/projects/project-093/jar-five/pom.xml b/src/test/resources/projects/project-093/jar-five/pom.xml new file mode 100644 index 00000000..129b3e82 --- /dev/null +++ b/src/test/resources/projects/project-093/jar-five/pom.xml @@ -0,0 +1,38 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-093-parent + 99.0 + + eartest + jar-sample-five + 1.0 + + + eartest + jar-sample-three-with-deps + + + diff --git a/src/test/resources/projects/project-093/jar-four/pom.xml b/src/test/resources/projects/project-093/jar-four/pom.xml new file mode 100644 index 00000000..97e5cff0 --- /dev/null +++ b/src/test/resources/projects/project-093/jar-four/pom.xml @@ -0,0 +1,54 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-093-parent + 99.0 + + eartest + jar-sample-four + 1.0 + + + eartest + jar-sample-three-with-deps + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + test-jar + + test-jar + + + + + + + diff --git a/src/test/resources/projects/project-093/pom.xml b/src/test/resources/projects/project-093/pom.xml new file mode 100644 index 00000000..512a6ef5 --- /dev/null +++ b/src/test/resources/projects/project-093/pom.xml @@ -0,0 +1,84 @@ + + + + + 4.0.0 + ear + maven-ear-plugin-test-project-093-parent + 99.0 + pom + + jar-four + jar-five + war + ear + + + + + eartest + jar-sample-three-with-deps + 1.0 + + + eartest + jar-sample-four + 1.0 + tests + test-jar + + + eartest + jar-sample-five + 1.0 + jar + + + eartest + war-sample-two + 1.0 + war + + + eartest + war-sample-two + 1.0 + pom + + + + + + + + org.apache.maven.plugins + maven-war-plugin + @mavenWarPluginVersion@ + + + org.apache.maven.plugins + maven-jar-plugin + @mavenJarPluginVersion@ + + + + + diff --git a/src/test/resources/projects/project-093/war/pom.xml b/src/test/resources/projects/project-093/war/pom.xml new file mode 100644 index 00000000..b585532a --- /dev/null +++ b/src/test/resources/projects/project-093/war/pom.xml @@ -0,0 +1,46 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-093-parent + 99.0 + + eartest + war-sample-two + 1.0 + war + + + eartest + jar-sample-four + tests + test-jar + + + eartest + jar-sample-five + jar + + + diff --git a/src/test/resources/projects/project-093/war/src/main/webapp/WEB-INF/web.xml b/src/test/resources/projects/project-093/war/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..fbbf3070 --- /dev/null +++ b/src/test/resources/projects/project-093/war/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + From 90df465ebaf5808e619f30ad62be7b8f01fc6cc5 Mon Sep 17 00:00:00 2001 From: Marat Abrarov Date: Thu, 22 Oct 2020 23:10:23 +0300 Subject: [PATCH 4/9] [MEAR-216] - Support of jboss-sar, jboss-har and jboss-par types of artifacts. --- pom.xml | 2 + .../maven/plugins/ear/EarModuleFactory.java | 9 +- .../maven/plugins/ear/it/EarMojoIT.java | 16 ++++ .../ear/expected-META-INF/application.xml | 31 +++++++ .../ear/expected-META-INF/jboss-app.xml | 31 +++++++ .../projects/project-094/ear/pom.xml | 83 +++++++++++++++++++ .../projects/project-094/har/pom.xml | 42 ++++++++++ .../main/resources/META-INF/jboss-service.xml | 21 +++++ .../projects/project-094/par/pom.xml | 42 ++++++++++ .../jpdl/par-sample-one/processdefinition.xml | 22 +++++ .../resources/projects/project-094/pom.xml | 83 +++++++++++++++++++ .../projects/project-094/sar/pom.xml | 42 ++++++++++ .../main/resources/META-INF/jboss-service.xml | 21 +++++ .../projects/project-094/war/pom.xml | 33 ++++++++ .../war/src/main/webapp/WEB-INF/web.xml | 24 ++++++ 15 files changed, 498 insertions(+), 4 deletions(-) create mode 100644 src/test/resources/projects/project-094/ear/expected-META-INF/application.xml create mode 100644 src/test/resources/projects/project-094/ear/expected-META-INF/jboss-app.xml create mode 100644 src/test/resources/projects/project-094/ear/pom.xml create mode 100644 src/test/resources/projects/project-094/har/pom.xml create mode 100644 src/test/resources/projects/project-094/har/src/main/resources/META-INF/jboss-service.xml create mode 100644 src/test/resources/projects/project-094/par/pom.xml create mode 100644 src/test/resources/projects/project-094/par/src/main/jpdl/par-sample-one/processdefinition.xml create mode 100644 src/test/resources/projects/project-094/pom.xml create mode 100644 src/test/resources/projects/project-094/sar/pom.xml create mode 100644 src/test/resources/projects/project-094/sar/src/main/resources/META-INF/jboss-service.xml create mode 100644 src/test/resources/projects/project-094/war/pom.xml create mode 100644 src/test/resources/projects/project-094/war/src/main/webapp/WEB-INF/web.xml diff --git a/pom.xml b/pom.xml index 14a4da40..73aac8a8 100644 --- a/pom.xml +++ b/pom.xml @@ -90,6 +90,7 @@ 2.5.1 2.3 3.2.0 + 2.2 false ${invoker.skip} ${invoker.skip} @@ -288,6 +289,7 @@ org.apache.maven.plugins:maven-compiler-plugin:${mavenCompilerPluginVersion}:jar org.apache.maven.plugins:maven-ejb-plugin:${mavenEjbPluginVersion}:jar org.apache.maven.plugins:maven-jar-plugin:${mavenJarPluginVersion}:jar + org.codehaus.mojo:jboss-packaging-maven-plugin:${jbossPackagingPluginVersion}:jar ${invoker.install.skip} ${invoker.it.skip} diff --git a/src/main/java/org/apache/maven/plugins/ear/EarModuleFactory.java b/src/main/java/org/apache/maven/plugins/ear/EarModuleFactory.java index be8bfc20..dba38bdb 100644 --- a/src/main/java/org/apache/maven/plugins/ear/EarModuleFactory.java +++ b/src/main/java/org/apache/maven/plugins/ear/EarModuleFactory.java @@ -39,7 +39,8 @@ public final class EarModuleFactory */ public static final List STANDARD_ARTIFACT_TYPE = Collections.unmodifiableList( Arrays.asList( "jar", "ejb", "par", "ejb-client", "app-client", "rar", "war", - "sar", "wsr", "har", "test-jar" ) ); + "sar", "wsr", "har", "test-jar", "jboss-par", "jboss-sar", + "jboss-har" ) ); /** * Creates a new {@link EarModule} based on the specified {@link Artifact} and the specified execution @@ -78,7 +79,7 @@ else if ( "ejb".equals( artifactType ) ) { return new EjbModule( artifact ); } - else if ( "par".equals( artifactType ) ) + else if ( "par".equals( artifactType ) || "jboss-par".equals( artifactType ) ) { return new ParModule( artifact ); } @@ -106,7 +107,7 @@ else if ( "war".equals( artifactType ) ) { return new WebModule( artifact ); } - else if ( "sar".equals( artifactType ) ) + else if ( "sar".equals( artifactType ) || "jboss-sar".equals( artifactType ) ) { return new SarModule( artifact ); } @@ -114,7 +115,7 @@ else if ( "wsr".equals( artifactType ) ) { return new WsrModule( artifact ); } - else if ( "har".equals( artifactType ) ) + else if ( "har".equals( artifactType ) || "jboss-har".equals( artifactType ) ) { return new HarModule( artifact ); } diff --git a/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java b/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java index 308ee5f0..d867b5c4 100644 --- a/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java +++ b/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java @@ -1036,4 +1036,20 @@ public void testProject093() new String[][] { { jarSampleFourTestLibrary, jarSampleFiveLibrary, jarSampleThreeLibrary, jarSampleTwoLibrary } }, true ); } + + /** + * Ensures that artifacts with jboss-sar, jboss-har and jboss-par types are packaged in EAR and + * described in deployment descriptor when respective types are configured for EAR modules. + */ + public void testProject094() + throws Exception + { + final String warModule = "eartest-war-sample-three-1.0.war"; + final String sarSampleTwo = "eartest-sar-sample-two-1.0.sar"; + final String harSampleTwo = "eartest-har-sample-two-1.0.har"; + final String parSampleTwo = "eartest-par-sample-one-1.0.par"; + final String[] artifacts = { warModule, sarSampleTwo, harSampleTwo, parSampleTwo }; + final boolean[] artifactsDirectory = { false, false, false, false }; + doTestProject( "project-094", "ear", artifacts, artifactsDirectory, null, null, null , true ); + } } diff --git a/src/test/resources/projects/project-094/ear/expected-META-INF/application.xml b/src/test/resources/projects/project-094/ear/expected-META-INF/application.xml new file mode 100644 index 00000000..088c399c --- /dev/null +++ b/src/test/resources/projects/project-094/ear/expected-META-INF/application.xml @@ -0,0 +1,31 @@ + + + + maven-ear-plugin-test-project-094 + + + eartest-war-sample-three-1.0.war + /war-sample-three + + + + eartest-par-sample-one-1.0.par + + diff --git a/src/test/resources/projects/project-094/ear/expected-META-INF/jboss-app.xml b/src/test/resources/projects/project-094/ear/expected-META-INF/jboss-app.xml new file mode 100644 index 00000000..dc9962aa --- /dev/null +++ b/src/test/resources/projects/project-094/ear/expected-META-INF/jboss-app.xml @@ -0,0 +1,31 @@ + + + + + + + eartest-sar-sample-two-1.0.sar + + + eartest-har-sample-two-1.0.har + + diff --git a/src/test/resources/projects/project-094/ear/pom.xml b/src/test/resources/projects/project-094/ear/pom.xml new file mode 100644 index 00000000..a34bb7ef --- /dev/null +++ b/src/test/resources/projects/project-094/ear/pom.xml @@ -0,0 +1,83 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-094-parent + 99.0 + + maven-ear-plugin-test-project-094 + ear + + + eartest + war-sample-three + war + + + eartest + sar-sample-two + jboss-sar + + + eartest + har-sample-two + jboss-har + + + eartest + par-sample-one + jboss-par + + + + + + org.apache.maven.plugins + maven-ear-plugin + @project.version@ + + 6 + + eartest + sar-sample-two + jboss-sar + + + eartest + har-sample-two + jboss-sar + + + eartest + par-sample-one + jboss-par + + + 5 + + + + + + diff --git a/src/test/resources/projects/project-094/har/pom.xml b/src/test/resources/projects/project-094/har/pom.xml new file mode 100644 index 00000000..8bdb2f14 --- /dev/null +++ b/src/test/resources/projects/project-094/har/pom.xml @@ -0,0 +1,42 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-094-parent + 99.0 + + eartest + har-sample-two + 1.0 + jboss-har + + + + org.codehaus.mojo + jboss-packaging-maven-plugin + true + + + + diff --git a/src/test/resources/projects/project-094/har/src/main/resources/META-INF/jboss-service.xml b/src/test/resources/projects/project-094/har/src/main/resources/META-INF/jboss-service.xml new file mode 100644 index 00000000..53163284 --- /dev/null +++ b/src/test/resources/projects/project-094/har/src/main/resources/META-INF/jboss-service.xml @@ -0,0 +1,21 @@ + + + + diff --git a/src/test/resources/projects/project-094/par/pom.xml b/src/test/resources/projects/project-094/par/pom.xml new file mode 100644 index 00000000..d9ad1660 --- /dev/null +++ b/src/test/resources/projects/project-094/par/pom.xml @@ -0,0 +1,42 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-094-parent + 99.0 + + eartest + par-sample-one + 1.0 + jboss-par + + + + org.codehaus.mojo + jboss-packaging-maven-plugin + true + + + + diff --git a/src/test/resources/projects/project-094/par/src/main/jpdl/par-sample-one/processdefinition.xml b/src/test/resources/projects/project-094/par/src/main/jpdl/par-sample-one/processdefinition.xml new file mode 100644 index 00000000..44d6f135 --- /dev/null +++ b/src/test/resources/projects/project-094/par/src/main/jpdl/par-sample-one/processdefinition.xml @@ -0,0 +1,22 @@ + + + + + diff --git a/src/test/resources/projects/project-094/pom.xml b/src/test/resources/projects/project-094/pom.xml new file mode 100644 index 00000000..bdcbd543 --- /dev/null +++ b/src/test/resources/projects/project-094/pom.xml @@ -0,0 +1,83 @@ + + + + + 4.0.0 + ear + maven-ear-plugin-test-project-094-parent + 99.0 + pom + + war + sar + har + par + ear + + + 1.7 + 1.7 + + + + + eartest + war-sample-three + 1.0 + war + + + eartest + sar-sample-two + 1.0 + jboss-sar + + + eartest + har-sample-two + 1.0 + jboss-har + + + eartest + par-sample-one + 1.0 + jboss-par + + + + + + + + org.apache.maven.plugins + maven-war-plugin + @mavenWarPluginVersion@ + + + org.codehaus.mojo + jboss-packaging-maven-plugin + @jbossPackagingPluginVersion@ + + + + + diff --git a/src/test/resources/projects/project-094/sar/pom.xml b/src/test/resources/projects/project-094/sar/pom.xml new file mode 100644 index 00000000..a731f5b9 --- /dev/null +++ b/src/test/resources/projects/project-094/sar/pom.xml @@ -0,0 +1,42 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-094-parent + 99.0 + + eartest + sar-sample-two + 1.0 + jboss-sar + + + + org.codehaus.mojo + jboss-packaging-maven-plugin + true + + + + diff --git a/src/test/resources/projects/project-094/sar/src/main/resources/META-INF/jboss-service.xml b/src/test/resources/projects/project-094/sar/src/main/resources/META-INF/jboss-service.xml new file mode 100644 index 00000000..53163284 --- /dev/null +++ b/src/test/resources/projects/project-094/sar/src/main/resources/META-INF/jboss-service.xml @@ -0,0 +1,21 @@ + + + + diff --git a/src/test/resources/projects/project-094/war/pom.xml b/src/test/resources/projects/project-094/war/pom.xml new file mode 100644 index 00000000..0c2eda85 --- /dev/null +++ b/src/test/resources/projects/project-094/war/pom.xml @@ -0,0 +1,33 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-094-parent + 99.0 + + eartest + war-sample-three + 1.0 + war + diff --git a/src/test/resources/projects/project-094/war/src/main/webapp/WEB-INF/web.xml b/src/test/resources/projects/project-094/war/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..fbbf3070 --- /dev/null +++ b/src/test/resources/projects/project-094/war/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + From 4fb364255806bbe4d80f843922ffa2f116523b6e Mon Sep 17 00:00:00 2001 From: Marat Abrarov Date: Thu, 22 Oct 2020 23:47:02 +0300 Subject: [PATCH 5/9] [MEAR-216] - Refactoring. --- .../maven/plugins/ear/AppClientModule.java | 5 +- .../maven/plugins/ear/EarModuleFactory.java | 52 +++++++++++++------ .../org/apache/maven/plugins/ear/EarMojo.java | 4 +- .../maven/plugins/ear/EjbClientModule.java | 5 +- .../apache/maven/plugins/ear/EjbModule.java | 5 +- .../apache/maven/plugins/ear/HarModule.java | 5 +- .../apache/maven/plugins/ear/JarModule.java | 5 +- .../apache/maven/plugins/ear/ParModule.java | 5 +- .../apache/maven/plugins/ear/RarModule.java | 5 +- .../apache/maven/plugins/ear/SarModule.java | 5 +- .../apache/maven/plugins/ear/WebModule.java | 5 +- .../apache/maven/plugins/ear/WsrModule.java | 5 +- 12 files changed, 78 insertions(+), 28 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/ear/AppClientModule.java b/src/main/java/org/apache/maven/plugins/ear/AppClientModule.java index 14c5b6dc..6ff99942 100644 --- a/src/main/java/org/apache/maven/plugins/ear/AppClientModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/AppClientModule.java @@ -30,7 +30,10 @@ public class AppClientModule extends AbstractEarModule { - private static final String DEFAULT_ARTIFACT_TYPE = "app-client"; + /** + * Default type of the artifact of an application client module. + */ + public static final String DEFAULT_ARTIFACT_TYPE = "app-client"; /** * Create an instance. diff --git a/src/main/java/org/apache/maven/plugins/ear/EarModuleFactory.java b/src/main/java/org/apache/maven/plugins/ear/EarModuleFactory.java index dba38bdb..f8a1ba90 100644 --- a/src/main/java/org/apache/maven/plugins/ear/EarModuleFactory.java +++ b/src/main/java/org/apache/maven/plugins/ear/EarModuleFactory.java @@ -34,13 +34,30 @@ */ public final class EarModuleFactory { + private static final String TEST_JAR_ARTIFACT_TYPE = "test-jar"; + private static final String JBOSS_PAR_ARTIFACT_TYPE = "jboss-par"; + private static final String JBOSS_SAR_ARTIFACT_TYPE = "jboss-sar"; + private static final String JBOSS_HAR_ARTIFACT_TYPE = "jboss-har"; + /** * The list of artifact types. */ - public static final List STANDARD_ARTIFACT_TYPE = - Collections.unmodifiableList( Arrays.asList( "jar", "ejb", "par", "ejb-client", "app-client", "rar", "war", - "sar", "wsr", "har", "test-jar", "jboss-par", "jboss-sar", - "jboss-har" ) ); + private static final List STANDARD_ARTIFACT_TYPES = + Collections.unmodifiableList( Arrays.asList( + JarModule.DEFAULT_ARTIFACT_TYPE, + EjbModule.DEFAULT_ARTIFACT_TYPE, + ParModule.DEFAULT_ARTIFACT_TYPE, + EjbClientModule.DEFAULT_ARTIFACT_TYPE, + AppClientModule.DEFAULT_ARTIFACT_TYPE, + RarModule.DEFAULT_ARTIFACT_TYPE, + WebModule.DEFAULT_ARTIFACT_TYPE, + SarModule.DEFAULT_ARTIFACT_TYPE, + WsrModule.DEFAULT_ARTIFACT_TYPE, + HarModule.DEFAULT_ARTIFACT_TYPE, + TEST_JAR_ARTIFACT_TYPE, + JBOSS_PAR_ARTIFACT_TYPE, + JBOSS_SAR_ARTIFACT_TYPE, + JBOSS_HAR_ARTIFACT_TYPE ) ); /** * Creates a new {@link EarModule} based on the specified {@link Artifact} and the specified execution @@ -71,19 +88,20 @@ public static EarModule newEarModule( Artifact artifact, JavaEEVersion javaEEVer throw new UnknownArtifactTypeException( e.getMessage() + " for " + artifact.getArtifactId() ); } - if ( "jar".equals( artifactType ) || "test-jar".equals( artifactType ) ) + if ( JarModule.DEFAULT_ARTIFACT_TYPE.equals( artifactType ) || TEST_JAR_ARTIFACT_TYPE.equals( artifactType ) ) { return new JarModule( artifact, defaultLibBundleDir, includeInApplicationXml ); } - else if ( "ejb".equals( artifactType ) ) + else if ( EjbModule.DEFAULT_ARTIFACT_TYPE.equals( artifactType ) ) { return new EjbModule( artifact ); } - else if ( "par".equals( artifactType ) || "jboss-par".equals( artifactType ) ) + else if ( ParModule.DEFAULT_ARTIFACT_TYPE.equals( artifactType ) + || JBOSS_PAR_ARTIFACT_TYPE.equals( artifactType ) ) { return new ParModule( artifact ); } - else if ( "ejb-client".equals( artifactType ) ) + else if ( EjbClientModule.DEFAULT_ARTIFACT_TYPE.equals( artifactType ) ) { // Somewhat weird way to tackle the problem described in MEAR-85 if ( javaEEVersion.le( JavaEEVersion.ONE_DOT_FOUR ) ) @@ -95,27 +113,29 @@ else if ( "ejb-client".equals( artifactType ) ) return new EjbClientModule( artifact, defaultLibBundleDir ); } } - else if ( "app-client".equals( artifactType ) ) + else if ( AppClientModule.DEFAULT_ARTIFACT_TYPE.equals( artifactType ) ) { return new AppClientModule( artifact ); } - else if ( "rar".equals( artifactType ) ) + else if ( RarModule.DEFAULT_ARTIFACT_TYPE.equals( artifactType ) ) { return new RarModule( artifact ); } - else if ( "war".equals( artifactType ) ) + else if ( WebModule.DEFAULT_ARTIFACT_TYPE.equals( artifactType ) ) { return new WebModule( artifact ); } - else if ( "sar".equals( artifactType ) || "jboss-sar".equals( artifactType ) ) + else if ( SarModule.DEFAULT_ARTIFACT_TYPE.equals( artifactType ) + || JBOSS_SAR_ARTIFACT_TYPE.equals( artifactType ) ) { return new SarModule( artifact ); } - else if ( "wsr".equals( artifactType ) ) + else if ( WsrModule.DEFAULT_ARTIFACT_TYPE.equals( artifactType ) ) { return new WsrModule( artifact ); } - else if ( "har".equals( artifactType ) || "jboss-har".equals( artifactType ) ) + else if ( HarModule.DEFAULT_ARTIFACT_TYPE.equals( artifactType ) + || JBOSS_HAR_ARTIFACT_TYPE.equals( artifactType ) ) { return new HarModule( artifact ); } @@ -132,7 +152,7 @@ else if ( "har".equals( artifactType ) || "jboss-har".equals( artifactType ) ) */ public static List getStandardArtifactTypes() { - return STANDARD_ARTIFACT_TYPE; + return STANDARD_ARTIFACT_TYPES; } /** @@ -143,7 +163,7 @@ public static List getStandardArtifactTypes() */ public static boolean isStandardArtifactType( final String type ) { - return STANDARD_ARTIFACT_TYPE.contains( type ); + return STANDARD_ARTIFACT_TYPES.contains( type ); } } diff --git a/src/main/java/org/apache/maven/plugins/ear/EarMojo.java b/src/main/java/org/apache/maven/plugins/ear/EarMojo.java index 3b7cd919..77c382e3 100644 --- a/src/main/java/org/apache/maven/plugins/ear/EarMojo.java +++ b/src/main/java/org/apache/maven/plugins/ear/EarMojo.java @@ -498,10 +498,10 @@ private List createUnpackList() unpackTypesList = Arrays.asList( unpackTypes.split( "," ) ); for ( String type : unpackTypesList ) { - if ( !EarModuleFactory.STANDARD_ARTIFACT_TYPE.contains( type ) ) + if ( !EarModuleFactory.isStandardArtifactType( type ) ) { throw new MojoExecutionException( "Invalid type [" + type + "] supported types are " - + EarModuleFactory.STANDARD_ARTIFACT_TYPE ); + + EarModuleFactory.getStandardArtifactTypes() ); } } getLog().debug( "Initialized unpack types " + unpackTypesList ); diff --git a/src/main/java/org/apache/maven/plugins/ear/EjbClientModule.java b/src/main/java/org/apache/maven/plugins/ear/EjbClientModule.java index ac610653..bd16ebc6 100644 --- a/src/main/java/org/apache/maven/plugins/ear/EjbClientModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/EjbClientModule.java @@ -29,7 +29,10 @@ public class EjbClientModule extends JarModule { - private static final String DEFAULT_ARTIFACT_TYPE = "ejb-client"; + /** + * Default type of the artifact of an ejb client module. + */ + public static final String DEFAULT_ARTIFACT_TYPE = "ejb-client"; /** * Create an instance. diff --git a/src/main/java/org/apache/maven/plugins/ear/EjbModule.java b/src/main/java/org/apache/maven/plugins/ear/EjbModule.java index fef44dc9..f9adb3c5 100644 --- a/src/main/java/org/apache/maven/plugins/ear/EjbModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/EjbModule.java @@ -30,7 +30,10 @@ public class EjbModule extends AbstractEarModule { - private static final String DEFAULT_ARTIFACT_TYPE = "ejb"; + /** + * Default type of the artifact of an EJB module. + */ + public static final String DEFAULT_ARTIFACT_TYPE = "ejb"; private static final String EJB_MODULE = "ejb"; diff --git a/src/main/java/org/apache/maven/plugins/ear/HarModule.java b/src/main/java/org/apache/maven/plugins/ear/HarModule.java index 1925204f..0130c5ad 100644 --- a/src/main/java/org/apache/maven/plugins/ear/HarModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/HarModule.java @@ -31,7 +31,10 @@ public class HarModule extends AbstractEarModule implements JbossEarModule { - private static final String DEFAULT_ARTIFACT_TYPE = "har"; + /** + * Default type of the artifact of a JBoss Hibernate archive. + */ + public static final String DEFAULT_ARTIFACT_TYPE = "har"; /** * Create an instance. diff --git a/src/main/java/org/apache/maven/plugins/ear/JarModule.java b/src/main/java/org/apache/maven/plugins/ear/JarModule.java index 92756e73..9f9f3183 100644 --- a/src/main/java/org/apache/maven/plugins/ear/JarModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/JarModule.java @@ -38,7 +38,10 @@ public class JarModule extends AbstractEarModule { - private static final String DEFAULT_ARTIFACT_TYPE = "jar"; + /** + * Default type of the artifact of a non Java EE module such as third party library. + */ + public static final String DEFAULT_ARTIFACT_TYPE = "jar"; private Boolean includeInApplicationXml = Boolean.FALSE; diff --git a/src/main/java/org/apache/maven/plugins/ear/ParModule.java b/src/main/java/org/apache/maven/plugins/ear/ParModule.java index ba9b045e..53fbcc9c 100644 --- a/src/main/java/org/apache/maven/plugins/ear/ParModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/ParModule.java @@ -29,7 +29,10 @@ public class ParModule extends EjbModule { - private static final String DEFAULT_ARTIFACT_TYPE = "par"; + /** + * Default type of the artifact of a Par module. + */ + public static final String DEFAULT_ARTIFACT_TYPE = "par"; /** * Create an instance. diff --git a/src/main/java/org/apache/maven/plugins/ear/RarModule.java b/src/main/java/org/apache/maven/plugins/ear/RarModule.java index 297ab65a..5ba57a18 100644 --- a/src/main/java/org/apache/maven/plugins/ear/RarModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/RarModule.java @@ -30,7 +30,10 @@ public class RarModule extends AbstractEarModule { - private static final String DEFAULT_ARTIFACT_TYPE = "rar"; + /** + * Default type of the artifact of an Java EE connector module. + */ + public static final String DEFAULT_ARTIFACT_TYPE = "rar"; private static final String RAR_MODULE = "connector"; diff --git a/src/main/java/org/apache/maven/plugins/ear/SarModule.java b/src/main/java/org/apache/maven/plugins/ear/SarModule.java index 849f9f8c..4d87342f 100644 --- a/src/main/java/org/apache/maven/plugins/ear/SarModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/SarModule.java @@ -37,7 +37,10 @@ public class SarModule extends AbstractEarModule implements JbossEarModule { - private static final String DEFAULT_ARTIFACT_TYPE = "sar"; + /** + * Default type of the artifact of a JBoss sar module. + */ + public static final String DEFAULT_ARTIFACT_TYPE = "sar"; private static final String SAR_MODULE = "connector"; diff --git a/src/main/java/org/apache/maven/plugins/ear/WebModule.java b/src/main/java/org/apache/maven/plugins/ear/WebModule.java index 8ee897ab..510502ca 100644 --- a/src/main/java/org/apache/maven/plugins/ear/WebModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/WebModule.java @@ -33,7 +33,10 @@ public class WebModule extends AbstractEarModule { - private static final String DEFAULT_ARTIFACT_TYPE = "war"; + /** + * Default type of the artifact of a Web application module. + */ + public static final String DEFAULT_ARTIFACT_TYPE = "war"; private static final String WEB_MODULE = "web"; diff --git a/src/main/java/org/apache/maven/plugins/ear/WsrModule.java b/src/main/java/org/apache/maven/plugins/ear/WsrModule.java index 4ff16b10..e2456e6a 100644 --- a/src/main/java/org/apache/maven/plugins/ear/WsrModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/WsrModule.java @@ -29,7 +29,10 @@ public class WsrModule extends RarModule { - private static final String DEFAULT_ARTIFACT_TYPE = "wsr"; + /** + * Default type of the artifact of a JBoss wsr module. + */ + public static final String DEFAULT_ARTIFACT_TYPE = "wsr"; /** * Create an instance. From c1ce54104df8d6bb7bc41f0357871660a9b4a800 Mon Sep 17 00:00:00 2001 From: Marat Abrarov Date: Sat, 24 Oct 2020 19:41:31 +0300 Subject: [PATCH 6/9] [MEAR-153] - Documentation for EAR modules which artifacts are built with JBoss Packaging Maven Plugin. --- src/site/apt/modules.apt.vm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/site/apt/modules.apt.vm b/src/site/apt/modules.apt.vm index eb87749a..c157a1e9 100644 --- a/src/site/apt/modules.apt.vm +++ b/src/site/apt/modules.apt.vm @@ -204,7 +204,9 @@ EAR Modules * <> - sets the artifactId of the artifact you want to configure. * <> - sets the type of the artifact you want to configure. - Default is 'par'. + Default is 'par'. If the artifact you want to configure is built with + {{{https://github.com/mojohaus/jboss-packaging-maven-plugin}JBoss Packaging Maven Plugin}} + and has 'jboss-par' type, then that type should be specified explicitly. * <> - sets the classifier of the artifact you want to configure if multiple artifacts matches the groupId/artifactId/type. Use @@ -278,7 +280,9 @@ EAR Modules * <> - sets the artifactId of the artifact you want to configure. * <> - sets the type of the artifact you want to configure. - Default is 'sar'. + Default is 'sar'. If the artifact you want to configure is built with + {{{https://github.com/mojohaus/jboss-packaging-maven-plugin}JBoss Packaging Maven Plugin}} + and has 'jboss-sar' type, then that type should be specified explicitly. * <> - sets the classifier of the artifact you want to configure if multiple artifacts matches the groupId/artifactId/type. Use @@ -388,7 +392,9 @@ EAR Modules * <> - sets the artifactId of artifact you want to configure. * <> - sets the type of the artifact you want to configure. - Default is 'har'. + Default is 'har'. If the artifact you want to configure is built with + {{{https://github.com/mojohaus/jboss-packaging-maven-plugin}JBoss Packaging Maven Plugin}} + and has 'jboss-har' type, then that type should be specified explicitly. * <> - sets the classifier of the artifact you want to configure if multiple artifacts matches the groupId/artifactId/type. Use From f771669835cb4cfaf77a8d364d19cb76ee137624 Mon Sep 17 00:00:00 2001 From: Marat Abrarov Date: Tue, 27 Oct 2020 04:06:56 +0300 Subject: [PATCH 7/9] [MEAR-216] - Renamed integration tests to follow existing naming --- .../org/apache/maven/plugins/ear/it/EarMojoIT.java | 12 ++++++------ .../ear/expected-META-INF/application.xml | 2 +- .../{project-092 => project-095}/ear/pom.xml | 4 ++-- .../jar-four => project-095/jar}/pom.xml | 2 +- .../projects/{project-092 => project-095}/pom.xml | 2 +- .../{project-092 => project-095}/war/pom.xml | 2 +- .../war/src/main/webapp/WEB-INF/web.xml | 0 .../ear/expected-META-INF/application.xml | 2 +- .../{project-093 => project-096}/ear/pom.xml | 4 ++-- .../{project-093 => project-096}/jar-five/pom.xml | 2 +- .../jar => project-096/jar-four}/pom.xml | 2 +- .../projects/{project-093 => project-096}/pom.xml | 2 +- .../{project-093 => project-096}/war/pom.xml | 2 +- .../war/src/main/webapp/WEB-INF/web.xml | 0 .../ear/expected-META-INF/application.xml | 2 +- .../ear/expected-META-INF/jboss-app.xml | 0 .../{project-094 => project-097}/ear/pom.xml | 4 ++-- .../{project-094 => project-097}/har/pom.xml | 2 +- .../src/main/resources/META-INF/jboss-service.xml | 0 .../{project-094 => project-097}/par/pom.xml | 2 +- .../main/jpdl/par-sample-one/processdefinition.xml | 0 .../projects/{project-094 => project-097}/pom.xml | 2 +- .../{project-094 => project-097}/sar/pom.xml | 2 +- .../src/main/resources/META-INF/jboss-service.xml | 0 .../{project-094 => project-097}/war/pom.xml | 2 +- .../war/src/main/webapp/WEB-INF/web.xml | 0 26 files changed, 27 insertions(+), 27 deletions(-) rename src/test/resources/projects/{project-092 => project-095}/ear/expected-META-INF/application.xml (95%) rename src/test/resources/projects/{project-092 => project-095}/ear/pom.xml (93%) rename src/test/resources/projects/{project-093/jar-four => project-095/jar}/pom.xml (96%) rename src/test/resources/projects/{project-092 => project-095}/pom.xml (97%) rename src/test/resources/projects/{project-092 => project-095}/war/pom.xml (95%) rename src/test/resources/projects/{project-092 => project-095}/war/src/main/webapp/WEB-INF/web.xml (100%) rename src/test/resources/projects/{project-093 => project-096}/ear/expected-META-INF/application.xml (95%) rename src/test/resources/projects/{project-093 => project-096}/ear/pom.xml (94%) rename src/test/resources/projects/{project-093 => project-096}/jar-five/pom.xml (95%) rename src/test/resources/projects/{project-092/jar => project-096/jar-four}/pom.xml (96%) rename src/test/resources/projects/{project-093 => project-096}/pom.xml (97%) rename src/test/resources/projects/{project-093 => project-096}/war/pom.xml (96%) rename src/test/resources/projects/{project-093 => project-096}/war/src/main/webapp/WEB-INF/web.xml (100%) rename src/test/resources/projects/{project-094 => project-097}/ear/expected-META-INF/application.xml (95%) rename src/test/resources/projects/{project-094 => project-097}/ear/expected-META-INF/jboss-app.xml (100%) rename src/test/resources/projects/{project-094 => project-097}/ear/pom.xml (95%) rename src/test/resources/projects/{project-094 => project-097}/har/pom.xml (95%) rename src/test/resources/projects/{project-094 => project-097}/har/src/main/resources/META-INF/jboss-service.xml (100%) rename src/test/resources/projects/{project-094 => project-097}/par/pom.xml (95%) rename src/test/resources/projects/{project-094 => project-097}/par/src/main/jpdl/par-sample-one/processdefinition.xml (100%) rename src/test/resources/projects/{project-094 => project-097}/pom.xml (97%) rename src/test/resources/projects/{project-094 => project-097}/sar/pom.xml (95%) rename src/test/resources/projects/{project-094 => project-097}/sar/src/main/resources/META-INF/jboss-service.xml (100%) rename src/test/resources/projects/{project-094 => project-097}/war/pom.xml (95%) rename src/test/resources/projects/{project-094 => project-097}/war/src/main/webapp/WEB-INF/web.xml (100%) diff --git a/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java b/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java index d867b5c4..245d0de8 100644 --- a/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java +++ b/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java @@ -1000,14 +1000,14 @@ public void testProject091() * Ensures that test JAR dependency of WAR is handled as regular JAR in terms of packaging and manifest modification * when skinnyWars option is turned on. */ - public void testProject092() + public void testProject095() throws Exception { final String warModule = "eartest-war-sample-two-1.0.war"; final String jarSampleTwoLibrary = "lib/eartest-jar-sample-two-1.0.jar"; final String jarSampleThreeLibrary = "lib/eartest-jar-sample-three-with-deps-1.0.jar"; final String jarSampleFourTestLibrary = "lib/eartest-jar-sample-four-1.0-tests.jar"; - doTestProject( "project-092", "ear", + doTestProject( "project-095", "ear", new String[] { warModule, jarSampleTwoLibrary, jarSampleThreeLibrary, jarSampleFourTestLibrary }, new boolean[] { false, false, false, false }, new String[] { warModule }, @@ -1020,7 +1020,7 @@ public void testProject092() * Ensures that test JAR dependency representing Java module is described in deployment descriptor * if includeInApplicationXml property of module is {@code true}. */ - public void testProject093() + public void testProject096() throws Exception { final String warModule = "eartest-war-sample-two-1.0.war"; @@ -1028,7 +1028,7 @@ public void testProject093() final String jarSampleThreeLibrary = "eartest-jar-sample-three-with-deps-1.0.jar"; final String jarSampleFourTestLibrary = "eartest-jar-sample-four-1.0-tests.jar"; final String jarSampleFiveLibrary = "eartest-jar-sample-five-1.0.jar"; - doTestProject( "project-093", "ear", + doTestProject( "project-096", "ear", new String[] { warModule, jarSampleTwoLibrary, jarSampleThreeLibrary, jarSampleFourTestLibrary, jarSampleFiveLibrary }, new boolean[] { false, false, false, false, false }, new String[] { warModule }, @@ -1041,7 +1041,7 @@ public void testProject093() * Ensures that artifacts with jboss-sar, jboss-har and jboss-par types are packaged in EAR and * described in deployment descriptor when respective types are configured for EAR modules. */ - public void testProject094() + public void testProject097() throws Exception { final String warModule = "eartest-war-sample-three-1.0.war"; @@ -1050,6 +1050,6 @@ public void testProject094() final String parSampleTwo = "eartest-par-sample-one-1.0.par"; final String[] artifacts = { warModule, sarSampleTwo, harSampleTwo, parSampleTwo }; final boolean[] artifactsDirectory = { false, false, false, false }; - doTestProject( "project-094", "ear", artifacts, artifactsDirectory, null, null, null , true ); + doTestProject( "project-097", "ear", artifacts, artifactsDirectory, null, null, null , true ); } } diff --git a/src/test/resources/projects/project-092/ear/expected-META-INF/application.xml b/src/test/resources/projects/project-095/ear/expected-META-INF/application.xml similarity index 95% rename from src/test/resources/projects/project-092/ear/expected-META-INF/application.xml rename to src/test/resources/projects/project-095/ear/expected-META-INF/application.xml index bfbbff0c..46efdd0a 100644 --- a/src/test/resources/projects/project-092/ear/expected-META-INF/application.xml +++ b/src/test/resources/projects/project-095/ear/expected-META-INF/application.xml @@ -18,7 +18,7 @@ specific language governing permissions and limitations under the License. --> - maven-ear-plugin-test-project-092 + maven-ear-plugin-test-project-095 eartest-war-sample-two-1.0.war diff --git a/src/test/resources/projects/project-092/ear/pom.xml b/src/test/resources/projects/project-095/ear/pom.xml similarity index 93% rename from src/test/resources/projects/project-092/ear/pom.xml rename to src/test/resources/projects/project-095/ear/pom.xml index 8839f0c5..37b9e9a8 100644 --- a/src/test/resources/projects/project-092/ear/pom.xml +++ b/src/test/resources/projects/project-095/ear/pom.xml @@ -23,10 +23,10 @@ under the License. 4.0.0 ear - maven-ear-plugin-test-project-092-parent + maven-ear-plugin-test-project-095-parent 99.0 - maven-ear-plugin-test-project-092 + maven-ear-plugin-test-project-095 ear diff --git a/src/test/resources/projects/project-093/jar-four/pom.xml b/src/test/resources/projects/project-095/jar/pom.xml similarity index 96% rename from src/test/resources/projects/project-093/jar-four/pom.xml rename to src/test/resources/projects/project-095/jar/pom.xml index 97e5cff0..3796ce52 100644 --- a/src/test/resources/projects/project-093/jar-four/pom.xml +++ b/src/test/resources/projects/project-095/jar/pom.xml @@ -23,7 +23,7 @@ under the License. 4.0.0 ear - maven-ear-plugin-test-project-093-parent + maven-ear-plugin-test-project-095-parent 99.0 eartest diff --git a/src/test/resources/projects/project-092/pom.xml b/src/test/resources/projects/project-095/pom.xml similarity index 97% rename from src/test/resources/projects/project-092/pom.xml rename to src/test/resources/projects/project-095/pom.xml index 2672123f..9d2f2472 100644 --- a/src/test/resources/projects/project-092/pom.xml +++ b/src/test/resources/projects/project-095/pom.xml @@ -22,7 +22,7 @@ under the License. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 ear - maven-ear-plugin-test-project-092-parent + maven-ear-plugin-test-project-095-parent 99.0 pom diff --git a/src/test/resources/projects/project-092/war/pom.xml b/src/test/resources/projects/project-095/war/pom.xml similarity index 95% rename from src/test/resources/projects/project-092/war/pom.xml rename to src/test/resources/projects/project-095/war/pom.xml index 02ec4413..a0549e7c 100644 --- a/src/test/resources/projects/project-092/war/pom.xml +++ b/src/test/resources/projects/project-095/war/pom.xml @@ -23,7 +23,7 @@ under the License. 4.0.0 ear - maven-ear-plugin-test-project-092-parent + maven-ear-plugin-test-project-095-parent 99.0 eartest diff --git a/src/test/resources/projects/project-092/war/src/main/webapp/WEB-INF/web.xml b/src/test/resources/projects/project-095/war/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from src/test/resources/projects/project-092/war/src/main/webapp/WEB-INF/web.xml rename to src/test/resources/projects/project-095/war/src/main/webapp/WEB-INF/web.xml diff --git a/src/test/resources/projects/project-093/ear/expected-META-INF/application.xml b/src/test/resources/projects/project-096/ear/expected-META-INF/application.xml similarity index 95% rename from src/test/resources/projects/project-093/ear/expected-META-INF/application.xml rename to src/test/resources/projects/project-096/ear/expected-META-INF/application.xml index 417d1745..96a5d413 100644 --- a/src/test/resources/projects/project-093/ear/expected-META-INF/application.xml +++ b/src/test/resources/projects/project-096/ear/expected-META-INF/application.xml @@ -18,7 +18,7 @@ specific language governing permissions and limitations under the License. --> - maven-ear-plugin-test-project-093 + maven-ear-plugin-test-project-096 eartest-jar-sample-four-1.0-tests.jar diff --git a/src/test/resources/projects/project-093/ear/pom.xml b/src/test/resources/projects/project-096/ear/pom.xml similarity index 94% rename from src/test/resources/projects/project-093/ear/pom.xml rename to src/test/resources/projects/project-096/ear/pom.xml index 423818af..9cacc91b 100644 --- a/src/test/resources/projects/project-093/ear/pom.xml +++ b/src/test/resources/projects/project-096/ear/pom.xml @@ -23,10 +23,10 @@ under the License. 4.0.0 ear - maven-ear-plugin-test-project-093-parent + maven-ear-plugin-test-project-096-parent 99.0 - maven-ear-plugin-test-project-093 + maven-ear-plugin-test-project-096 ear diff --git a/src/test/resources/projects/project-093/jar-five/pom.xml b/src/test/resources/projects/project-096/jar-five/pom.xml similarity index 95% rename from src/test/resources/projects/project-093/jar-five/pom.xml rename to src/test/resources/projects/project-096/jar-five/pom.xml index 129b3e82..7e0b335f 100644 --- a/src/test/resources/projects/project-093/jar-five/pom.xml +++ b/src/test/resources/projects/project-096/jar-five/pom.xml @@ -23,7 +23,7 @@ under the License. 4.0.0 ear - maven-ear-plugin-test-project-093-parent + maven-ear-plugin-test-project-096-parent 99.0 eartest diff --git a/src/test/resources/projects/project-092/jar/pom.xml b/src/test/resources/projects/project-096/jar-four/pom.xml similarity index 96% rename from src/test/resources/projects/project-092/jar/pom.xml rename to src/test/resources/projects/project-096/jar-four/pom.xml index b012806f..06326363 100644 --- a/src/test/resources/projects/project-092/jar/pom.xml +++ b/src/test/resources/projects/project-096/jar-four/pom.xml @@ -23,7 +23,7 @@ under the License. 4.0.0 ear - maven-ear-plugin-test-project-092-parent + maven-ear-plugin-test-project-096-parent 99.0 eartest diff --git a/src/test/resources/projects/project-093/pom.xml b/src/test/resources/projects/project-096/pom.xml similarity index 97% rename from src/test/resources/projects/project-093/pom.xml rename to src/test/resources/projects/project-096/pom.xml index 512a6ef5..f35c27c6 100644 --- a/src/test/resources/projects/project-093/pom.xml +++ b/src/test/resources/projects/project-096/pom.xml @@ -22,7 +22,7 @@ under the License. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 ear - maven-ear-plugin-test-project-093-parent + maven-ear-plugin-test-project-096-parent 99.0 pom diff --git a/src/test/resources/projects/project-093/war/pom.xml b/src/test/resources/projects/project-096/war/pom.xml similarity index 96% rename from src/test/resources/projects/project-093/war/pom.xml rename to src/test/resources/projects/project-096/war/pom.xml index b585532a..33547e7f 100644 --- a/src/test/resources/projects/project-093/war/pom.xml +++ b/src/test/resources/projects/project-096/war/pom.xml @@ -23,7 +23,7 @@ under the License. 4.0.0 ear - maven-ear-plugin-test-project-093-parent + maven-ear-plugin-test-project-096-parent 99.0 eartest diff --git a/src/test/resources/projects/project-093/war/src/main/webapp/WEB-INF/web.xml b/src/test/resources/projects/project-096/war/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from src/test/resources/projects/project-093/war/src/main/webapp/WEB-INF/web.xml rename to src/test/resources/projects/project-096/war/src/main/webapp/WEB-INF/web.xml diff --git a/src/test/resources/projects/project-094/ear/expected-META-INF/application.xml b/src/test/resources/projects/project-097/ear/expected-META-INF/application.xml similarity index 95% rename from src/test/resources/projects/project-094/ear/expected-META-INF/application.xml rename to src/test/resources/projects/project-097/ear/expected-META-INF/application.xml index 088c399c..3382f5a3 100644 --- a/src/test/resources/projects/project-094/ear/expected-META-INF/application.xml +++ b/src/test/resources/projects/project-097/ear/expected-META-INF/application.xml @@ -18,7 +18,7 @@ specific language governing permissions and limitations under the License. --> - maven-ear-plugin-test-project-094 + maven-ear-plugin-test-project-097 eartest-war-sample-three-1.0.war diff --git a/src/test/resources/projects/project-094/ear/expected-META-INF/jboss-app.xml b/src/test/resources/projects/project-097/ear/expected-META-INF/jboss-app.xml similarity index 100% rename from src/test/resources/projects/project-094/ear/expected-META-INF/jboss-app.xml rename to src/test/resources/projects/project-097/ear/expected-META-INF/jboss-app.xml diff --git a/src/test/resources/projects/project-094/ear/pom.xml b/src/test/resources/projects/project-097/ear/pom.xml similarity index 95% rename from src/test/resources/projects/project-094/ear/pom.xml rename to src/test/resources/projects/project-097/ear/pom.xml index a34bb7ef..090ff2e8 100644 --- a/src/test/resources/projects/project-094/ear/pom.xml +++ b/src/test/resources/projects/project-097/ear/pom.xml @@ -23,10 +23,10 @@ under the License. 4.0.0 ear - maven-ear-plugin-test-project-094-parent + maven-ear-plugin-test-project-097-parent 99.0 - maven-ear-plugin-test-project-094 + maven-ear-plugin-test-project-097 ear diff --git a/src/test/resources/projects/project-094/har/pom.xml b/src/test/resources/projects/project-097/har/pom.xml similarity index 95% rename from src/test/resources/projects/project-094/har/pom.xml rename to src/test/resources/projects/project-097/har/pom.xml index 8bdb2f14..f8cac414 100644 --- a/src/test/resources/projects/project-094/har/pom.xml +++ b/src/test/resources/projects/project-097/har/pom.xml @@ -23,7 +23,7 @@ under the License. 4.0.0 ear - maven-ear-plugin-test-project-094-parent + maven-ear-plugin-test-project-097-parent 99.0 eartest diff --git a/src/test/resources/projects/project-094/har/src/main/resources/META-INF/jboss-service.xml b/src/test/resources/projects/project-097/har/src/main/resources/META-INF/jboss-service.xml similarity index 100% rename from src/test/resources/projects/project-094/har/src/main/resources/META-INF/jboss-service.xml rename to src/test/resources/projects/project-097/har/src/main/resources/META-INF/jboss-service.xml diff --git a/src/test/resources/projects/project-094/par/pom.xml b/src/test/resources/projects/project-097/par/pom.xml similarity index 95% rename from src/test/resources/projects/project-094/par/pom.xml rename to src/test/resources/projects/project-097/par/pom.xml index d9ad1660..99edf37d 100644 --- a/src/test/resources/projects/project-094/par/pom.xml +++ b/src/test/resources/projects/project-097/par/pom.xml @@ -23,7 +23,7 @@ under the License. 4.0.0 ear - maven-ear-plugin-test-project-094-parent + maven-ear-plugin-test-project-097-parent 99.0 eartest diff --git a/src/test/resources/projects/project-094/par/src/main/jpdl/par-sample-one/processdefinition.xml b/src/test/resources/projects/project-097/par/src/main/jpdl/par-sample-one/processdefinition.xml similarity index 100% rename from src/test/resources/projects/project-094/par/src/main/jpdl/par-sample-one/processdefinition.xml rename to src/test/resources/projects/project-097/par/src/main/jpdl/par-sample-one/processdefinition.xml diff --git a/src/test/resources/projects/project-094/pom.xml b/src/test/resources/projects/project-097/pom.xml similarity index 97% rename from src/test/resources/projects/project-094/pom.xml rename to src/test/resources/projects/project-097/pom.xml index bdcbd543..4933d4fe 100644 --- a/src/test/resources/projects/project-094/pom.xml +++ b/src/test/resources/projects/project-097/pom.xml @@ -22,7 +22,7 @@ under the License. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 ear - maven-ear-plugin-test-project-094-parent + maven-ear-plugin-test-project-097-parent 99.0 pom diff --git a/src/test/resources/projects/project-094/sar/pom.xml b/src/test/resources/projects/project-097/sar/pom.xml similarity index 95% rename from src/test/resources/projects/project-094/sar/pom.xml rename to src/test/resources/projects/project-097/sar/pom.xml index a731f5b9..1789f432 100644 --- a/src/test/resources/projects/project-094/sar/pom.xml +++ b/src/test/resources/projects/project-097/sar/pom.xml @@ -23,7 +23,7 @@ under the License. 4.0.0 ear - maven-ear-plugin-test-project-094-parent + maven-ear-plugin-test-project-097-parent 99.0 eartest diff --git a/src/test/resources/projects/project-094/sar/src/main/resources/META-INF/jboss-service.xml b/src/test/resources/projects/project-097/sar/src/main/resources/META-INF/jboss-service.xml similarity index 100% rename from src/test/resources/projects/project-094/sar/src/main/resources/META-INF/jboss-service.xml rename to src/test/resources/projects/project-097/sar/src/main/resources/META-INF/jboss-service.xml diff --git a/src/test/resources/projects/project-094/war/pom.xml b/src/test/resources/projects/project-097/war/pom.xml similarity index 95% rename from src/test/resources/projects/project-094/war/pom.xml rename to src/test/resources/projects/project-097/war/pom.xml index 0c2eda85..969e2966 100644 --- a/src/test/resources/projects/project-094/war/pom.xml +++ b/src/test/resources/projects/project-097/war/pom.xml @@ -23,7 +23,7 @@ under the License. 4.0.0 ear - maven-ear-plugin-test-project-094-parent + maven-ear-plugin-test-project-097-parent 99.0 eartest diff --git a/src/test/resources/projects/project-094/war/src/main/webapp/WEB-INF/web.xml b/src/test/resources/projects/project-097/war/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from src/test/resources/projects/project-094/war/src/main/webapp/WEB-INF/web.xml rename to src/test/resources/projects/project-097/war/src/main/webapp/WEB-INF/web.xml From 27f6070318094efb983793ef393c7d7e81466c85 Mon Sep 17 00:00:00 2001 From: Marat Abrarov Date: Tue, 27 Oct 2020 04:11:16 +0300 Subject: [PATCH 8/9] [MEAR-216] - Fixed typo in comments for tests. --- .../java/org/apache/maven/plugins/ear/it/EarMojoIT.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java b/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java index 245d0de8..36392d50 100644 --- a/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java +++ b/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java @@ -287,7 +287,7 @@ public void testProject024() } /** - * Builds an EAR and make sure that a classified dependency with mutiple candidates is detected when specifying the + * Builds an EAR and make sure that a classified dependency with multiple candidates is detected when specifying the * classifier. */ public void testProject025() @@ -299,7 +299,7 @@ public void testProject025() } /** - * Builds an EAR and make sure that the build fails if a unclassifed module configuration with mutiple candidates is + * Builds an EAR and make sure that the build fails if a unclassifed module configuration with multiple candidates is * specified. */ public void testProject026() @@ -426,7 +426,7 @@ public void testProject037() } /** - * Builds an EAR and make sure that a non-classified dependency with mutiple candidates is detected when specifying + * Builds an EAR and make sure that a non-classified dependency with multiple candidates is detected when specifying * the mainArtifactId as classifier. */ public void testProject038() From 5c1d3e44851f10274dba83cd9627ef65ea9f32f8 Mon Sep 17 00:00:00 2001 From: Marat Abrarov Date: Thu, 29 Oct 2020 10:51:22 +0300 Subject: [PATCH 9/9] [MEAR-216] - Fixed usage of JBoss Packaging Maven Plugin in test. --- src/test/resources/projects/project-097/har/pom.xml | 9 --------- src/test/resources/projects/project-097/par/pom.xml | 9 --------- src/test/resources/projects/project-097/pom.xml | 7 +++++++ src/test/resources/projects/project-097/sar/pom.xml | 9 --------- 4 files changed, 7 insertions(+), 27 deletions(-) diff --git a/src/test/resources/projects/project-097/har/pom.xml b/src/test/resources/projects/project-097/har/pom.xml index f8cac414..f42449bf 100644 --- a/src/test/resources/projects/project-097/har/pom.xml +++ b/src/test/resources/projects/project-097/har/pom.xml @@ -30,13 +30,4 @@ under the License. har-sample-two 1.0 jboss-har - - - - org.codehaus.mojo - jboss-packaging-maven-plugin - true - - - diff --git a/src/test/resources/projects/project-097/par/pom.xml b/src/test/resources/projects/project-097/par/pom.xml index 99edf37d..ac58ba17 100644 --- a/src/test/resources/projects/project-097/par/pom.xml +++ b/src/test/resources/projects/project-097/par/pom.xml @@ -30,13 +30,4 @@ under the License. par-sample-one 1.0 jboss-par - - - - org.codehaus.mojo - jboss-packaging-maven-plugin - true - - - diff --git a/src/test/resources/projects/project-097/pom.xml b/src/test/resources/projects/project-097/pom.xml index 4933d4fe..4b0ee79c 100644 --- a/src/test/resources/projects/project-097/pom.xml +++ b/src/test/resources/projects/project-097/pom.xml @@ -79,5 +79,12 @@ under the License. + + + org.codehaus.mojo + jboss-packaging-maven-plugin + true + + diff --git a/src/test/resources/projects/project-097/sar/pom.xml b/src/test/resources/projects/project-097/sar/pom.xml index 1789f432..32d133b4 100644 --- a/src/test/resources/projects/project-097/sar/pom.xml +++ b/src/test/resources/projects/project-097/sar/pom.xml @@ -30,13 +30,4 @@ under the License. sar-sample-two 1.0 jboss-sar - - - - org.codehaus.mojo - jboss-packaging-maven-plugin - true - - -