Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
<mavenCompilerPluginVersion>2.5.1</mavenCompilerPluginVersion>
<mavenEjbPluginVersion>2.3</mavenEjbPluginVersion>
<mavenRarPluginVersion>2.4</mavenRarPluginVersion>
<mavenJarPluginVersion>3.2.0</mavenJarPluginVersion>
<jbossPackagingPluginVersion>2.2</jbossPackagingPluginVersion>
<invoker.skip>false</invoker.skip>
<invoker.install.skip>${invoker.skip}</invoker.install.skip>
Expand Down Expand Up @@ -290,6 +291,7 @@
<extraArtifact>org.apache.maven.plugins:maven-compiler-plugin:${mavenCompilerPluginVersion}:jar</extraArtifact>
<extraArtifact>org.apache.maven.plugins:maven-ejb-plugin:${mavenEjbPluginVersion}:jar</extraArtifact>
<extraArtifact>org.apache.maven.plugins:maven-rar-plugin:${mavenRarPluginVersion}:jar</extraArtifact>
<extraArtifact>org.apache.maven.plugins:maven-jar-plugin:${mavenJarPluginVersion}:jar</extraArtifact>
<extraArtifact>org.codehaus.mojo:jboss-packaging-maven-plugin:${jbossPackagingPluginVersion}:jar</extraArtifact>
</extraArtifacts>
<skipInstallation>${invoker.install.skip}</skipInstallation>
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/org/apache/maven/plugins/ear/AbstractEarModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public abstract class AbstractEarModule

private String artifactId;

protected String type;

private String classifier;

/**
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -202,6 +205,14 @@ public String getUri()
return uri;
}

/**
* {@inheritDoc}
*/
public String getType()
{
return type;
}

/**
* Returns the artifact's groupId.
*
Expand Down
119 changes: 0 additions & 119 deletions src/main/java/org/apache/maven/plugins/ear/AcrModule.java

This file was deleted.

13 changes: 5 additions & 8 deletions src/main/java/org/apache/maven/plugins/ear/AppClientModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand All @@ -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";
}
}
51 changes: 36 additions & 15 deletions src/main/java/org/apache/maven/plugins/ear/EarModuleFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> STANDARD_ARTIFACT_TYPE =
Collections.unmodifiableList( Arrays.asList( "jar", "ejb", "par", "ejb-client", "app-client", "rar", "war",
"sar", "wsr", "har" ) );
private static final List<String> 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
Expand Down Expand Up @@ -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 ) )
Expand All @@ -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 );
}
Expand All @@ -131,7 +152,7 @@ else if ( "har".equals( artifactType ) )
*/
public static List<String> getStandardArtifactTypes()
{
return STANDARD_ARTIFACT_TYPE;
return STANDARD_ARTIFACT_TYPES;
}

/**
Expand All @@ -142,7 +163,7 @@ public static List<String> getStandardArtifactTypes()
*/
public static boolean isStandardArtifactType( final String type )
{
return STANDARD_ARTIFACT_TYPE.contains( type );
return STANDARD_ARTIFACT_TYPES.contains( type );
}

}
4 changes: 2 additions & 2 deletions src/main/java/org/apache/maven/plugins/ear/EarMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -519,10 +519,10 @@ private List<String> 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 );
Expand Down
14 changes: 5 additions & 9 deletions src/main/java/org/apache/maven/plugins/ear/EjbClientModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand All @@ -46,12 +50,4 @@ public EjbClientModule( Artifact a, String defaultLibBundleDir )
{
super( a, defaultLibBundleDir, Boolean.FALSE );
}

/**
* {@inheritDoc}
*/
public String getType()
{
return "ejb-client";
}
}
14 changes: 6 additions & 8 deletions src/main/java/org/apache/maven/plugins/ear/EjbModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,19 @@
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";

/**
* Create an instance.
*/
public EjbModule()
{
this.type = DEFAULT_ARTIFACT_TYPE;
}

/**
Expand All @@ -61,12 +67,4 @@ public void appendModule( XMLWriter writer, String version, Boolean generateId )

writer.endElement();
}

/**
* {@inheritDoc}
*/
public String getType()
{
return EJB_MODULE;
}
}
Loading