diff --git a/pom.xml b/pom.xml index 8607f9c4..1c162737 100644 --- a/pom.xml +++ b/pom.xml @@ -90,6 +90,7 @@ 2.5.1 2.3 2.4 + 3.2.0 2.2 false ${invoker.skip} @@ -290,6 +291,7 @@ org.apache.maven.plugins:maven-compiler-plugin:${mavenCompilerPluginVersion}:jar org.apache.maven.plugins:maven-ejb-plugin:${mavenEjbPluginVersion}:jar org.apache.maven.plugins:maven-rar-plugin:${mavenRarPluginVersion}:jar + org.apache.maven.plugins:maven-jar-plugin:${mavenJarPluginVersion}:jar org.codehaus.mojo:jboss-packaging-maven-plugin:${jbossPackagingPluginVersion}:jar ${invoker.install.skip} 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 2af06fb0..bb647443 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; /** @@ -123,6 +125,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; } @@ -202,6 +205,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..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,12 +30,17 @@ public class AppClientModule extends AbstractEarModule { + /** + * Default type of the artifact of an application client module. + */ + public static final String DEFAULT_ARTIFACT_TYPE = "app-client"; /** * Create an instance. */ public AppClientModule() { + this.type = DEFAULT_ARTIFACT_TYPE; } /** @@ -60,12 +65,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/EarModuleFactory.java b/src/main/java/org/apache/maven/plugins/ear/EarModuleFactory.java index 161e6bc6..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,12 +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" ) ); + 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 @@ -70,19 +88,20 @@ public static EarModule newEarModule( Artifact artifact, JavaEEVersion javaEEVer throw new UnknownArtifactTypeException( e.getMessage() + " for " + artifact.getArtifactId() ); } - if ( "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 ) ) + 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 ) ) @@ -94,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 ) ) + 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 ) ) + else if ( HarModule.DEFAULT_ARTIFACT_TYPE.equals( artifactType ) + || JBOSS_HAR_ARTIFACT_TYPE.equals( artifactType ) ) { return new HarModule( artifact ); } @@ -131,7 +152,7 @@ else if ( "har".equals( artifactType ) ) */ public static List getStandardArtifactTypes() { - return STANDARD_ARTIFACT_TYPE; + return STANDARD_ARTIFACT_TYPES; } /** @@ -142,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 258a1cc8..9da7e0e1 100644 --- a/src/main/java/org/apache/maven/plugins/ear/EarMojo.java +++ b/src/main/java/org/apache/maven/plugins/ear/EarMojo.java @@ -519,10 +519,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 186f893b..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,13 +29,17 @@ public class EjbClientModule extends JarModule { + /** + * Default type of the artifact of an ejb client module. + */ + public static final String DEFAULT_ARTIFACT_TYPE = "ejb-client"; /** * Create an instance. */ public EjbClientModule() { - super(); + this.type = DEFAULT_ARTIFACT_TYPE; } /** @@ -46,12 +50,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..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,6 +30,11 @@ public class EjbModule extends AbstractEarModule { + /** + * Default type of the artifact of an EJB module. + */ + public static final String DEFAULT_ARTIFACT_TYPE = "ejb"; + private static final String EJB_MODULE = "ejb"; /** @@ -37,6 +42,7 @@ public class EjbModule */ public EjbModule() { + this.type = DEFAULT_ARTIFACT_TYPE; } /** @@ -61,12 +67,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 0124e541..1d2198d2 100644 --- a/src/main/java/org/apache/maven/plugins/ear/HarModule.java +++ b/src/main/java/org/apache/maven/plugins/ear/HarModule.java @@ -31,6 +31,11 @@ public class HarModule extends AbstractEarModule implements JbossEarModule { + /** + * Default type of the artifact of a JBoss Hibernate archive. + */ + public static final String DEFAULT_ARTIFACT_TYPE = "har"; + private static final String DEFAULT_LIB_DIRECTORY = "lib"; /** @@ -38,6 +43,7 @@ public class HarModule */ public HarModule() { + this.type = DEFAULT_ARTIFACT_TYPE; this.libDirectory = DEFAULT_LIB_DIRECTORY; } @@ -71,12 +77,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..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,6 +38,11 @@ public class JarModule extends AbstractEarModule { + /** + * 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; /** @@ -45,7 +50,7 @@ public class JarModule */ public JarModule() { - super(); + this.type = DEFAULT_ARTIFACT_TYPE; } /** @@ -95,14 +100,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..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,13 +29,17 @@ public class ParModule extends EjbModule { + /** + * Default type of the artifact of a Par module. + */ + public static final String DEFAULT_ARTIFACT_TYPE = "par"; /** * Create an instance. */ public ParModule() { - super(); + this.type = DEFAULT_ARTIFACT_TYPE; } /** @@ -45,12 +49,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 6083eb79..0b3ec8bc 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,11 @@ public class RarModule extends AbstractEarModule { + /** + * 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"; private static final String DEFAULT_LIB_DIRECTORY = "/"; @@ -39,6 +44,7 @@ public class RarModule */ public RarModule() { + this.type = DEFAULT_ARTIFACT_TYPE; this.libDirectory = DEFAULT_LIB_DIRECTORY; } @@ -65,12 +71,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 b18566ef..deb99443 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,11 @@ public class SarModule extends AbstractEarModule implements JbossEarModule { + /** + * 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"; private static final String DEFAULT_LIB_DIRECTORY = "lib"; @@ -46,6 +51,7 @@ public class SarModule */ public SarModule() { + this.type = DEFAULT_ARTIFACT_TYPE; this.libDirectory = DEFAULT_LIB_DIRECTORY; } @@ -85,12 +91,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 f8aada7d..89f1ae2b 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,11 @@ public class WebModule extends AbstractEarModule { + /** + * 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"; private static final String WEB_URI_FIELD = "web-uri"; @@ -48,6 +53,7 @@ public class WebModule */ public WebModule() { + this.type = DEFAULT_ARTIFACT_TYPE; this.libDirectory = DEFAULT_LIB_DIRECTORY; } @@ -111,14 +117,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..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,11 +29,17 @@ public class WsrModule extends RarModule { + /** + * Default type of the artifact of a JBoss wsr module. + */ + public static final String DEFAULT_ARTIFACT_TYPE = "wsr"; + /** * Create an instance. */ public WsrModule() { + this.type = DEFAULT_ARTIFACT_TYPE; } /** @@ -43,12 +49,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 5d722a0c..e0f8362d 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. @@ -145,16 +146,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. @@ -183,16 +185,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. @@ -222,16 +225,19 @@ 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'. 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 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. @@ -260,16 +266,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. @@ -301,16 +308,19 @@ 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'. 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 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. @@ -338,16 +348,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. @@ -385,16 +396,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. @@ -425,16 +437,19 @@ 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'. 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 + 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. @@ -460,16 +475,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 1d672397..678c3535 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() @@ -1159,4 +1159,61 @@ public void testProject094() { rarModuleLibDir + jarSampleOneLibrary, rarModuleLibDir + jarSampleTwoLibrary, rarModuleLibDir + jarSampleThreeLibrary } } , null ); } + + /** + * 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 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-095", "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 ); + } + + /** + * Ensures that test JAR dependency representing Java module is described in deployment descriptor + * if includeInApplicationXml property of module is {@code true}. + */ + public void testProject096() + 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-096", "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 ); + } + + /** + * 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 testProject097() + 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-097", "ear", artifacts, artifactsDirectory, null, null, null , true ); + } } diff --git a/src/test/resources/projects/project-095/ear/expected-META-INF/application.xml b/src/test/resources/projects/project-095/ear/expected-META-INF/application.xml new file mode 100644 index 00000000..46efdd0a --- /dev/null +++ b/src/test/resources/projects/project-095/ear/expected-META-INF/application.xml @@ -0,0 +1,29 @@ + + + + maven-ear-plugin-test-project-095 + + + eartest-war-sample-two-1.0.war + /war-sample-two + + + lib + diff --git a/src/test/resources/projects/project-095/ear/pom.xml b/src/test/resources/projects/project-095/ear/pom.xml new file mode 100644 index 00000000..37b9e9a8 --- /dev/null +++ b/src/test/resources/projects/project-095/ear/pom.xml @@ -0,0 +1,57 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-095-parent + 99.0 + + maven-ear-plugin-test-project-095 + 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-095/jar/pom.xml b/src/test/resources/projects/project-095/jar/pom.xml new file mode 100644 index 00000000..3796ce52 --- /dev/null +++ b/src/test/resources/projects/project-095/jar/pom.xml @@ -0,0 +1,54 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-095-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-095/pom.xml b/src/test/resources/projects/project-095/pom.xml new file mode 100644 index 00000000..9d2f2472 --- /dev/null +++ b/src/test/resources/projects/project-095/pom.xml @@ -0,0 +1,77 @@ + + + + + 4.0.0 + ear + maven-ear-plugin-test-project-095-parent + 99.0 + pom + + jar + war + ear + + + + + eartest + jar-sample-three-with-deps + 1.0 + + + eartest + jar-sample-four + 1.0 + tests + 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-095/war/pom.xml b/src/test/resources/projects/project-095/war/pom.xml new file mode 100644 index 00000000..a0549e7c --- /dev/null +++ b/src/test/resources/projects/project-095/war/pom.xml @@ -0,0 +1,41 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-095-parent + 99.0 + + eartest + war-sample-two + 1.0 + war + + + eartest + jar-sample-four + tests + test-jar + + + diff --git a/src/test/resources/projects/project-095/war/src/main/webapp/WEB-INF/web.xml b/src/test/resources/projects/project-095/war/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..fbbf3070 --- /dev/null +++ b/src/test/resources/projects/project-095/war/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + diff --git a/src/test/resources/projects/project-096/ear/expected-META-INF/application.xml b/src/test/resources/projects/project-096/ear/expected-META-INF/application.xml new file mode 100644 index 00000000..96a5d413 --- /dev/null +++ b/src/test/resources/projects/project-096/ear/expected-META-INF/application.xml @@ -0,0 +1,34 @@ + + + + maven-ear-plugin-test-project-096 + + 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-096/ear/pom.xml b/src/test/resources/projects/project-096/ear/pom.xml new file mode 100644 index 00000000..9cacc91b --- /dev/null +++ b/src/test/resources/projects/project-096/ear/pom.xml @@ -0,0 +1,69 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-096-parent + 99.0 + + maven-ear-plugin-test-project-096 + 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-096/jar-five/pom.xml b/src/test/resources/projects/project-096/jar-five/pom.xml new file mode 100644 index 00000000..7e0b335f --- /dev/null +++ b/src/test/resources/projects/project-096/jar-five/pom.xml @@ -0,0 +1,38 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-096-parent + 99.0 + + eartest + jar-sample-five + 1.0 + + + eartest + jar-sample-three-with-deps + + + diff --git a/src/test/resources/projects/project-096/jar-four/pom.xml b/src/test/resources/projects/project-096/jar-four/pom.xml new file mode 100644 index 00000000..06326363 --- /dev/null +++ b/src/test/resources/projects/project-096/jar-four/pom.xml @@ -0,0 +1,54 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-096-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-096/pom.xml b/src/test/resources/projects/project-096/pom.xml new file mode 100644 index 00000000..f35c27c6 --- /dev/null +++ b/src/test/resources/projects/project-096/pom.xml @@ -0,0 +1,84 @@ + + + + + 4.0.0 + ear + maven-ear-plugin-test-project-096-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-096/war/pom.xml b/src/test/resources/projects/project-096/war/pom.xml new file mode 100644 index 00000000..33547e7f --- /dev/null +++ b/src/test/resources/projects/project-096/war/pom.xml @@ -0,0 +1,46 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-096-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-096/war/src/main/webapp/WEB-INF/web.xml b/src/test/resources/projects/project-096/war/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..fbbf3070 --- /dev/null +++ b/src/test/resources/projects/project-096/war/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + diff --git a/src/test/resources/projects/project-097/ear/expected-META-INF/application.xml b/src/test/resources/projects/project-097/ear/expected-META-INF/application.xml new file mode 100644 index 00000000..3382f5a3 --- /dev/null +++ b/src/test/resources/projects/project-097/ear/expected-META-INF/application.xml @@ -0,0 +1,31 @@ + + + + maven-ear-plugin-test-project-097 + + + 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-097/ear/expected-META-INF/jboss-app.xml b/src/test/resources/projects/project-097/ear/expected-META-INF/jboss-app.xml new file mode 100644 index 00000000..dc9962aa --- /dev/null +++ b/src/test/resources/projects/project-097/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-097/ear/pom.xml b/src/test/resources/projects/project-097/ear/pom.xml new file mode 100644 index 00000000..090ff2e8 --- /dev/null +++ b/src/test/resources/projects/project-097/ear/pom.xml @@ -0,0 +1,83 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-097-parent + 99.0 + + maven-ear-plugin-test-project-097 + 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-097/har/pom.xml b/src/test/resources/projects/project-097/har/pom.xml new file mode 100644 index 00000000..f42449bf --- /dev/null +++ b/src/test/resources/projects/project-097/har/pom.xml @@ -0,0 +1,33 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-097-parent + 99.0 + + eartest + har-sample-two + 1.0 + jboss-har + diff --git a/src/test/resources/projects/project-097/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 new file mode 100644 index 00000000..53163284 --- /dev/null +++ b/src/test/resources/projects/project-097/har/src/main/resources/META-INF/jboss-service.xml @@ -0,0 +1,21 @@ + + + + diff --git a/src/test/resources/projects/project-097/par/pom.xml b/src/test/resources/projects/project-097/par/pom.xml new file mode 100644 index 00000000..ac58ba17 --- /dev/null +++ b/src/test/resources/projects/project-097/par/pom.xml @@ -0,0 +1,33 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-097-parent + 99.0 + + eartest + par-sample-one + 1.0 + jboss-par + diff --git a/src/test/resources/projects/project-097/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 new file mode 100644 index 00000000..44d6f135 --- /dev/null +++ b/src/test/resources/projects/project-097/par/src/main/jpdl/par-sample-one/processdefinition.xml @@ -0,0 +1,22 @@ + + + + + diff --git a/src/test/resources/projects/project-097/pom.xml b/src/test/resources/projects/project-097/pom.xml new file mode 100644 index 00000000..4b0ee79c --- /dev/null +++ b/src/test/resources/projects/project-097/pom.xml @@ -0,0 +1,90 @@ + + + + + 4.0.0 + ear + maven-ear-plugin-test-project-097-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@ + + + + + + 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 new file mode 100644 index 00000000..32d133b4 --- /dev/null +++ b/src/test/resources/projects/project-097/sar/pom.xml @@ -0,0 +1,33 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-097-parent + 99.0 + + eartest + sar-sample-two + 1.0 + jboss-sar + diff --git a/src/test/resources/projects/project-097/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 new file mode 100644 index 00000000..53163284 --- /dev/null +++ b/src/test/resources/projects/project-097/sar/src/main/resources/META-INF/jboss-service.xml @@ -0,0 +1,21 @@ + + + + diff --git a/src/test/resources/projects/project-097/war/pom.xml b/src/test/resources/projects/project-097/war/pom.xml new file mode 100644 index 00000000..969e2966 --- /dev/null +++ b/src/test/resources/projects/project-097/war/pom.xml @@ -0,0 +1,33 @@ + + + + + 4.0.0 + + ear + maven-ear-plugin-test-project-097-parent + 99.0 + + eartest + war-sample-three + 1.0 + war + diff --git a/src/test/resources/projects/project-097/war/src/main/webapp/WEB-INF/web.xml b/src/test/resources/projects/project-097/war/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..fbbf3070 --- /dev/null +++ b/src/test/resources/projects/project-097/war/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + +