[MEAR-241] Change package to o.a.m.plugins

git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1755643 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/maven/plugin/ear/AbstractEarModule.java b/src/main/java/org/apache/maven/plugins/ear/AbstractEarModule.java
similarity index 97%
rename from src/main/java/org/apache/maven/plugin/ear/AbstractEarModule.java
rename to src/main/java/org/apache/maven/plugins/ear/AbstractEarModule.java
index 24a5f6e..9dd39da 100644
--- a/src/main/java/org/apache/maven/plugin/ear/AbstractEarModule.java
+++ b/src/main/java/org/apache/maven/plugins/ear/AbstractEarModule.java
@@ -1,436 +1,436 @@
-package org.apache.maven.plugin.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 java.util.Set;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.ear.output.FileNameMappingFactory;
-import org.apache.maven.plugin.ear.util.ArtifactRepository;
-import org.codehaus.plexus.util.xml.XMLWriter;
-
-/**
- * A base implementation of an {@link EarModule}.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public abstract class AbstractEarModule
-    implements EarModule
-{
-
-    /**
-     * The module element.
-     */
-    protected static final String MODULE_ELEMENT = "module";
-
-    /**
-     * The java module.
-     */
-    protected static final String JAVA_MODULE = "java";
-
-    /**
-     * The alt-dd module.
-     */
-    protected static final String ALT_DD = "alt-dd";
-
-    private Artifact artifact;
-
-    // Those are set by the configuration
-
-    private String groupId;
-
-    private String artifactId;
-
-    private String classifier;
-
-    /**
-     * The bundleDir.
-     */
-    protected String bundleDir;
-
-    /**
-     * The bundleFileName.
-     */
-    protected String bundleFileName;
-
-    /**
-     * excluded by default {@code false}.
-     */
-    protected Boolean excluded = Boolean.FALSE;
-
-    private String uri;
-
-    /**
-     * unpack
-     */
-    protected Boolean unpack = null;
-
-    /**
-     * The alternate deployment descriptor.
-     */
-    protected String altDeploymentDescriptor;
-
-    private String moduleId;
-
-    // This is injected once the module has been built.
-
-    /**
-     * The {@link EarExecutionContext}
-     */
-    protected EarExecutionContext earExecutionContext;
-
-    /**
-     * Empty constructor to be used when the module is built based on the configuration.
-     */
-    public AbstractEarModule()
-    {
-    }
-
-    /**
-     * Creates an ear module from the artifact.
-     * 
-     * @param a the artifact
-     */
-    public AbstractEarModule( Artifact a )
-    {
-        this.artifact = a;
-        this.groupId = a.getGroupId();
-        this.artifactId = a.getArtifactId();
-        this.classifier = a.getClassifier();
-        this.bundleDir = null;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setEarExecutionContext( EarExecutionContext earExecutionContext )
-    {
-        this.earExecutionContext = earExecutionContext;
-    }
-
-    /** {@inheritDoc} */
-    public void resolveArtifact( Set<Artifact> artifacts )
-        throws EarPluginException, MojoFailureException
-    {
-        // If the artifact is already set no need to resolve it
-        if ( artifact == null )
-        {
-            // Make sure that at least the groupId and the artifactId are specified
-            if ( groupId == null || artifactId == null )
-            {
-                throw new MojoFailureException( "Could not resolve artifact[" + groupId + ":" + artifactId + ":"
-                    + getType() + "]" );
-            }
-            final ArtifactRepository ar = earExecutionContext.getArtifactRepository();
-            artifact = ar.getUniqueArtifact( groupId, artifactId, getType(), classifier );
-            // Artifact has not been found
-            if ( artifact == null )
-            {
-                Set<Artifact> candidates = ar.getArtifacts( groupId, artifactId, getType() );
-                if ( candidates.size() > 1 )
-                {
-                    throw new MojoFailureException( "Artifact[" + this + "] has " + candidates.size()
-                        + " candidates, please provide a classifier." );
-                }
-                else
-                {
-                    throw new MojoFailureException( "Artifact[" + this + "] is not a dependency of the project." );
-                }
-            }
-        }
-    }
-
-    /**
-     * @return {@link #artifact}
-     */
-    public Artifact getArtifact()
-    {
-        return artifact;
-    }
-
-    /**
-     * @return {@link #moduleId}
-     */
-    public String getModuleId()
-    {
-        return moduleId;
-    }
-
-    /**
-     * @return Return the URI.
-     */
-    public String getUri()
-    {
-        if ( uri == null )
-        {
-            if ( getBundleDir() == null )
-            {
-                uri = getBundleFileName();
-            }
-            else
-            {
-                uri = getBundleDir() + getBundleFileName();
-            }
-        }
-        return uri;
-    }
-
-    /**
-     * Returns the artifact's groupId.
-     * 
-     * @return {@link #groupId}
-     */
-    public String getGroupId()
-    {
-        return groupId;
-    }
-
-    /**
-     * Returns the artifact's Id.
-     * 
-     * @return {@link #artifactId}
-     */
-    public String getArtifactId()
-    {
-        return artifactId;
-    }
-
-    /**
-     * Returns the artifact's classifier.
-     * 
-     * @return the artifact classifier
-     */
-    public String getClassifier()
-    {
-        return classifier;
-    }
-
-    /**
-     * Returns the bundle directory. If null, the module is bundled in the root of the EAR.
-     * 
-     * @return the custom bundle directory
-     */
-    public String getBundleDir()
-    {
-        if ( bundleDir != null )
-        {
-            bundleDir = cleanBundleDir( bundleDir );
-        }
-        return bundleDir;
-    }
-
-    /**
-     * Returns the bundle file name. If null, the artifact's file name is returned.
-     * 
-     * @return the bundle file name
-     */
-    public String getBundleFileName()
-    {
-        if ( bundleFileName == null )
-        {
-            bundleFileName = earExecutionContext.getFileNameMapping().mapFileName( artifact );
-        }
-        return bundleFileName;
-    }
-
-    /**
-     * Based on MEAR-189 we need to get back
-     * the original file name under any circumstances.
-     * 
-     * @return The original file name.
-     */
-    public String getOriginalBundleFileName()
-    {
-        return FileNameMappingFactory.getDefaultFileNameMapping().mapFileName( artifact );
-    }
-
-    /**
-     * The alt-dd element specifies an optional URI to the post-assembly version of the deployment descriptor file for a
-     * particular Java EE module. The URI must specify the full pathname of the deployment descriptor file relative to
-     * the application's root directory.
-     * 
-     * @return the alternative deployment descriptor for this module
-     */
-    public String getAltDeploymentDescriptor()
-    {
-        return altDeploymentDescriptor;
-    }
-
-    /**
-     * Specify whether this module should be excluded or not.
-     * 
-     * @return true if this module should be skipped, false otherwise
-     */
-    public boolean isExcluded()
-    {
-        return excluded;
-    }
-
-    /**
-     * @return {@link #unpack}
-     */
-    public Boolean shouldUnpack()
-    {
-        return unpack;
-    }
-
-    /**
-     * Writes the alternative deployment descriptor if necessary.
-     * 
-     * @param writer the writer to use
-     * @param version the java EE version in use
-     */
-    protected void writeAltDeploymentDescriptor( XMLWriter writer, String version )
-    {
-        if ( getAltDeploymentDescriptor() != null )
-        {
-            writer.startElement( ALT_DD );
-            writer.writeText( getAltDeploymentDescriptor() );
-            writer.endElement();
-        }
-    }
-
-    /**
-     * Starts a new {@link #MODULE_ELEMENT} on the specified writer, possibly including an id attribute.
-     * 
-     * @param writer the XML writer.
-     * @param generateId whether an id should be generated
-     */
-    protected void startModuleElement( XMLWriter writer, Boolean generateId )
-    {
-        writer.startElement( MODULE_ELEMENT );
-
-        // If a moduleId is specified, always include it
-        if ( getModuleId() != null )
-        {
-            writer.addAttribute( "id", getModuleId() );
-        }
-        else if ( generateId )
-        {
-            // No module id was specified but one should be generated.
-            Artifact theArtifact = getArtifact();
-            String generatedId =
-                theArtifact.getType().toUpperCase() + "_" + theArtifact.getGroupId() + "."
-                    + theArtifact.getArtifactId();
-            if ( null != theArtifact.getClassifier() && theArtifact.getClassifier().trim().length() > 0 )
-            {
-                generatedId += "-" + theArtifact.getClassifier().trim();
-            }
-            writer.addAttribute( "id", generatedId );
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String toString()
-    {
-        StringBuilder sb = new StringBuilder();
-        sb.append( getType() ).append( ":" ).append( groupId ).append( ":" ).append( artifactId );
-        if ( classifier != null )
-        {
-            sb.append( ":" ).append( classifier );
-        }
-        if ( artifact != null )
-        {
-            sb.append( ":" ).append( artifact.getVersion() );
-        }
-        return sb.toString();
-    }
-
-    /**
-     * Cleans the bundle directory so that it might be used properly.
-     * 
-     * @param bundleDir the bundle directory to clean
-     * @return the cleaned bundle directory
-     */
-    static String cleanBundleDir( String bundleDir )
-    {
-        if ( bundleDir == null )
-        {
-            return null;
-        }
-
-        // Using slashes
-        bundleDir = bundleDir.replace( '\\', '/' );
-
-        // Remove '/' prefix if any so that directory is a relative path
-        if ( bundleDir.startsWith( "/" ) )
-        {
-            bundleDir = bundleDir.substring( 1, bundleDir.length() );
-        }
-
-        if ( bundleDir.length() > 0 && !bundleDir.endsWith( "/" ) )
-        {
-            // Adding '/' suffix to specify a directory structure if it is not empty
-            bundleDir = bundleDir + "/";
-        }
-
-        return bundleDir;
-    }
-
-    /**
-     * Specify if the objects are both null or both equal.
-     * 
-     * @param first the first object
-     * @param second the second object
-     * @return true if parameters are either both null or equal
-     */
-    static boolean areNullOrEqual( Object first, Object second )
-    {
-        if ( first != null )
-        {
-            return first.equals( second );
-        }
-        else
-        {
-            return second == null;
-        }
-    }
-
-    /**
-     * Sets the URI of the module explicitly for testing purposes.
-     * 
-     * @param uri the uri
-     */
-    void setUri( String uri )
-    {
-        this.uri = uri;
-
-    }
-
-    /**
-     * @return always {@code true}
-     */
-    public boolean changeManifestClasspath()
-    {
-        return true;
-    }
-
-    /**
-     * @return always {@code null}
-     */
-    public String getLibDir()
-    {
-        return null;
-    }
-}
+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 java.util.Set;

+

+import org.apache.maven.artifact.Artifact;

+import org.apache.maven.plugin.MojoFailureException;

+import org.apache.maven.plugins.ear.output.FileNameMappingFactory;

+import org.apache.maven.plugins.ear.util.ArtifactRepository;

+import org.codehaus.plexus.util.xml.XMLWriter;

+

+/**

+ * A base implementation of an {@link EarModule}.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: AbstractEarModule.java 1645331 2014-12-13 17:31:09Z khmarbaise $

+ */

+public abstract class AbstractEarModule

+    implements EarModule

+{

+

+    /**

+     * The module element.

+     */

+    protected static final String MODULE_ELEMENT = "module";

+

+    /**

+     * The java module.

+     */

+    protected static final String JAVA_MODULE = "java";

+

+    /**

+     * The alt-dd module.

+     */

+    protected static final String ALT_DD = "alt-dd";

+

+    private Artifact artifact;

+

+    // Those are set by the configuration

+

+    private String groupId;

+

+    private String artifactId;

+

+    private String classifier;

+

+    /**

+     * The bundleDir.

+     */

+    protected String bundleDir;

+

+    /**

+     * The bundleFileName.

+     */

+    protected String bundleFileName;

+

+    /**

+     * excluded by default {@code false}.

+     */

+    protected Boolean excluded = Boolean.FALSE;

+

+    private String uri;

+

+    /**

+     * unpack

+     */

+    protected Boolean unpack = null;

+

+    /**

+     * The alternate deployment descriptor.

+     */

+    protected String altDeploymentDescriptor;

+

+    private String moduleId;

+

+    // This is injected once the module has been built.

+

+    /**

+     * The {@link EarExecutionContext}

+     */

+    protected EarExecutionContext earExecutionContext;

+

+    /**

+     * Empty constructor to be used when the module is built based on the configuration.

+     */

+    public AbstractEarModule()

+    {

+    }

+

+    /**

+     * Creates an ear module from the artifact.

+     * 

+     * @param a the artifact

+     */

+    public AbstractEarModule( Artifact a )

+    {

+        this.artifact = a;

+        this.groupId = a.getGroupId();

+        this.artifactId = a.getArtifactId();

+        this.classifier = a.getClassifier();

+        this.bundleDir = null;

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public void setEarExecutionContext( EarExecutionContext earExecutionContext )

+    {

+        this.earExecutionContext = earExecutionContext;

+    }

+

+    /** {@inheritDoc} */

+    public void resolveArtifact( Set<Artifact> artifacts )

+        throws EarPluginException, MojoFailureException

+    {

+        // If the artifact is already set no need to resolve it

+        if ( artifact == null )

+        {

+            // Make sure that at least the groupId and the artifactId are specified

+            if ( groupId == null || artifactId == null )

+            {

+                throw new MojoFailureException( "Could not resolve artifact[" + groupId + ":" + artifactId + ":"

+                    + getType() + "]" );

+            }

+            final ArtifactRepository ar = earExecutionContext.getArtifactRepository();

+            artifact = ar.getUniqueArtifact( groupId, artifactId, getType(), classifier );

+            // Artifact has not been found

+            if ( artifact == null )

+            {

+                Set<Artifact> candidates = ar.getArtifacts( groupId, artifactId, getType() );

+                if ( candidates.size() > 1 )

+                {

+                    throw new MojoFailureException( "Artifact[" + this + "] has " + candidates.size()

+                        + " candidates, please provide a classifier." );

+                }

+                else

+                {

+                    throw new MojoFailureException( "Artifact[" + this + "] is not a dependency of the project." );

+                }

+            }

+        }

+    }

+

+    /**

+     * @return {@link #artifact}

+     */

+    public Artifact getArtifact()

+    {

+        return artifact;

+    }

+

+    /**

+     * @return {@link #moduleId}

+     */

+    public String getModuleId()

+    {

+        return moduleId;

+    }

+

+    /**

+     * @return Return the URI.

+     */

+    public String getUri()

+    {

+        if ( uri == null )

+        {

+            if ( getBundleDir() == null )

+            {

+                uri = getBundleFileName();

+            }

+            else

+            {

+                uri = getBundleDir() + getBundleFileName();

+            }

+        }

+        return uri;

+    }

+

+    /**

+     * Returns the artifact's groupId.

+     * 

+     * @return {@link #groupId}

+     */

+    public String getGroupId()

+    {

+        return groupId;

+    }

+

+    /**

+     * Returns the artifact's Id.

+     * 

+     * @return {@link #artifactId}

+     */

+    public String getArtifactId()

+    {

+        return artifactId;

+    }

+

+    /**

+     * Returns the artifact's classifier.

+     * 

+     * @return the artifact classifier

+     */

+    public String getClassifier()

+    {

+        return classifier;

+    }

+

+    /**

+     * Returns the bundle directory. If null, the module is bundled in the root of the EAR.

+     * 

+     * @return the custom bundle directory

+     */

+    public String getBundleDir()

+    {

+        if ( bundleDir != null )

+        {

+            bundleDir = cleanBundleDir( bundleDir );

+        }

+        return bundleDir;

+    }

+

+    /**

+     * Returns the bundle file name. If null, the artifact's file name is returned.

+     * 

+     * @return the bundle file name

+     */

+    public String getBundleFileName()

+    {

+        if ( bundleFileName == null )

+        {

+            bundleFileName = earExecutionContext.getFileNameMapping().mapFileName( artifact );

+        }

+        return bundleFileName;

+    }

+

+    /**

+     * Based on MEAR-189 we need to get back

+     * the original file name under any circumstances.

+     * 

+     * @return The original file name.

+     */

+    public String getOriginalBundleFileName()

+    {

+        return FileNameMappingFactory.getDefaultFileNameMapping().mapFileName( artifact );

+    }

+

+    /**

+     * The alt-dd element specifies an optional URI to the post-assembly version of the deployment descriptor file for a

+     * particular Java EE module. The URI must specify the full pathname of the deployment descriptor file relative to

+     * the application's root directory.

+     * 

+     * @return the alternative deployment descriptor for this module

+     */

+    public String getAltDeploymentDescriptor()

+    {

+        return altDeploymentDescriptor;

+    }

+

+    /**

+     * Specify whether this module should be excluded or not.

+     * 

+     * @return true if this module should be skipped, false otherwise

+     */

+    public boolean isExcluded()

+    {

+        return excluded;

+    }

+

+    /**

+     * @return {@link #unpack}

+     */

+    public Boolean shouldUnpack()

+    {

+        return unpack;

+    }

+

+    /**

+     * Writes the alternative deployment descriptor if necessary.

+     * 

+     * @param writer the writer to use

+     * @param version the java EE version in use

+     */

+    protected void writeAltDeploymentDescriptor( XMLWriter writer, String version )

+    {

+        if ( getAltDeploymentDescriptor() != null )

+        {

+            writer.startElement( ALT_DD );

+            writer.writeText( getAltDeploymentDescriptor() );

+            writer.endElement();

+        }

+    }

+

+    /**

+     * Starts a new {@link #MODULE_ELEMENT} on the specified writer, possibly including an id attribute.

+     * 

+     * @param writer the XML writer.

+     * @param generateId whether an id should be generated

+     */

+    protected void startModuleElement( XMLWriter writer, Boolean generateId )

+    {

+        writer.startElement( MODULE_ELEMENT );

+

+        // If a moduleId is specified, always include it

+        if ( getModuleId() != null )

+        {

+            writer.addAttribute( "id", getModuleId() );

+        }

+        else if ( generateId )

+        {

+            // No module id was specified but one should be generated.

+            Artifact theArtifact = getArtifact();

+            String generatedId =

+                theArtifact.getType().toUpperCase() + "_" + theArtifact.getGroupId() + "."

+                    + theArtifact.getArtifactId();

+            if ( null != theArtifact.getClassifier() && theArtifact.getClassifier().trim().length() > 0 )

+            {

+                generatedId += "-" + theArtifact.getClassifier().trim();

+            }

+            writer.addAttribute( "id", generatedId );

+        }

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public String toString()

+    {

+        StringBuilder sb = new StringBuilder();

+        sb.append( getType() ).append( ":" ).append( groupId ).append( ":" ).append( artifactId );

+        if ( classifier != null )

+        {

+            sb.append( ":" ).append( classifier );

+        }

+        if ( artifact != null )

+        {

+            sb.append( ":" ).append( artifact.getVersion() );

+        }

+        return sb.toString();

+    }

+

+    /**

+     * Cleans the bundle directory so that it might be used properly.

+     * 

+     * @param bundleDir the bundle directory to clean

+     * @return the cleaned bundle directory

+     */

+    static String cleanBundleDir( String bundleDir )

+    {

+        if ( bundleDir == null )

+        {

+            return null;

+        }

+

+        // Using slashes

+        bundleDir = bundleDir.replace( '\\', '/' );

+

+        // Remove '/' prefix if any so that directory is a relative path

+        if ( bundleDir.startsWith( "/" ) )

+        {

+            bundleDir = bundleDir.substring( 1, bundleDir.length() );

+        }

+

+        if ( bundleDir.length() > 0 && !bundleDir.endsWith( "/" ) )

+        {

+            // Adding '/' suffix to specify a directory structure if it is not empty

+            bundleDir = bundleDir + "/";

+        }

+

+        return bundleDir;

+    }

+

+    /**

+     * Specify if the objects are both null or both equal.

+     * 

+     * @param first the first object

+     * @param second the second object

+     * @return true if parameters are either both null or equal

+     */

+    static boolean areNullOrEqual( Object first, Object second )

+    {

+        if ( first != null )

+        {

+            return first.equals( second );

+        }

+        else

+        {

+            return second == null;

+        }

+    }

+

+    /**

+     * Sets the URI of the module explicitly for testing purposes.

+     * 

+     * @param uri the uri

+     */

+    void setUri( String uri )

+    {

+        this.uri = uri;

+

+    }

+

+    /**

+     * @return always {@code true}

+     */

+    public boolean changeManifestClasspath()

+    {

+        return true;

+    }

+

+    /**

+     * @return always {@code null}

+     */

+    public String getLibDir()

+    {

+        return null;

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java b/src/main/java/org/apache/maven/plugins/ear/AbstractEarMojo.java
similarity index 97%
rename from src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java
rename to src/main/java/org/apache/maven/plugins/ear/AbstractEarMojo.java
index f22a8d0..de2b9e3 100644
--- a/src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/ear/AbstractEarMojo.java
@@ -1,390 +1,390 @@
-package org.apache.maven.plugin.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 java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.ear.util.ArtifactTypeMappingService;
-import org.apache.maven.plugin.ear.util.JavaEEVersion;
-import org.apache.maven.plugins.annotations.Component;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.shared.filtering.MavenResourcesFiltering;
-import org.codehaus.plexus.configuration.PlexusConfiguration;
-import org.codehaus.plexus.configuration.PlexusConfigurationException;
-
-/**
- * A base class for EAR-processing related tasks.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public abstract class AbstractEarMojo
-    extends AbstractMojo
-{
-    /**
-     * The application XML URI {@code META-INF/application.xml}
-     */
-    public static final String APPLICATION_XML_URI = "META-INF/application.xml";
-
-    /**
-     * The {@code META-INF} folder.
-     */
-    public static final String META_INF = "META-INF";
-
-    /**
-     * UTF-8 encoding constant.
-     */
-    public static final String UTF_8 = "UTF-8";
-
-    /**
-     * The version of the application.xml to generate. Valid values are 1.3, 1.4, 5, 6, 7 and 8.
-     */
-    @Parameter( defaultValue = "7" )
-    protected String version;
-
-    /**
-     * Character encoding for the auto-generated deployment file(s).
-     */
-    @Parameter( defaultValue = "UTF-8" )
-    protected String encoding;
-
-    /**
-     * Directory where the deployment descriptor file(s) will be auto-generated.
-     */
-    @Parameter( defaultValue = "${project.build.directory}" )
-    protected String generatedDescriptorLocation;
-
-    /**
-     * The maven project.
-     */
-    @Parameter( defaultValue = "${project}", readonly = true, required = true )
-    protected MavenProject project;
-
-    /**
-     * The ear modules configuration.
-     */
-    @Parameter
-    private EarModule[] modules;
-
-    /**
-     * The artifact type mappings.
-     */
-    @Parameter
-    protected PlexusConfiguration artifactTypeMappings;
-
-    /**
-     * The default bundle dir for libraries.
-     */
-    @Parameter
-    protected String defaultLibBundleDir;
-
-    /**
-     * Should libraries be added in application.xml
-     */
-    @Parameter( defaultValue = "false" )
-    private Boolean includeLibInApplicationXml = Boolean.FALSE;
-
-    /**
-     * The file name mapping to use for all dependencies included in the EAR file. The following values are valid
-     * {@code standard}, {@code no-version}, {@code full}, {@code no-version-for-ejb}. The {@code standard} means the
-     * filename is the artifactId incl. the version of the artifact. The {@code no-version} means the files is only the
-     * artifactId without the version. The {@code full} means the filename is the groupId+artifactId+version of the
-     * artifact. The {@code no-version-for-ejb} means the filename is the artifactId without the version in case of
-     * {@code EJB} type.
-     */
-    @Parameter
-    private String fileNameMapping;
-
-    /**
-     * When using a {@link #fileNameMapping} with versions, either use the {@code baseVersion} or the {@code version}.
-     * When the artifact is a SNAPSHOT, {@code version} will always return a value with a {@code -SNAPSHOT} postfix
-     * instead of the possible timestamped value.
-     * 
-     * @since 2.9
-     */
-    @Parameter
-    private Boolean useBaseVersion;
-
-    /**
-     * Directory that resources are copied to during the build.
-     */
-    @Parameter( defaultValue = "${project.build.directory}/${project.build.finalName}", required = true )
-    private File workDirectory;
-
-    /**
-     * The JBoss specific configuration.
-     * 
-     * @parameter
-     */
-    @Parameter
-    private PlexusConfiguration jboss;
-
-    /**
-     * The id to use to define the main artifact (e.g. the artifact without a classifier) when there is multiple
-     * candidates.
-     * 
-     * @parameter
-     */
-    @Parameter
-    private String mainArtifactId = "none";
-
-    /**
-     * temp folder location.
-     */
-    @Parameter( defaultValue = "${project.build.directory}", required = true )
-    private File tempFolder;
-
-    @Component
-    private MavenResourcesFiltering mavenResourcesFiltering;
-
-    private List<EarModule> earModules;
-
-    private List<EarModule> allModules;
-
-    private JbossConfiguration jbossConfiguration;
-
-    /** {@inheritDoc} */
-    public void execute()
-        throws MojoExecutionException, MojoFailureException
-    {
-        final JavaEEVersion javaEEVersion = JavaEEVersion.getJavaEEVersion( version );
-        getLog().debug( "Resolving artifact type mappings ..." );
-        ArtifactTypeMappingService typeMappingService;
-        try
-        {
-            typeMappingService = new ArtifactTypeMappingService();
-            typeMappingService.configure( artifactTypeMappings );
-        }
-        catch ( EarPluginException e )
-        {
-            throw new MojoExecutionException( "Failed to initialize artifact type mappings", e );
-        }
-        catch ( PlexusConfigurationException e )
-        {
-            throw new MojoExecutionException( "Invalid artifact type mappings configuration", e );
-        }
-
-        getLog().debug( "Initializing JBoss configuration if necessary ..." );
-        try
-        {
-            initializeJbossConfiguration();
-        }
-        catch ( EarPluginException e )
-        {
-            throw new MojoExecutionException( "Failed to initialize JBoss configuration", e );
-        }
-
-        getLog().debug( "Initializing ear execution context" );
-        EarExecutionContext earExecutionContext =
-            new EarExecutionContext( project, mainArtifactId, defaultLibBundleDir, jbossConfiguration, fileNameMapping,
-                                     typeMappingService );
-
-        if ( useBaseVersion != null )
-        {
-            earExecutionContext.getFileNameMapping().setUseBaseVersion( useBaseVersion );
-        }
-
-        getLog().debug( "Resolving ear modules ..." );
-        allModules = new ArrayList<EarModule>();
-        try
-        {
-            if ( modules != null && modules.length > 0 )
-            {
-                // Let's validate user-defined modules
-                EarModule module;
-
-                for ( EarModule module1 : modules )
-                {
-                    module = module1;
-                    getLog().debug( "Resolving ear module[" + module + "]" );
-                    module.setEarExecutionContext( earExecutionContext );
-                    module.resolveArtifact( project.getArtifacts() );
-                    allModules.add( module );
-                }
-            }
-
-            // Let's add other modules
-            Set<Artifact> artifacts = project.getArtifacts();
-            for ( Artifact artifact : artifacts )
-            {
-                // If the artifact's type is POM, ignore and continue
-                // since it's used for transitive deps only.
-                if ( "pom".equals( artifact.getType() ) )
-                {
-                    continue;
-                }
-
-                // Artifact is not yet registered and it has neither test, nor a
-                // provided scope, not is it optional
-                ScopeArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_RUNTIME );
-                if ( !isArtifactRegistered( artifact, allModules ) && !artifact.isOptional()
-                    && filter.include( artifact ) )
-                {
-                    EarModule module = EarModuleFactory.newEarModule( artifact, javaEEVersion, defaultLibBundleDir,
-                                                                      includeLibInApplicationXml, typeMappingService );
-                    module.setEarExecutionContext( earExecutionContext );
-                    allModules.add( module );
-                }
-            }
-        }
-        catch ( EarPluginException e )
-        {
-            throw new MojoExecutionException( "Failed to initialize ear modules", e );
-        }
-
-        // Now we have everything let's built modules which have not been excluded
-        earModules = new ArrayList<EarModule>();
-        for ( EarModule earModule : allModules )
-        {
-            if ( earModule.isExcluded() )
-            {
-                getLog().debug( "Skipping ear module[" + earModule + "]" );
-            }
-            else
-            {
-                earModules.add( earModule );
-            }
-        }
-
-    }
-
-    /**
-     * @return The list of {@link #earModules}.
-     */
-    protected List<EarModule> getModules()
-    {
-        if ( earModules == null )
-        {
-            throw new IllegalStateException( "Ear modules have not been initialized" );
-        }
-        return earModules;
-    }
-
-    /**
-     * @return {@link MavenProject}
-     */
-    protected MavenProject getProject()
-    {
-        return project;
-    }
-
-    /**
-     * @return {@link #workDirectory}
-     */
-    protected File getWorkDirectory()
-    {
-        return workDirectory;
-    }
-
-    /**
-     * @return {@link #jbossConfiguration}
-     */
-    protected JbossConfiguration getJbossConfiguration()
-    {
-        return jbossConfiguration;
-    }
-
-    /**
-     * @return {@link #tempFolder}
-     */
-    public File getTempFolder()
-    {
-        return tempFolder;
-    }
-
-    private static boolean isArtifactRegistered( Artifact a, List<EarModule> currentList )
-    {
-        for ( EarModule em : currentList )
-        {
-            if ( em.getArtifact().equals( a ) )
-            {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Initializes the JBoss configuration.
-     * 
-     * @throws EarPluginException if the configuration is invalid
-     */
-    private void initializeJbossConfiguration()
-        throws EarPluginException
-    {
-        if ( jboss == null )
-        {
-            jbossConfiguration = null;
-        }
-        else
-        {
-            String childVersion = jboss.getChild( JbossConfiguration.VERSION ).getValue();
-            if ( childVersion == null )
-            {
-                getLog().info( "JBoss version not set, using JBoss 4 by default" );
-                childVersion = JbossConfiguration.VERSION_4;
-            }
-            final String securityDomain = jboss.getChild( JbossConfiguration.SECURITY_DOMAIN ).getValue();
-            final String unauthenticatedPrincipal =
-                jboss.getChild( JbossConfiguration.UNAUHTHENTICTED_PRINCIPAL ).getValue();
-
-            final PlexusConfiguration loaderRepositoryEl = jboss.getChild( JbossConfiguration.LOADER_REPOSITORY );
-            final String loaderRepository = loaderRepositoryEl.getValue();
-            final String loaderRepositoryClass =
-                loaderRepositoryEl.getAttribute( JbossConfiguration.LOADER_REPOSITORY_CLASS_ATTRIBUTE );
-            final PlexusConfiguration loaderRepositoryConfigEl =
-                jboss.getChild( JbossConfiguration.LOADER_REPOSITORY_CONFIG );
-            final String loaderRepositoryConfig = loaderRepositoryConfigEl.getValue();
-            final String configParserClass =
-                loaderRepositoryConfigEl.getAttribute( JbossConfiguration.CONFIG_PARSER_CLASS_ATTRIBUTE );
-
-            final String jmxName = jboss.getChild( JbossConfiguration.JMX_NAME ).getValue();
-            final String moduleOrder = jboss.getChild( JbossConfiguration.MODULE_ORDER ).getValue();
-
-            final List<String> dataSources = new ArrayList<String>();
-            final PlexusConfiguration dataSourcesEl = jboss.getChild( JbossConfiguration.DATASOURCES );
-            if ( dataSourcesEl != null )
-            {
-
-                final PlexusConfiguration[] dataSourcesConfig =
-                    dataSourcesEl.getChildren( JbossConfiguration.DATASOURCE );
-                for ( PlexusConfiguration dataSourceConfig : dataSourcesConfig )
-                {
-                    dataSources.add( dataSourceConfig.getValue() );
-
-                }
-            }
-            final String libraryDirectory = jboss.getChild( JbossConfiguration.LIBRARY_DIRECTORY ).getValue();
-            jbossConfiguration =
-                new JbossConfiguration( childVersion, securityDomain, unauthenticatedPrincipal, jmxName,
-                                        loaderRepository, moduleOrder, dataSources, libraryDirectory,
-                                        loaderRepositoryConfig, loaderRepositoryClass, configParserClass );
-        }
-    }
-}
+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 java.io.File;

+import java.util.ArrayList;

+import java.util.List;

+import java.util.Set;

+

+import org.apache.maven.artifact.Artifact;

+import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;

+import org.apache.maven.plugin.AbstractMojo;

+import org.apache.maven.plugin.MojoExecutionException;

+import org.apache.maven.plugin.MojoFailureException;

+import org.apache.maven.plugins.annotations.Component;

+import org.apache.maven.plugins.annotations.Parameter;

+import org.apache.maven.plugins.ear.util.ArtifactTypeMappingService;

+import org.apache.maven.plugins.ear.util.JavaEEVersion;

+import org.apache.maven.project.MavenProject;

+import org.apache.maven.shared.filtering.MavenResourcesFiltering;

+import org.codehaus.plexus.configuration.PlexusConfiguration;

+import org.codehaus.plexus.configuration.PlexusConfigurationException;

+

+/**

+ * A base class for EAR-processing related tasks.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: AbstractEarMojo.java 1742027 2016-05-02 19:11:21Z khmarbaise $

+ */

+public abstract class AbstractEarMojo

+    extends AbstractMojo

+{

+    /**

+     * The application XML URI {@code META-INF/application.xml}

+     */

+    public static final String APPLICATION_XML_URI = "META-INF/application.xml";

+

+    /**

+     * The {@code META-INF} folder.

+     */

+    public static final String META_INF = "META-INF";

+

+    /**

+     * UTF-8 encoding constant.

+     */

+    public static final String UTF_8 = "UTF-8";

+

+    /**

+     * The version of the application.xml to generate. Valid values are 1.3, 1.4, 5, 6, 7 and 8.

+     */

+    @Parameter( defaultValue = "7" )

+    protected String version;

+

+    /**

+     * Character encoding for the auto-generated deployment file(s).

+     */

+    @Parameter( defaultValue = "UTF-8" )

+    protected String encoding;

+

+    /**

+     * Directory where the deployment descriptor file(s) will be auto-generated.

+     */

+    @Parameter( defaultValue = "${project.build.directory}" )

+    protected String generatedDescriptorLocation;

+

+    /**

+     * The maven project.

+     */

+    @Parameter( defaultValue = "${project}", readonly = true, required = true )

+    protected MavenProject project;

+

+    /**

+     * The ear modules configuration.

+     */

+    @Parameter

+    private EarModule[] modules;

+

+    /**

+     * The artifact type mappings.

+     */

+    @Parameter

+    protected PlexusConfiguration artifactTypeMappings;

+

+    /**

+     * The default bundle dir for libraries.

+     */

+    @Parameter

+    protected String defaultLibBundleDir;

+

+    /**

+     * Should libraries be added in application.xml

+     */

+    @Parameter( defaultValue = "false" )

+    private Boolean includeLibInApplicationXml = Boolean.FALSE;

+

+    /**

+     * The file name mapping to use for all dependencies included in the EAR file. The following values are valid

+     * {@code standard}, {@code no-version}, {@code full}, {@code no-version-for-ejb}. The {@code standard} means the

+     * filename is the artifactId incl. the version of the artifact. The {@code no-version} means the files is only the

+     * artifactId without the version. The {@code full} means the filename is the groupId+artifactId+version of the

+     * artifact. The {@code no-version-for-ejb} means the filename is the artifactId without the version in case of

+     * {@code EJB} type.

+     */

+    @Parameter

+    private String fileNameMapping;

+

+    /**

+     * When using a {@link #fileNameMapping} with versions, either use the {@code baseVersion} or the {@code version}.

+     * When the artifact is a SNAPSHOT, {@code version} will always return a value with a {@code -SNAPSHOT} postfix

+     * instead of the possible timestamped value.

+     * 

+     * @since 2.9

+     */

+    @Parameter

+    private Boolean useBaseVersion;

+

+    /**

+     * Directory that resources are copied to during the build.

+     */

+    @Parameter( defaultValue = "${project.build.directory}/${project.build.finalName}", required = true )

+    private File workDirectory;

+

+    /**

+     * The JBoss specific configuration.

+     * 

+     * @parameter

+     */

+    @Parameter

+    private PlexusConfiguration jboss;

+

+    /**

+     * The id to use to define the main artifact (e.g. the artifact without a classifier) when there is multiple

+     * candidates.

+     * 

+     * @parameter

+     */

+    @Parameter

+    private String mainArtifactId = "none";

+

+    /**

+     * temp folder location.

+     */

+    @Parameter( defaultValue = "${project.build.directory}", required = true )

+    private File tempFolder;

+

+    @Component

+    private MavenResourcesFiltering mavenResourcesFiltering;

+

+    private List<EarModule> earModules;

+

+    private List<EarModule> allModules;

+

+    private JbossConfiguration jbossConfiguration;

+

+    /** {@inheritDoc} */

+    public void execute()

+        throws MojoExecutionException, MojoFailureException

+    {

+        final JavaEEVersion javaEEVersion = JavaEEVersion.getJavaEEVersion( version );

+        getLog().debug( "Resolving artifact type mappings ..." );

+        ArtifactTypeMappingService typeMappingService;

+        try

+        {

+            typeMappingService = new ArtifactTypeMappingService();

+            typeMappingService.configure( artifactTypeMappings );

+        }

+        catch ( EarPluginException e )

+        {

+            throw new MojoExecutionException( "Failed to initialize artifact type mappings", e );

+        }

+        catch ( PlexusConfigurationException e )

+        {

+            throw new MojoExecutionException( "Invalid artifact type mappings configuration", e );

+        }

+

+        getLog().debug( "Initializing JBoss configuration if necessary ..." );

+        try

+        {

+            initializeJbossConfiguration();

+        }

+        catch ( EarPluginException e )

+        {

+            throw new MojoExecutionException( "Failed to initialize JBoss configuration", e );

+        }

+

+        getLog().debug( "Initializing ear execution context" );

+        EarExecutionContext earExecutionContext =

+            new EarExecutionContext( project, mainArtifactId, defaultLibBundleDir, jbossConfiguration, fileNameMapping,

+                                     typeMappingService );

+

+        if ( useBaseVersion != null )

+        {

+            earExecutionContext.getFileNameMapping().setUseBaseVersion( useBaseVersion );

+        }

+

+        getLog().debug( "Resolving ear modules ..." );

+        allModules = new ArrayList<EarModule>();

+        try

+        {

+            if ( modules != null && modules.length > 0 )

+            {

+                // Let's validate user-defined modules

+                EarModule module;

+

+                for ( EarModule module1 : modules )

+                {

+                    module = module1;

+                    getLog().debug( "Resolving ear module[" + module + "]" );

+                    module.setEarExecutionContext( earExecutionContext );

+                    module.resolveArtifact( project.getArtifacts() );

+                    allModules.add( module );

+                }

+            }

+

+            // Let's add other modules

+            Set<Artifact> artifacts = project.getArtifacts();

+            for ( Artifact artifact : artifacts )

+            {

+                // If the artifact's type is POM, ignore and continue

+                // since it's used for transitive deps only.

+                if ( "pom".equals( artifact.getType() ) )

+                {

+                    continue;

+                }

+

+                // Artifact is not yet registered and it has neither test, nor a

+                // provided scope, not is it optional

+                ScopeArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_RUNTIME );

+                if ( !isArtifactRegistered( artifact, allModules ) && !artifact.isOptional()

+                    && filter.include( artifact ) )

+                {

+                    EarModule module = EarModuleFactory.newEarModule( artifact, javaEEVersion, defaultLibBundleDir,

+                                                                      includeLibInApplicationXml, typeMappingService );

+                    module.setEarExecutionContext( earExecutionContext );

+                    allModules.add( module );

+                }

+            }

+        }

+        catch ( EarPluginException e )

+        {

+            throw new MojoExecutionException( "Failed to initialize ear modules", e );

+        }

+

+        // Now we have everything let's built modules which have not been excluded

+        earModules = new ArrayList<EarModule>();

+        for ( EarModule earModule : allModules )

+        {

+            if ( earModule.isExcluded() )

+            {

+                getLog().debug( "Skipping ear module[" + earModule + "]" );

+            }

+            else

+            {

+                earModules.add( earModule );

+            }

+        }

+

+    }

+

+    /**

+     * @return The list of {@link #earModules}.

+     */

+    protected List<EarModule> getModules()

+    {

+        if ( earModules == null )

+        {

+            throw new IllegalStateException( "Ear modules have not been initialized" );

+        }

+        return earModules;

+    }

+

+    /**

+     * @return {@link MavenProject}

+     */

+    protected MavenProject getProject()

+    {

+        return project;

+    }

+

+    /**

+     * @return {@link #workDirectory}

+     */

+    protected File getWorkDirectory()

+    {

+        return workDirectory;

+    }

+

+    /**

+     * @return {@link #jbossConfiguration}

+     */

+    protected JbossConfiguration getJbossConfiguration()

+    {

+        return jbossConfiguration;

+    }

+

+    /**

+     * @return {@link #tempFolder}

+     */

+    public File getTempFolder()

+    {

+        return tempFolder;

+    }

+

+    private static boolean isArtifactRegistered( Artifact a, List<EarModule> currentList )

+    {

+        for ( EarModule em : currentList )

+        {

+            if ( em.getArtifact().equals( a ) )

+            {

+                return true;

+            }

+        }

+        return false;

+    }

+

+    /**

+     * Initializes the JBoss configuration.

+     * 

+     * @throws EarPluginException if the configuration is invalid

+     */

+    private void initializeJbossConfiguration()

+        throws EarPluginException

+    {

+        if ( jboss == null )

+        {

+            jbossConfiguration = null;

+        }

+        else

+        {

+            String childVersion = jboss.getChild( JbossConfiguration.VERSION ).getValue();

+            if ( childVersion == null )

+            {

+                getLog().info( "JBoss version not set, using JBoss 4 by default" );

+                childVersion = JbossConfiguration.VERSION_4;

+            }

+            final String securityDomain = jboss.getChild( JbossConfiguration.SECURITY_DOMAIN ).getValue();

+            final String unauthenticatedPrincipal =

+                jboss.getChild( JbossConfiguration.UNAUHTHENTICTED_PRINCIPAL ).getValue();

+

+            final PlexusConfiguration loaderRepositoryEl = jboss.getChild( JbossConfiguration.LOADER_REPOSITORY );

+            final String loaderRepository = loaderRepositoryEl.getValue();

+            final String loaderRepositoryClass =

+                loaderRepositoryEl.getAttribute( JbossConfiguration.LOADER_REPOSITORY_CLASS_ATTRIBUTE );

+            final PlexusConfiguration loaderRepositoryConfigEl =

+                jboss.getChild( JbossConfiguration.LOADER_REPOSITORY_CONFIG );

+            final String loaderRepositoryConfig = loaderRepositoryConfigEl.getValue();

+            final String configParserClass =

+                loaderRepositoryConfigEl.getAttribute( JbossConfiguration.CONFIG_PARSER_CLASS_ATTRIBUTE );

+

+            final String jmxName = jboss.getChild( JbossConfiguration.JMX_NAME ).getValue();

+            final String moduleOrder = jboss.getChild( JbossConfiguration.MODULE_ORDER ).getValue();

+

+            final List<String> dataSources = new ArrayList<String>();

+            final PlexusConfiguration dataSourcesEl = jboss.getChild( JbossConfiguration.DATASOURCES );

+            if ( dataSourcesEl != null )

+            {

+

+                final PlexusConfiguration[] dataSourcesConfig =

+                    dataSourcesEl.getChildren( JbossConfiguration.DATASOURCE );

+                for ( PlexusConfiguration dataSourceConfig : dataSourcesConfig )

+                {

+                    dataSources.add( dataSourceConfig.getValue() );

+

+                }

+            }

+            final String libraryDirectory = jboss.getChild( JbossConfiguration.LIBRARY_DIRECTORY ).getValue();

+            jbossConfiguration =

+                new JbossConfiguration( childVersion, securityDomain, unauthenticatedPrincipal, jmxName,

+                                        loaderRepository, moduleOrder, dataSources, libraryDirectory,

+                                        loaderRepositoryConfig, loaderRepositoryClass, configParserClass );

+        }

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/AbstractXmlWriter.java b/src/main/java/org/apache/maven/plugins/ear/AbstractXmlWriter.java
similarity index 95%
rename from src/main/java/org/apache/maven/plugin/ear/AbstractXmlWriter.java
rename to src/main/java/org/apache/maven/plugins/ear/AbstractXmlWriter.java
index 7a15d6a..f360c6a 100644
--- a/src/main/java/org/apache/maven/plugin/ear/AbstractXmlWriter.java
+++ b/src/main/java/org/apache/maven/plugins/ear/AbstractXmlWriter.java
@@ -1,91 +1,91 @@
-package org.apache.maven.plugin.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.codehaus.plexus.util.WriterFactory;
-import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
-import org.codehaus.plexus.util.xml.XMLWriter;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.Writer;
-
-/**
- * A base class for deployment descriptor file generators.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-abstract class AbstractXmlWriter
-{
-
-    private final String encoding;
-
-    protected static final String MODULE_ELEMENT = "module";
-
-    protected static final String SERVICE_ELEMENT = "service";
-
-    AbstractXmlWriter( String encoding )
-    {
-        this.encoding = encoding;
-    }
-
-    protected Writer initializeWriter( final File destinationFile )
-        throws EarPluginException
-    {
-        try
-        {
-            return WriterFactory.newXmlWriter( destinationFile );
-        }
-        catch ( IOException ex )
-        {
-            // CHECKSTYLE_OFF: LineLength
-            throw new EarPluginException( "Exception while opening file[" + destinationFile.getAbsolutePath() + "]", ex );
-            // CHECKSTYLE_ON: LineLength
-        }
-    }
-
-    protected XMLWriter initializeXmlWriter( final Writer writer, final String docType )
-    {
-        return new PrettyPrintXMLWriter( writer, encoding, docType );
-    }
-
-    protected void close( Writer closeable )
-    {
-        if ( closeable == null )
-        {
-            return;
-        }
-
-        try
-        {
-            closeable.close();
-        }
-        catch ( Exception e )
-        {
-            // TODO: warn
-        }
-    }
-
-    public String getEncoding()
-    {
-        return encoding;
-    }
-}
+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.codehaus.plexus.util.WriterFactory;

+import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;

+import org.codehaus.plexus.util.xml.XMLWriter;

+

+import java.io.File;

+import java.io.IOException;

+import java.io.Writer;

+

+/**

+ * A base class for deployment descriptor file generators.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: AbstractXmlWriter.java 1636449 2014-11-03 21:27:36Z khmarbaise $

+ */

+abstract class AbstractXmlWriter

+{

+

+    private final String encoding;

+

+    protected static final String MODULE_ELEMENT = "module";

+

+    protected static final String SERVICE_ELEMENT = "service";

+

+    AbstractXmlWriter( String encoding )

+    {

+        this.encoding = encoding;

+    }

+

+    protected Writer initializeWriter( final File destinationFile )

+        throws EarPluginException

+    {

+        try

+        {

+            return WriterFactory.newXmlWriter( destinationFile );

+        }

+        catch ( IOException ex )

+        {

+            // CHECKSTYLE_OFF: LineLength

+            throw new EarPluginException( "Exception while opening file[" + destinationFile.getAbsolutePath() + "]", ex );

+            // CHECKSTYLE_ON: LineLength

+        }

+    }

+

+    protected XMLWriter initializeXmlWriter( final Writer writer, final String docType )

+    {

+        return new PrettyPrintXMLWriter( writer, encoding, docType );

+    }

+

+    protected void close( Writer closeable )

+    {

+        if ( closeable == null )

+        {

+            return;

+        }

+

+        try

+        {

+            closeable.close();

+        }

+        catch ( Exception e )

+        {

+            // TODO: warn

+        }

+    }

+

+    public String getEncoding()

+    {

+        return encoding;

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/AppClientModule.java b/src/main/java/org/apache/maven/plugins/ear/AppClientModule.java
similarity index 97%
rename from src/main/java/org/apache/maven/plugin/ear/AppClientModule.java
rename to src/main/java/org/apache/maven/plugins/ear/AppClientModule.java
index ff4346f..5c537b7 100644
--- a/src/main/java/org/apache/maven/plugin/ear/AppClientModule.java
+++ b/src/main/java/org/apache/maven/plugins/ear/AppClientModule.java
@@ -1,71 +1,71 @@
-package org.apache.maven.plugin.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.codehaus.plexus.util.xml.XMLWriter;
-
-/**
- * The {@link EarModule} implementation for an application client module.
- * 
- * @author Stephane Nicoll
- */
-public class AppClientModule
-    extends AbstractEarModule
-{
-
-    /**
-     * Create an instance.
-     */
-    public AppClientModule()
-    {
-    }
-
-    /**
-     * @param a {@link Artifact}
-     */
-    public AppClientModule( Artifact a )
-    {
-        super( a );
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void appendModule( XMLWriter writer, String version, Boolean generateId )
-    {
-        startModuleElement( writer, generateId );
-        writer.startElement( JAVA_MODULE );
-        writer.writeText( getUri() );
-        writer.endElement();
-
-        writeAltDeploymentDescriptor( writer, version );
-
-        writer.endElement();
-    }
-
-    /**
-     * @return The type of the module.
-     */
-    public String getType()
-    {
-        return "app-client";
-    }
-}
+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.codehaus.plexus.util.xml.XMLWriter;

+

+/**

+ * The {@link EarModule} implementation for an application client module.

+ * 

+ * @author Stephane Nicoll

+ */

+public class AppClientModule

+    extends AbstractEarModule

+{

+

+    /**

+     * Create an instance.

+     */

+    public AppClientModule()

+    {

+    }

+

+    /**

+     * @param a {@link Artifact}

+     */

+    public AppClientModule( Artifact a )

+    {

+        super( a );

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public void appendModule( XMLWriter writer, String version, Boolean generateId )

+    {

+        startModuleElement( writer, generateId );

+        writer.startElement( JAVA_MODULE );

+        writer.writeText( getUri() );

+        writer.endElement();

+

+        writeAltDeploymentDescriptor( writer, version );

+

+        writer.endElement();

+    }

+

+    /**

+     * @return The type of the module.

+     */

+    public String getType()

+    {

+        return "app-client";

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/ApplicationXmlWriter.java b/src/main/java/org/apache/maven/plugins/ear/ApplicationXmlWriter.java
similarity index 97%
rename from src/main/java/org/apache/maven/plugin/ear/ApplicationXmlWriter.java
rename to src/main/java/org/apache/maven/plugins/ear/ApplicationXmlWriter.java
index 7a44e86..58dbd3a 100644
--- a/src/main/java/org/apache/maven/plugin/ear/ApplicationXmlWriter.java
+++ b/src/main/java/org/apache/maven/plugins/ear/ApplicationXmlWriter.java
@@ -1,250 +1,250 @@
-package org.apache.maven.plugin.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 java.io.Writer;
-
-import org.apache.maven.plugin.ear.util.JavaEEVersion;
-import org.codehaus.plexus.util.xml.XMLWriter;
-
-/**
- * An <tt>XmlWriter</tt> based implementation used to generate an <tt>application.xml</tt> file
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-final class ApplicationXmlWriter
-    extends AbstractXmlWriter
-{
-    public static final String DOCTYPE_1_3 = "application PUBLIC\n"
-        + "\t\"-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN\"\n"
-        + "\t\"http://java.sun.com/dtd/application_1_3.dtd\"";
-
-    private static final String APPLICATION_ELEMENT = "application";
-
-    private final JavaEEVersion version;
-
-    private final Boolean generateModuleId;
-
-    ApplicationXmlWriter( JavaEEVersion version, String encoding, Boolean generateModuleId )
-    {
-        super( encoding );
-        this.version = version;
-        this.generateModuleId = generateModuleId;
-    }
-
-    public void write( ApplicationXmlWriterContext context )
-        throws EarPluginException
-    {
-        Writer w = initializeWriter( context.getDestinationFile() );
-
-        XMLWriter writer = null;
-        if ( JavaEEVersion.ONE_DOT_THREE.eq( version ) )
-        {
-            writer = initializeRootElementOneDotThree( w );
-        }
-        else if ( JavaEEVersion.ONE_DOT_FOUR.eq( version ) )
-        {
-            writer = initializeRootElementOneDotFour( w );
-        }
-        else if ( JavaEEVersion.FIVE.eq( version ) )
-        {
-            writer = initializeRootElementFive( w );
-        }
-        else if ( JavaEEVersion.SIX.eq( version ) )
-        {
-            writer = initializeRootElementSix( w );
-        }
-        else if ( JavaEEVersion.SEVEN.eq( version ) )
-        {
-            writer = initializeRootElementSeven( w );
-        }
-
-        // writer is still on root element, so we can still add this attribute
-        if ( context.getApplicationId() != null )
-        {
-            writer.addAttribute( "id", context.getApplicationId() );
-        }
-
-        // As from JavaEE6
-        if ( version.ge( JavaEEVersion.SIX ) )
-        {
-            writeApplicationName( context.getApplicationName(), writer );
-        }
-
-        // IMPORTANT: the order of the description and display-name elements was
-        // reversed between J2EE 1.3 and J2EE 1.4.
-        if ( version.eq( JavaEEVersion.ONE_DOT_THREE ) )
-        {
-            writeDisplayName( context.getDisplayName(), writer );
-            writeDescription( context.getDescription(), writer );
-        }
-        else
-        {
-            writeDescription( context.getDescription(), writer );
-            writeDisplayName( context.getDisplayName(), writer );
-        }
-
-        // As from JavaEE6
-        if ( version.ge( JavaEEVersion.SIX ) )
-        {
-            writeInitializeInOrder( context.getInitializeInOrder(), writer );
-        }
-
-        // Do not change this unless you really know what you're doing :)
-        for ( EarModule module : context.getEarModules() )
-        {
-            module.appendModule( writer, version.getVersion(), generateModuleId );
-        }
-
-        for ( SecurityRole securityRole : context.getSecurityRoles() )
-        {
-            securityRole.appendSecurityRole( writer );
-        }
-
-        if ( version.ge( JavaEEVersion.FIVE ) )
-        {
-            writeLibraryDirectory( context.getLibraryDirectory(), writer );
-        }
-
-        if ( version.ge( JavaEEVersion.SIX ) )
-        {
-            for ( EnvEntry envEntry : context.getEnvEntries() )
-            {
-                envEntry.appendEnvEntry( writer );
-            }
-            for ( EjbRef ejbEntry : context.getEjbEntries() )
-            {
-                ejbEntry.appendEjbRefEntry( writer );
-            }
-        }
-
-        writer.endElement();
-
-        close( w );
-    }
-
-    private void writeApplicationName( String applicationName, XMLWriter writer )
-    {
-        if ( applicationName != null )
-        {
-            writer.startElement( "application-name" );
-            writer.writeText( applicationName );
-            writer.endElement();
-        }
-    }
-
-    private void writeDescription( String description, XMLWriter writer )
-    {
-        if ( description != null )
-        {
-            writer.startElement( "description" );
-            writer.writeText( description );
-            writer.endElement();
-        }
-    }
-
-    private void writeDisplayName( String displayName, XMLWriter writer )
-    {
-        if ( displayName != null )
-        {
-            writer.startElement( "display-name" );
-            writer.writeText( displayName );
-            writer.endElement();
-        }
-    }
-
-    private void writeInitializeInOrder( Boolean initializeInOrder, XMLWriter writer )
-    {
-        if ( initializeInOrder != null )
-        {
-            writer.startElement( "initialize-in-order" );
-            writer.writeText( initializeInOrder.toString() );
-            writer.endElement();
-        }
-    }
-
-    private void writeLibraryDirectory( String libraryDirectory, XMLWriter writer )
-    {
-        if ( libraryDirectory != null )
-        {
-            writer.startElement( "library-directory" );
-            writer.writeText( libraryDirectory );
-            writer.endElement();
-        }
-    }
-
-    private XMLWriter initializeRootElementOneDotThree( Writer w )
-    {
-        XMLWriter writer = initializeXmlWriter( w, DOCTYPE_1_3 );
-        writer.startElement( APPLICATION_ELEMENT );
-        return writer;
-    }
-
-    private XMLWriter initializeRootElementOneDotFour( Writer w )
-    {
-        XMLWriter writer = initializeXmlWriter( w, null );
-        writer.startElement( APPLICATION_ELEMENT );
-        writer.addAttribute( "xmlns", "http://java.sun.com/xml/ns/j2ee" );
-        writer.addAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );
-        writer.addAttribute( "xsi:schemaLocation",
-                             "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd" );
-        writer.addAttribute( "version", "1.4" );
-        return writer;
-    }
-
-    private XMLWriter initializeRootElementFive( Writer w )
-    {
-        XMLWriter writer = initializeXmlWriter( w, null );
-        writer.startElement( APPLICATION_ELEMENT );
-        writer.addAttribute( "xmlns", "http://java.sun.com/xml/ns/javaee" );
-        writer.addAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );
-        writer.addAttribute( "xsi:schemaLocation",
-                             "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" );
-        writer.addAttribute( "version", "5" );
-        return writer;
-    }
-
-    private XMLWriter initializeRootElementSix( Writer w )
-    {
-        XMLWriter writer = initializeXmlWriter( w, null );
-        writer.startElement( APPLICATION_ELEMENT );
-        writer.addAttribute( "xmlns", "http://java.sun.com/xml/ns/javaee" );
-        writer.addAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );
-        writer.addAttribute( "xsi:schemaLocation",
-                             "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" );
-        writer.addAttribute( "version", "6" );
-        return writer;
-    }
-
-    private XMLWriter initializeRootElementSeven( Writer w )
-    {
-        XMLWriter writer = initializeXmlWriter( w, null );
-        writer.startElement( APPLICATION_ELEMENT );
-        writer.addAttribute( "xmlns", "http://xmlns.jcp.org/xml/ns/javaee" );
-        writer.addAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );
-        // CHECKSTYLE_OFF: LineLength
-        writer.addAttribute( "xsi:schemaLocation",
-                             "http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_7.xsd" );
-        // CHECKSTYLE_ON: LineLength
-        writer.addAttribute( "version", "7" );
-        return writer;
-    }
-}
+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 java.io.Writer;

+

+import org.apache.maven.plugins.ear.util.JavaEEVersion;

+import org.codehaus.plexus.util.xml.XMLWriter;

+

+/**

+ * An <tt>XmlWriter</tt> based implementation used to generate an <tt>application.xml</tt> file

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: ApplicationXmlWriter.java 1648055 2014-12-27 14:59:45Z khmarbaise $

+ */

+final class ApplicationXmlWriter

+    extends AbstractXmlWriter

+{

+    public static final String DOCTYPE_1_3 = "application PUBLIC\n"

+        + "\t\"-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN\"\n"

+        + "\t\"http://java.sun.com/dtd/application_1_3.dtd\"";

+

+    private static final String APPLICATION_ELEMENT = "application";

+

+    private final JavaEEVersion version;

+

+    private final Boolean generateModuleId;

+

+    ApplicationXmlWriter( JavaEEVersion version, String encoding, Boolean generateModuleId )

+    {

+        super( encoding );

+        this.version = version;

+        this.generateModuleId = generateModuleId;

+    }

+

+    public void write( ApplicationXmlWriterContext context )

+        throws EarPluginException

+    {

+        Writer w = initializeWriter( context.getDestinationFile() );

+

+        XMLWriter writer = null;

+        if ( JavaEEVersion.ONE_DOT_THREE.eq( version ) )

+        {

+            writer = initializeRootElementOneDotThree( w );

+        }

+        else if ( JavaEEVersion.ONE_DOT_FOUR.eq( version ) )

+        {

+            writer = initializeRootElementOneDotFour( w );

+        }

+        else if ( JavaEEVersion.FIVE.eq( version ) )

+        {

+            writer = initializeRootElementFive( w );

+        }

+        else if ( JavaEEVersion.SIX.eq( version ) )

+        {

+            writer = initializeRootElementSix( w );

+        }

+        else if ( JavaEEVersion.SEVEN.eq( version ) )

+        {

+            writer = initializeRootElementSeven( w );

+        }

+

+        // writer is still on root element, so we can still add this attribute

+        if ( context.getApplicationId() != null )

+        {

+            writer.addAttribute( "id", context.getApplicationId() );

+        }

+

+        // As from JavaEE6

+        if ( version.ge( JavaEEVersion.SIX ) )

+        {

+            writeApplicationName( context.getApplicationName(), writer );

+        }

+

+        // IMPORTANT: the order of the description and display-name elements was

+        // reversed between J2EE 1.3 and J2EE 1.4.

+        if ( version.eq( JavaEEVersion.ONE_DOT_THREE ) )

+        {

+            writeDisplayName( context.getDisplayName(), writer );

+            writeDescription( context.getDescription(), writer );

+        }

+        else

+        {

+            writeDescription( context.getDescription(), writer );

+            writeDisplayName( context.getDisplayName(), writer );

+        }

+

+        // As from JavaEE6

+        if ( version.ge( JavaEEVersion.SIX ) )

+        {

+            writeInitializeInOrder( context.getInitializeInOrder(), writer );

+        }

+

+        // Do not change this unless you really know what you're doing :)

+        for ( EarModule module : context.getEarModules() )

+        {

+            module.appendModule( writer, version.getVersion(), generateModuleId );

+        }

+

+        for ( SecurityRole securityRole : context.getSecurityRoles() )

+        {

+            securityRole.appendSecurityRole( writer );

+        }

+

+        if ( version.ge( JavaEEVersion.FIVE ) )

+        {

+            writeLibraryDirectory( context.getLibraryDirectory(), writer );

+        }

+

+        if ( version.ge( JavaEEVersion.SIX ) )

+        {

+            for ( EnvEntry envEntry : context.getEnvEntries() )

+            {

+                envEntry.appendEnvEntry( writer );

+            }

+            for ( EjbRef ejbEntry : context.getEjbEntries() )

+            {

+                ejbEntry.appendEjbRefEntry( writer );

+            }

+        }

+

+        writer.endElement();

+

+        close( w );

+    }

+

+    private void writeApplicationName( String applicationName, XMLWriter writer )

+    {

+        if ( applicationName != null )

+        {

+            writer.startElement( "application-name" );

+            writer.writeText( applicationName );

+            writer.endElement();

+        }

+    }

+

+    private void writeDescription( String description, XMLWriter writer )

+    {

+        if ( description != null )

+        {

+            writer.startElement( "description" );

+            writer.writeText( description );

+            writer.endElement();

+        }

+    }

+

+    private void writeDisplayName( String displayName, XMLWriter writer )

+    {

+        if ( displayName != null )

+        {

+            writer.startElement( "display-name" );

+            writer.writeText( displayName );

+            writer.endElement();

+        }

+    }

+

+    private void writeInitializeInOrder( Boolean initializeInOrder, XMLWriter writer )

+    {

+        if ( initializeInOrder != null )

+        {

+            writer.startElement( "initialize-in-order" );

+            writer.writeText( initializeInOrder.toString() );

+            writer.endElement();

+        }

+    }

+

+    private void writeLibraryDirectory( String libraryDirectory, XMLWriter writer )

+    {

+        if ( libraryDirectory != null )

+        {

+            writer.startElement( "library-directory" );

+            writer.writeText( libraryDirectory );

+            writer.endElement();

+        }

+    }

+

+    private XMLWriter initializeRootElementOneDotThree( Writer w )

+    {

+        XMLWriter writer = initializeXmlWriter( w, DOCTYPE_1_3 );

+        writer.startElement( APPLICATION_ELEMENT );

+        return writer;

+    }

+

+    private XMLWriter initializeRootElementOneDotFour( Writer w )

+    {

+        XMLWriter writer = initializeXmlWriter( w, null );

+        writer.startElement( APPLICATION_ELEMENT );

+        writer.addAttribute( "xmlns", "http://java.sun.com/xml/ns/j2ee" );

+        writer.addAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );

+        writer.addAttribute( "xsi:schemaLocation",

+                             "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd" );

+        writer.addAttribute( "version", "1.4" );

+        return writer;

+    }

+

+    private XMLWriter initializeRootElementFive( Writer w )

+    {

+        XMLWriter writer = initializeXmlWriter( w, null );

+        writer.startElement( APPLICATION_ELEMENT );

+        writer.addAttribute( "xmlns", "http://java.sun.com/xml/ns/javaee" );

+        writer.addAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );

+        writer.addAttribute( "xsi:schemaLocation",

+                             "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" );

+        writer.addAttribute( "version", "5" );

+        return writer;

+    }

+

+    private XMLWriter initializeRootElementSix( Writer w )

+    {

+        XMLWriter writer = initializeXmlWriter( w, null );

+        writer.startElement( APPLICATION_ELEMENT );

+        writer.addAttribute( "xmlns", "http://java.sun.com/xml/ns/javaee" );

+        writer.addAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );

+        writer.addAttribute( "xsi:schemaLocation",

+                             "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" );

+        writer.addAttribute( "version", "6" );

+        return writer;

+    }

+

+    private XMLWriter initializeRootElementSeven( Writer w )

+    {

+        XMLWriter writer = initializeXmlWriter( w, null );

+        writer.startElement( APPLICATION_ELEMENT );

+        writer.addAttribute( "xmlns", "http://xmlns.jcp.org/xml/ns/javaee" );

+        writer.addAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );

+        // CHECKSTYLE_OFF: LineLength

+        writer.addAttribute( "xsi:schemaLocation",

+                             "http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_7.xsd" );

+        // CHECKSTYLE_ON: LineLength

+        writer.addAttribute( "version", "7" );

+        return writer;

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/ApplicationXmlWriterContext.java b/src/main/java/org/apache/maven/plugins/ear/ApplicationXmlWriterContext.java
similarity index 98%
rename from src/main/java/org/apache/maven/plugin/ear/ApplicationXmlWriterContext.java
rename to src/main/java/org/apache/maven/plugins/ear/ApplicationXmlWriterContext.java
index 1667bb3..6cd9fdc 100644
--- a/src/main/java/org/apache/maven/plugin/ear/ApplicationXmlWriterContext.java
+++ b/src/main/java/org/apache/maven/plugins/ear/ApplicationXmlWriterContext.java
@@ -1,184 +1,184 @@
-package org.apache.maven.plugin.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 java.io.File;
-import java.util.List;
-
-/**
- * A context for the {@link ApplicationXmlWriter}.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id: ApplicationXmlWriter.java 728546 2008-12-21 22:56:51Z bentmann $
- */
-class ApplicationXmlWriterContext
-{
-
-    private String applicationId;
-
-    private final File destinationFile;
-
-    private final List<EarModule> earModules;
-
-    private final List<SecurityRole> securityRoles;
-
-    private final List<EnvEntry> envEntries;
-    
-    private final List<EjbRef> ejbEntries;
-
-    private final String displayName;
-
-    private final String description;
-
-    private final String libraryDirectory;
-
-    private final String applicationName;
-
-    private final Boolean initializeInOrder;
-
-    public ApplicationXmlWriterContext( File destinationFile, List<EarModule> earModules,
-                                        List<SecurityRole> securityRoles, List<EnvEntry> envEntries,
-                                        List<EjbRef> ejbEntries,
-                                        String displayName, String description, String libraryDirectory,
-                                        String applicationName, Boolean initializeInOrder )
-    {
-        this.destinationFile = destinationFile;
-        this.earModules = earModules;
-        this.securityRoles = securityRoles;
-        this.envEntries = envEntries;
-        this.ejbEntries = ejbEntries;
-        this.displayName = displayName;
-        this.description = description;
-        this.libraryDirectory = libraryDirectory;
-        this.applicationName = applicationName;
-        this.initializeInOrder = initializeInOrder;
-    }
-
-    public final ApplicationXmlWriterContext setApplicationId( String applicationId )
-    {
-        this.applicationId = applicationId;
-        return this;
-    }
-
-    public final String getApplicationId()
-    {
-        return applicationId;
-    }
-
-    /**
-     * Returns the name of the file to use to write application.xml to.
-     * 
-     * @return the output file
-     */
-    public File getDestinationFile()
-    {
-        return destinationFile;
-    }
-
-    /**
-     * Returns the list of {@link EarModule} instances.
-     * 
-     * @return the ear modules
-     */
-    public List<EarModule> getEarModules()
-    {
-        return earModules;
-    }
-
-    /**
-     * Returns the list of {@link SecurityRole} instances.
-     * 
-     * @return the security roles
-     */
-    public List<SecurityRole> getSecurityRoles()
-    {
-        return securityRoles;
-    }
-
-    /**
-     * Returns the list of {@link EnvEntry} instances (as per JavaEE 6).
-     * 
-     * @return the env-entry elements
-     */
-    public List<EnvEntry> getEnvEntries()
-    {
-        return envEntries;
-    }
-
-    /**
-     * Returns the list of {@link EjbRef}.
-     * 
-     * @return the env-ref elements
-     */
-    public List<EjbRef> getEjbEntries()
-    {
-        return ejbEntries;
-    }
-
-    /**
-     * Returns the display name.
-     * 
-     * @return the display name
-     */
-    public String getDisplayName()
-    {
-        return displayName;
-    }
-
-    /**
-     * Returns the description.
-     * 
-     * @return the description
-     */
-    public String getDescription()
-    {
-        return description;
-    }
-
-    /**
-     * Returns the library directory (as per JavaEE 5).
-     * 
-     * @return the library directory
-     */
-    public String getLibraryDirectory()
-    {
-        return libraryDirectory;
-    }
-
-    /**
-     * Returns the application name (as per JavaEE 6).
-     * 
-     * @return the application name
-     */
-    public String getApplicationName()
-    {
-        return applicationName;
-    }
-
-    /**
-     * Returns the value of the initialize in order parameter (as per JavaEE 6).
-     * 
-     * @return the initialize in order value
-     */
-    public Boolean getInitializeInOrder()
-    {
-        return initializeInOrder;
-    }
-}
+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 java.io.File;

+import java.util.List;

+

+/**

+ * A context for the {@link ApplicationXmlWriter}.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: ApplicationXmlWriter.java 728546 2008-12-21 22:56:51Z bentmann $

+ */

+class ApplicationXmlWriterContext

+{

+

+    private String applicationId;

+

+    private final File destinationFile;

+

+    private final List<EarModule> earModules;

+

+    private final List<SecurityRole> securityRoles;

+

+    private final List<EnvEntry> envEntries;

+    

+    private final List<EjbRef> ejbEntries;

+

+    private final String displayName;

+

+    private final String description;

+

+    private final String libraryDirectory;

+

+    private final String applicationName;

+

+    private final Boolean initializeInOrder;

+

+    public ApplicationXmlWriterContext( File destinationFile, List<EarModule> earModules,

+                                        List<SecurityRole> securityRoles, List<EnvEntry> envEntries,

+                                        List<EjbRef> ejbEntries,

+                                        String displayName, String description, String libraryDirectory,

+                                        String applicationName, Boolean initializeInOrder )

+    {

+        this.destinationFile = destinationFile;

+        this.earModules = earModules;

+        this.securityRoles = securityRoles;

+        this.envEntries = envEntries;

+        this.ejbEntries = ejbEntries;

+        this.displayName = displayName;

+        this.description = description;

+        this.libraryDirectory = libraryDirectory;

+        this.applicationName = applicationName;

+        this.initializeInOrder = initializeInOrder;

+    }

+

+    public final ApplicationXmlWriterContext setApplicationId( String applicationId )

+    {

+        this.applicationId = applicationId;

+        return this;

+    }

+

+    public final String getApplicationId()

+    {

+        return applicationId;

+    }

+

+    /**

+     * Returns the name of the file to use to write application.xml to.

+     * 

+     * @return the output file

+     */

+    public File getDestinationFile()

+    {

+        return destinationFile;

+    }

+

+    /**

+     * Returns the list of {@link EarModule} instances.

+     * 

+     * @return the ear modules

+     */

+    public List<EarModule> getEarModules()

+    {

+        return earModules;

+    }

+

+    /**

+     * Returns the list of {@link SecurityRole} instances.

+     * 

+     * @return the security roles

+     */

+    public List<SecurityRole> getSecurityRoles()

+    {

+        return securityRoles;

+    }

+

+    /**

+     * Returns the list of {@link EnvEntry} instances (as per JavaEE 6).

+     * 

+     * @return the env-entry elements

+     */

+    public List<EnvEntry> getEnvEntries()

+    {

+        return envEntries;

+    }

+

+    /**

+     * Returns the list of {@link EjbRef}.

+     * 

+     * @return the env-ref elements

+     */

+    public List<EjbRef> getEjbEntries()

+    {

+        return ejbEntries;

+    }

+

+    /**

+     * Returns the display name.

+     * 

+     * @return the display name

+     */

+    public String getDisplayName()

+    {

+        return displayName;

+    }

+

+    /**

+     * Returns the description.

+     * 

+     * @return the description

+     */

+    public String getDescription()

+    {

+        return description;

+    }

+

+    /**

+     * Returns the library directory (as per JavaEE 5).

+     * 

+     * @return the library directory

+     */

+    public String getLibraryDirectory()

+    {

+        return libraryDirectory;

+    }

+

+    /**

+     * Returns the application name (as per JavaEE 6).

+     * 

+     * @return the application name

+     */

+    public String getApplicationName()

+    {

+        return applicationName;

+    }

+

+    /**

+     * Returns the value of the initialize in order parameter (as per JavaEE 6).

+     * 

+     * @return the initialize in order value

+     */

+    public Boolean getInitializeInOrder()

+    {

+        return initializeInOrder;

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/EarExecutionContext.java b/src/main/java/org/apache/maven/plugins/ear/EarExecutionContext.java
similarity index 90%
rename from src/main/java/org/apache/maven/plugin/ear/EarExecutionContext.java
rename to src/main/java/org/apache/maven/plugins/ear/EarExecutionContext.java
index 5018490..094b4c7 100644
--- a/src/main/java/org/apache/maven/plugin/ear/EarExecutionContext.java
+++ b/src/main/java/org/apache/maven/plugins/ear/EarExecutionContext.java
@@ -1,109 +1,109 @@
-package org.apache.maven.plugin.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.plugin.ear.output.FileNameMapping;
-import org.apache.maven.plugin.ear.output.FileNameMappingFactory;
-import org.apache.maven.plugin.ear.util.ArtifactRepository;
-import org.apache.maven.plugin.ear.util.ArtifactTypeMappingService;
-import org.apache.maven.project.MavenProject;
-
-/**
- * Contains various runtime parameters used to customize the generated EAR file.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public class EarExecutionContext
-{
-    private String defaultLibBundleDir;
-
-    private JbossConfiguration jbossConfiguration;
-
-    private FileNameMapping fileNameMapping;
-
-    private ArtifactRepository artifactRepository;
-
-    /**
-     * @param project {@link MavenProject}
-     * @param mainArtifactId The artifactId.
-     * @param defaultLibBundleDir The defaultLibBundleDir.
-     * @param jbossConfiguration {@link JbossConfiguration}
-     * @param fileNameMappingName file name mapping.
-     * @param typeMappingService {@link ArtifactTypeMappingService}
-     */
-    public EarExecutionContext( MavenProject project, String mainArtifactId, String defaultLibBundleDir,
-                                JbossConfiguration jbossConfiguration, String fileNameMappingName,
-                                ArtifactTypeMappingService typeMappingService )
-    {
-        initialize( project, mainArtifactId, defaultLibBundleDir, jbossConfiguration, fileNameMappingName,
-                    typeMappingService );
-
-    }
-
-    /**
-     * @return {@link #defaultLibBundleDir}
-     */
-    public String getDefaultLibBundleDir()
-    {
-        return defaultLibBundleDir;
-    }
-
-    /**
-     * @return {@link #jbossConfiguration}
-     */
-    public boolean isJbossConfigured()
-    {
-        return jbossConfiguration != null;
-    }
-
-    /**
-     * @return {@link #fileNameMapping}
-     */
-    public FileNameMapping getFileNameMapping()
-    {
-        return fileNameMapping;
-    }
-
-    /**
-     * @return {@link #artifactRepository}
-     */
-    public ArtifactRepository getArtifactRepository()
-    {
-        return artifactRepository;
-    }
-
-    private void initialize( MavenProject project, String mainArtifactId, String defaultLibBundleDir,
-                             JbossConfiguration jbossConfiguration, String fileNameMappingName,
-                             ArtifactTypeMappingService typeMappingService )
-    {
-        this.artifactRepository = new ArtifactRepository( project.getArtifacts(), mainArtifactId, typeMappingService );
-        this.defaultLibBundleDir = defaultLibBundleDir;
-        this.jbossConfiguration = jbossConfiguration;
-        if ( fileNameMappingName == null || fileNameMappingName.trim().length() == 0 )
-        {
-            this.fileNameMapping = FileNameMappingFactory.getDefaultFileNameMapping();
-        }
-        else
-        {
-            this.fileNameMapping = FileNameMappingFactory.getFileNameMapping( fileNameMappingName );
-        }
-    }
-}
+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.plugins.ear.output.FileNameMapping;

+import org.apache.maven.plugins.ear.output.FileNameMappingFactory;

+import org.apache.maven.plugins.ear.util.ArtifactRepository;

+import org.apache.maven.plugins.ear.util.ArtifactTypeMappingService;

+import org.apache.maven.project.MavenProject;

+

+/**

+ * Contains various runtime parameters used to customize the generated EAR file.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: EarExecutionContext.java 1755538 2016-08-08 20:32:12Z rfscholte $

+ */

+public class EarExecutionContext

+{

+    private String defaultLibBundleDir;

+

+    private JbossConfiguration jbossConfiguration;

+

+    private FileNameMapping fileNameMapping;

+

+    private ArtifactRepository artifactRepository;

+

+    /**

+     * @param project {@link MavenProject}

+     * @param mainArtifactId The artifactId.

+     * @param defaultLibBundleDir The defaultLibBundleDir.

+     * @param jbossConfiguration {@link JbossConfiguration}

+     * @param fileNameMappingName file name mapping.

+     * @param typeMappingService {@link ArtifactTypeMappingService}

+     */

+    public EarExecutionContext( MavenProject project, String mainArtifactId, String defaultLibBundleDir,

+                                JbossConfiguration jbossConfiguration, String fileNameMappingName,

+                                ArtifactTypeMappingService typeMappingService )

+    {

+        initialize( project, mainArtifactId, defaultLibBundleDir, jbossConfiguration, fileNameMappingName,

+                    typeMappingService );

+

+    }

+

+    /**

+     * @return {@link #defaultLibBundleDir}

+     */

+    public String getDefaultLibBundleDir()

+    {

+        return defaultLibBundleDir;

+    }

+

+    /**

+     * @return {@link #jbossConfiguration}

+     */

+    public boolean isJbossConfigured()

+    {

+        return jbossConfiguration != null;

+    }

+

+    /**

+     * @return {@link #fileNameMapping}

+     */

+    public FileNameMapping getFileNameMapping()

+    {

+        return fileNameMapping;

+    }

+

+    /**

+     * @return {@link #artifactRepository}

+     */

+    public ArtifactRepository getArtifactRepository()

+    {

+        return artifactRepository;

+    }

+

+    private void initialize( MavenProject project, String mainArtifactId, String defaultLibBundleDir,

+                             JbossConfiguration jbossConfiguration, String fileNameMappingName,

+                             ArtifactTypeMappingService typeMappingService )

+    {

+        this.artifactRepository = new ArtifactRepository( project.getArtifacts(), mainArtifactId, typeMappingService );

+        this.defaultLibBundleDir = defaultLibBundleDir;

+        this.jbossConfiguration = jbossConfiguration;

+        if ( fileNameMappingName == null || fileNameMappingName.trim().length() == 0 )

+        {

+            this.fileNameMapping = FileNameMappingFactory.getDefaultFileNameMapping();

+        }

+        else

+        {

+            this.fileNameMapping = FileNameMappingFactory.getFileNameMapping( fileNameMappingName );

+        }

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/EarModule.java b/src/main/java/org/apache/maven/plugins/ear/EarModule.java
similarity index 96%
rename from src/main/java/org/apache/maven/plugin/ear/EarModule.java
rename to src/main/java/org/apache/maven/plugins/ear/EarModule.java
index 1f64c82..9e38297 100644
--- a/src/main/java/org/apache/maven/plugin/ear/EarModule.java
+++ b/src/main/java/org/apache/maven/plugins/ear/EarModule.java
@@ -1,122 +1,122 @@
-package org.apache.maven.plugin.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 ear module interface.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public interface EarModule
-{
-
-    /**
-     * Returns the {@link Artifact} representing this module.
-     * <p/>
-     * Note that this might return <tt>null</tt> till the module has been resolved.
-     * 
-     * @return the artifact
-     * @see #resolveArtifact(java.util.Set)
-     */
-    Artifact getArtifact();
-
-    /**
-     * Returns the <tt>URI</tt> for this module.
-     * 
-     * @return the <tt>URI</tt>
-     */
-    String getUri();
-
-    /**
-     * Returns the type associated to the module.
-     * 
-     * @return the artifact's type of the module
-     */
-    String getType();
-
-    /**
-     * Specify whether this module should be excluded or not.
-     * 
-     * @return true if this module should be skipped, false otherwise
-     */
-    boolean isExcluded();
-
-    /**
-     * Specify whether this module should be unpacked in the EAR archive or not.
-     * <p/>
-     * Returns null if no configuration was specified so that defaulting may apply.
-     * 
-     * @return true if this module should be bundled unpacked, false otherwise
-     */
-    Boolean shouldUnpack();
-
-    /**
-     * The alt-dd element specifies an optional URI to the post-assembly version of the deployment descriptor file for a
-     * particular Java EE module. The URI must specify the full pathname of the deployment descriptor file relative to
-     * the application's root directory.
-     * 
-     * @return the alternative deployment descriptor for this module
-     * @since JavaEE 5
-     */
-    String getAltDeploymentDescriptor();
-
-    /**
-     * Appends the <tt>XML</tt> representation of this module.
-     * 
-     * @param writer the writer to use
-     * @param version the version of the <tt>application.xml</tt> file
-     * @param generateId whether an id should be generated
-     */
-    void appendModule( XMLWriter writer, String version, Boolean generateId );
-
-    /**
-     * Resolves the {@link Artifact} represented by the module. Note that the {@link EarExecutionContext} might be used
-     * to customize further the resolution.
-     * 
-     * @param artifacts the project's artifacts
-     * @throws EarPluginException if the artifact could not be resolved
-     * @throws MojoFailureException if an unexpected error occurred
-     */
-    void resolveArtifact( Set<Artifact> artifacts )
-        throws EarPluginException, MojoFailureException;
-
-    /**
-     * @param earExecutionContext The execution context.
-     */
-    void setEarExecutionContext( EarExecutionContext earExecutionContext );
-
-    /**
-     * @return the state if manifest classpath will be changed or not.
-     */
-    boolean changeManifestClasspath();
-
-    /**
-     * @return The libDir.
-     */
-    String getLibDir();
-
-}
+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 ear module interface.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: EarModule.java 1645331 2014-12-13 17:31:09Z khmarbaise $

+ */

+public interface EarModule

+{

+

+    /**

+     * Returns the {@link Artifact} representing this module.

+     * <p/>

+     * Note that this might return <tt>null</tt> till the module has been resolved.

+     * 

+     * @return the artifact

+     * @see #resolveArtifact(java.util.Set)

+     */

+    Artifact getArtifact();

+

+    /**

+     * Returns the <tt>URI</tt> for this module.

+     * 

+     * @return the <tt>URI</tt>

+     */

+    String getUri();

+

+    /**

+     * Returns the type associated to the module.

+     * 

+     * @return the artifact's type of the module

+     */

+    String getType();

+

+    /**

+     * Specify whether this module should be excluded or not.

+     * 

+     * @return true if this module should be skipped, false otherwise

+     */

+    boolean isExcluded();

+

+    /**

+     * Specify whether this module should be unpacked in the EAR archive or not.

+     * <p/>

+     * Returns null if no configuration was specified so that defaulting may apply.

+     * 

+     * @return true if this module should be bundled unpacked, false otherwise

+     */

+    Boolean shouldUnpack();

+

+    /**

+     * The alt-dd element specifies an optional URI to the post-assembly version of the deployment descriptor file for a

+     * particular Java EE module. The URI must specify the full pathname of the deployment descriptor file relative to

+     * the application's root directory.

+     * 

+     * @return the alternative deployment descriptor for this module

+     * @since JavaEE 5

+     */

+    String getAltDeploymentDescriptor();

+

+    /**

+     * Appends the <tt>XML</tt> representation of this module.

+     * 

+     * @param writer the writer to use

+     * @param version the version of the <tt>application.xml</tt> file

+     * @param generateId whether an id should be generated

+     */

+    void appendModule( XMLWriter writer, String version, Boolean generateId );

+

+    /**

+     * Resolves the {@link Artifact} represented by the module. Note that the {@link EarExecutionContext} might be used

+     * to customize further the resolution.

+     * 

+     * @param artifacts the project's artifacts

+     * @throws EarPluginException if the artifact could not be resolved

+     * @throws MojoFailureException if an unexpected error occurred

+     */

+    void resolveArtifact( Set<Artifact> artifacts )

+        throws EarPluginException, MojoFailureException;

+

+    /**

+     * @param earExecutionContext The execution context.

+     */

+    void setEarExecutionContext( EarExecutionContext earExecutionContext );

+

+    /**

+     * @return the state if manifest classpath will be changed or not.

+     */

+    boolean changeManifestClasspath();

+

+    /**

+     * @return The libDir.

+     */

+    String getLibDir();

+

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/EarModuleFactory.java b/src/main/java/org/apache/maven/plugins/ear/EarModuleFactory.java
similarity index 93%
rename from src/main/java/org/apache/maven/plugin/ear/EarModuleFactory.java
rename to src/main/java/org/apache/maven/plugins/ear/EarModuleFactory.java
index 1fe4237..91e2af4 100644
--- a/src/main/java/org/apache/maven/plugin/ear/EarModuleFactory.java
+++ b/src/main/java/org/apache/maven/plugins/ear/EarModuleFactory.java
@@ -1,164 +1,164 @@
-package org.apache.maven.plugin.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.ear.util.ArtifactTypeMappingService;
-import org.apache.maven.plugin.ear.util.JavaEEVersion;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Builds an {@link EarModule} based on an <tt>Artifact</tt>.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public final class EarModuleFactory
-{
-    /**
-     * The list of artifact types.
-     */
-    public static final List<String> STANDARD_ARTIFACT_TYPE;
-
-    static
-    {
-        List<String> temp = new ArrayList<String>();
-        temp.add( "jar" );
-        temp.add( "ejb" );
-        temp.add( "par" );
-        temp.add( "ejb-client" );
-        temp.add( "app-client" );
-        temp.add( "rar" );
-        temp.add( "war" );
-        temp.add( "sar" );
-        temp.add( "wsr" );
-        temp.add( "har" );
-        STANDARD_ARTIFACT_TYPE = Collections.unmodifiableList( temp );
-    }
-
-    /**
-     * Creates a new {@link EarModule} based on the specified {@link Artifact} and the specified execution
-     * configuration.
-     * 
-     * @param artifact the artifact
-     * @param javaEEVersion the javaEE version to use
-     * @param defaultLibBundleDir the default bundle dir for {@link org.apache.maven.plugin.ear.JarModule}
-     * @param includeInApplicationXml should {@link org.apache.maven.plugin.ear.JarModule} be included in application
-     *            Xml
-     * @param typeMappingService The artifact type mapping service
-     * @return an ear module for this artifact
-     * @throws UnknownArtifactTypeException if the artifact is not handled
-     */
-    // CHECKSTYLE_OFF: LineLength
-    public static EarModule newEarModule( Artifact artifact, JavaEEVersion javaEEVersion, String defaultLibBundleDir,
-                                          Boolean includeInApplicationXml, ArtifactTypeMappingService typeMappingService )
-    // CHECKSTYLE_ON: LineLength
-        throws UnknownArtifactTypeException
-    {
-        // Get the standard artifact type based on default config and user-defined mapping(s)
-        final String artifactType;
-        try
-        {
-            artifactType = typeMappingService.getStandardType( artifact.getType() );
-        }
-        catch ( UnknownArtifactTypeException e )
-        {
-            throw new UnknownArtifactTypeException( e.getMessage() + " for " + artifact.getArtifactId() );
-        }
-
-        if ( "jar".equals( artifactType ) )
-        {
-            return new JarModule( artifact, defaultLibBundleDir, includeInApplicationXml );
-        }
-        else if ( "ejb".equals( artifactType ) )
-        {
-            return new EjbModule( artifact );
-        }
-        else if ( "par".equals( artifactType ) )
-        {
-            return new ParModule( artifact );
-        }
-        else if ( "ejb-client".equals( artifactType ) )
-        {
-            // Somewhat weird way to tackle the problem described in MEAR-85
-            if ( javaEEVersion.le( JavaEEVersion.ONE_DOT_FOUR ) )
-            {
-                return new EjbClientModule( artifact, null );
-            }
-            else
-            {
-                return new EjbClientModule( artifact, defaultLibBundleDir );
-            }
-        }
-        else if ( "app-client".equals( artifactType ) )
-        {
-            return new AppClientModule( artifact );
-        }
-        else if ( "rar".equals( artifactType ) )
-        {
-            return new RarModule( artifact );
-        }
-        else if ( "war".equals( artifactType ) )
-        {
-            return new WebModule( artifact );
-        }
-        else if ( "sar".equals( artifactType ) )
-        {
-            return new SarModule( artifact );
-        }
-        else if ( "wsr".equals( artifactType ) )
-        {
-            return new WsrModule( artifact );
-        }
-        else if ( "har".equals( artifactType ) )
-        {
-            return new HarModule( artifact );
-        }
-        else
-        {
-            throw new IllegalStateException( "Could not handle artifact type[" + artifactType + "]" );
-        }
-    }
-
-    /**
-     * Returns a list of standard artifact types.
-     * 
-     * @return the standard artifact types
-     */
-    public static List<String> getStandardArtifactTypes()
-    {
-        return STANDARD_ARTIFACT_TYPE;
-    }
-
-    /**
-     * Specify whether the specified type is standard artifact type.
-     * 
-     * @param type the type to check
-     * @return true if the specified type is a standard artifact type
-     */
-    public static boolean isStandardArtifactType( final String type )
-    {
-        return STANDARD_ARTIFACT_TYPE.contains( type );
-    }
-
-}
+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.plugins.ear.util.ArtifactTypeMappingService;

+import org.apache.maven.plugins.ear.util.JavaEEVersion;

+

+import java.util.ArrayList;

+import java.util.Collections;

+import java.util.List;

+

+/**

+ * Builds an {@link EarModule} based on an <tt>Artifact</tt>.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: EarModuleFactory.java 1755538 2016-08-08 20:32:12Z rfscholte $

+ */

+public final class EarModuleFactory

+{

+    /**

+     * The list of artifact types.

+     */

+    public static final List<String> STANDARD_ARTIFACT_TYPE;

+

+    static

+    {

+        List<String> temp = new ArrayList<String>();

+        temp.add( "jar" );

+        temp.add( "ejb" );

+        temp.add( "par" );

+        temp.add( "ejb-client" );

+        temp.add( "app-client" );

+        temp.add( "rar" );

+        temp.add( "war" );

+        temp.add( "sar" );

+        temp.add( "wsr" );

+        temp.add( "har" );

+        STANDARD_ARTIFACT_TYPE = Collections.unmodifiableList( temp );

+    }

+

+    /**

+     * Creates a new {@link EarModule} based on the specified {@link Artifact} and the specified execution

+     * configuration.

+     * 

+     * @param artifact the artifact

+     * @param javaEEVersion the javaEE version to use

+     * @param defaultLibBundleDir the default bundle dir for {@link org.apache.maven.plugins.ear.JarModule}

+     * @param includeInApplicationXml should {@link org.apache.maven.plugins.ear.JarModule} be included in application

+     *            Xml

+     * @param typeMappingService The artifact type mapping service

+     * @return an ear module for this artifact

+     * @throws UnknownArtifactTypeException if the artifact is not handled

+     */

+    // CHECKSTYLE_OFF: LineLength

+    public static EarModule newEarModule( Artifact artifact, JavaEEVersion javaEEVersion, String defaultLibBundleDir,

+                                          Boolean includeInApplicationXml, ArtifactTypeMappingService typeMappingService )

+    // CHECKSTYLE_ON: LineLength

+        throws UnknownArtifactTypeException

+    {

+        // Get the standard artifact type based on default config and user-defined mapping(s)

+        final String artifactType;

+        try

+        {

+            artifactType = typeMappingService.getStandardType( artifact.getType() );

+        }

+        catch ( UnknownArtifactTypeException e )

+        {

+            throw new UnknownArtifactTypeException( e.getMessage() + " for " + artifact.getArtifactId() );

+        }

+

+        if ( "jar".equals( artifactType ) )

+        {

+            return new JarModule( artifact, defaultLibBundleDir, includeInApplicationXml );

+        }

+        else if ( "ejb".equals( artifactType ) )

+        {

+            return new EjbModule( artifact );

+        }

+        else if ( "par".equals( artifactType ) )

+        {

+            return new ParModule( artifact );

+        }

+        else if ( "ejb-client".equals( artifactType ) )

+        {

+            // Somewhat weird way to tackle the problem described in MEAR-85

+            if ( javaEEVersion.le( JavaEEVersion.ONE_DOT_FOUR ) )

+            {

+                return new EjbClientModule( artifact, null );

+            }

+            else

+            {

+                return new EjbClientModule( artifact, defaultLibBundleDir );

+            }

+        }

+        else if ( "app-client".equals( artifactType ) )

+        {

+            return new AppClientModule( artifact );

+        }

+        else if ( "rar".equals( artifactType ) )

+        {

+            return new RarModule( artifact );

+        }

+        else if ( "war".equals( artifactType ) )

+        {

+            return new WebModule( artifact );

+        }

+        else if ( "sar".equals( artifactType ) )

+        {

+            return new SarModule( artifact );

+        }

+        else if ( "wsr".equals( artifactType ) )

+        {

+            return new WsrModule( artifact );

+        }

+        else if ( "har".equals( artifactType ) )

+        {

+            return new HarModule( artifact );

+        }

+        else

+        {

+            throw new IllegalStateException( "Could not handle artifact type[" + artifactType + "]" );

+        }

+    }

+

+    /**

+     * Returns a list of standard artifact types.

+     * 

+     * @return the standard artifact types

+     */

+    public static List<String> getStandardArtifactTypes()

+    {

+        return STANDARD_ARTIFACT_TYPE;

+    }

+

+    /**

+     * Specify whether the specified type is standard artifact type.

+     * 

+     * @param type the type to check

+     * @return true if the specified type is a standard artifact type

+     */

+    public static boolean isStandardArtifactType( final String type )

+    {

+        return STANDARD_ARTIFACT_TYPE.contains( type );

+    }

+

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/EarMojo.java b/src/main/java/org/apache/maven/plugins/ear/EarMojo.java
similarity index 98%
rename from src/main/java/org/apache/maven/plugin/ear/EarMojo.java
rename to src/main/java/org/apache/maven/plugins/ear/EarMojo.java
index c804d53..6ce69e6 100644
--- a/src/main/java/org/apache/maven/plugin/ear/EarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/ear/EarMojo.java
@@ -1,891 +1,891 @@
-package org.apache.maven.plugin.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 java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.zip.ZipException;
-
-import org.apache.maven.archiver.MavenArchiveConfiguration;
-import org.apache.maven.archiver.MavenArchiver;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.ear.util.EarMavenArchiver;
-import org.apache.maven.plugin.ear.util.JavaEEVersion;
-import org.apache.maven.plugin.ear.util.ModuleIdentifierValidator;
-import org.apache.maven.plugins.annotations.Component;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.apache.maven.project.MavenProjectHelper;
-import org.apache.maven.shared.filtering.MavenFileFilter;
-import org.apache.maven.shared.filtering.MavenFilteringException;
-import org.apache.maven.shared.filtering.MavenResourcesExecution;
-import org.apache.maven.shared.filtering.MavenResourcesFiltering;
-import org.apache.maven.shared.utils.io.FileUtils;
-import org.codehaus.plexus.archiver.Archiver;
-import org.codehaus.plexus.archiver.ArchiverException;
-import org.codehaus.plexus.archiver.UnArchiver;
-import org.codehaus.plexus.archiver.jar.JarArchiver;
-import org.codehaus.plexus.archiver.jar.Manifest;
-import org.codehaus.plexus.archiver.jar.Manifest.Attribute;
-import org.codehaus.plexus.archiver.jar.ManifestException;
-import org.codehaus.plexus.archiver.manager.ArchiverManager;
-import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
-import org.codehaus.plexus.archiver.zip.ZipArchiver;
-import org.codehaus.plexus.archiver.zip.ZipUnArchiver;
-import org.codehaus.plexus.util.DirectoryScanner;
-import org.codehaus.plexus.util.StringUtils;
-
-/**
- * Builds J2EE Enterprise Archive (EAR) files.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-// CHECKSTYLE_OFF: LineLength
-@Mojo( name = "ear", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true, requiresDependencyResolution = ResolutionScope.TEST )
-// CHECKSTYLE_ON: LineLength
-public class EarMojo
-    extends AbstractEarMojo
-{
-    /**
-     * Single directory for extra files to include in the EAR.
-     */
-    @Parameter( defaultValue = "${basedir}/src/main/application", required = true )
-    private File earSourceDirectory;
-
-    /**
-     * The comma separated list of tokens to include in the EAR.
-     */
-    @Parameter( alias = "includes", defaultValue = "**" )
-    private String earSourceIncludes;
-
-    /**
-     * The comma separated list of tokens to exclude from the EAR.
-     */
-    @Parameter( alias = "excludes" )
-    private String earSourceExcludes;
-
-    /**
-     * Specify that the EAR sources should be filtered.
-     * 
-     * @since 2.3.2
-     */
-    @Parameter( defaultValue = "false" )
-    private boolean filtering;
-
-    /**
-     * Filters (property files) to include during the interpolation of the pom.xml.
-     * 
-     * @since 2.3.2
-     */
-    @Parameter
-    private List<String> filters;
-
-    /**
-     * A list of file extensions that should not be filtered if filtering is enabled.
-     * 
-     * @since 2.3.2
-     */
-    @Parameter
-    private List<String> nonFilteredFileExtensions;
-
-    /**
-     * To escape interpolated value with Windows path c:\foo\bar will be replaced with c:\\foo\\bar.
-     * 
-     * @since 2.3.2
-     */
-    @Parameter( property = "maven.ear.escapedBackslashesInFilePath", defaultValue = "false" )
-    private boolean escapedBackslashesInFilePath;
-
-    /**
-     * Expression preceded with this String won't be interpolated \${foo} will be replaced with ${foo}.
-     * 
-     * @since 2.3.2
-     */
-    @Parameter( property = "maven.ear.escapeString" )
-    protected String escapeString;
-
-    /**
-     * In case of using the {@link #skinnyWars} and {@link #defaultLibBundleDir} usually the
-     * classpath will be modified.
-     * By settings this option {@code true} you can change this and keep the classpath untouched.
-     * This option has been introduced to keep the backward compatibility with earlier versions
-     * of the plugin.
-     * 
-     * @since 2.10
-     */
-    @Parameter( defaultValue = "false" )
-    private boolean skipClassPathModification;
-
-    /**
-     * The location of the manifest file to be used within the EAR file. If no value if specified, the default location
-     * in the workDirectory is taken. If the file does not exist, a manifest will be generated automatically.
-     */
-    @Parameter
-    private File manifestFile;
-
-    /**
-     * The location of a custom application.xml file to be used within the EAR file.
-     */
-    @Parameter
-    private String applicationXml;
-
-    /**
-     * The directory for the generated EAR.
-     */
-    @Parameter( defaultValue = "${project.build.directory}", required = true )
-    private String outputDirectory;
-
-    /**
-     * The name of the EAR file to generate.
-     */
-    @Parameter( alias = "earName", defaultValue = "${project.build.finalName}", required = true )
-    private String finalName;
-
-    /**
-     * The comma separated list of artifact's type(s) to unpack by default.
-     */
-    @Parameter
-    private String unpackTypes;
-
-    /**
-     * Classifier to add to the artifact generated. If given, the artifact will be an attachment instead.
-     */
-    @Parameter
-    private String classifier;
-
-    /**
-     * A comma separated list of tokens to exclude when packaging the EAR. By default nothing is excluded. Note that you
-     * can use the Java Regular Expressions engine to include and exclude specific pattern using the expression
-     * %regex[]. Hint: read the about (?!Pattern).
-     * 
-     * @since 2.7
-     */
-    @Parameter
-    private String packagingExcludes;
-
-    /**
-     * A comma separated list of tokens to include when packaging the EAR. By default everything is included. Note that
-     * you can use the Java Regular Expressions engine to include and exclude specific pattern using the expression
-     * %regex[].
-     * 
-     * @since 2.7
-     */
-    @Parameter
-    private String packagingIncludes;
-
-    /**
-     * Whether to create skinny WARs or not. A skinny WAR is a WAR that does not have all of its dependencies in
-     * WEB-INF/lib. Instead those dependencies are shared between the WARs through the EAR.
-     * 
-     * @since 2.7
-     */
-    @Parameter( property = "maven.ear.skinnyWars", defaultValue = "false" )
-    private boolean skinnyWars;
-
-    /**
-     * The Jar archiver.
-     */
-    @Component( role = Archiver.class, hint = "jar" )
-    private JarArchiver jarArchiver;
-
-    /**
-     * The Zip archiver.
-     */
-    @Component( role = Archiver.class, hint = "zip" )
-    private ZipArchiver zipArchiver;
-
-    /**
-     * The Zip Un archiver.
-     */
-    @Component( role = UnArchiver.class, hint = "zip" )
-    private ZipUnArchiver zipUnArchiver;
-
-    /**
-     * The archive configuration to use. See <a href="http://maven.apache.org/shared/maven-archiver/index.html">Maven
-     * Archiver Reference</a>.
-     */
-    @Parameter
-    private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
-
-    /**
-     */
-    @Component
-    private MavenProjectHelper projectHelper;
-
-    /**
-     * The archive manager.
-     */
-    @Component
-    private ArchiverManager archiverManager;
-
-    /**
-     */
-    @Component( role = MavenFileFilter.class, hint = "default" )
-    private MavenFileFilter mavenFileFilter;
-
-    /**
-     */
-    @Component( role = MavenResourcesFiltering.class, hint = "default" )
-    private MavenResourcesFiltering mavenResourcesFiltering;
-
-    /**
-     * @since 2.3.2
-     */
-    @Parameter( defaultValue = "${session}", readonly = true, required = true )
-    private MavenSession session;
-
-    private List<FileUtils.FilterWrapper> filterWrappers;
-
-    /**
-     * @since 2.9
-     */
-    @Parameter( property = "maven.ear.useJvmChmod", defaultValue = "true" )
-    private boolean useJvmChmod = true;
-
-    /**
-     * The list of artifacts is checked and if you set this to {@code true} the build will fail if duplicate artifacts
-     * have been found within the build configuration.
-     * 
-     * @since 2.10
-     */
-    // TODO: This can be removed if we change to full unique identifiers in EAR (next major version!)
-    @Parameter( defaultValue = "false", property = "maven.ear.duplicateArtifactsBreakTheBuild" )
-    private boolean duplicateArtifactsBreakTheBuild;
-
-    private void checkModuleUniqueness()
-        throws MojoExecutionException
-    {
-        ModuleIdentifierValidator miv = new ModuleIdentifierValidator( getModules() );
-        miv.checkForDuplicateArtifacts();
-        if ( miv.existDuplicateArtifacts() )
-        {
-            Map<String, List<EarModule>> duplicateArtifacts = miv.getDuplicateArtifacts();
-            for ( Entry<String, List<EarModule>> entry : duplicateArtifacts.entrySet() )
-            {
-                getLog().warn( "The artifactId " + entry.getKey() + " exists more than once in the modules list." );
-                for ( EarModule earModule : entry.getValue() )
-                {
-                    getLog().warn( " --> " + earModule.getArtifact().getId() + " (" + earModule.getType() + ")" );
-                }
-            }
-
-            getLog().warn( "HINT: This can be simply solved by using the <fileNameMapping>full</fileNameMapping>" );
-
-            if ( duplicateArtifactsBreakTheBuild )
-            {
-                // CHECKSTYLE_OFF: LineLength
-                throw new MojoExecutionException(
-                                                  "The build contains duplicate artifacts which result in unpredictable ear content." );
-                // CHECKSTYLE_ON: LineLength
-            }
-        }
-
-    }
-
-    /** {@inheritDoc} */
-    public void execute()
-        throws MojoExecutionException, MojoFailureException
-    {
-        // Initializes ear modules
-        super.execute();
-
-        zipArchiver.setUseJvmChmod( useJvmChmod );
-        zipUnArchiver.setUseJvmChmod( useJvmChmod );
-
-        final JavaEEVersion javaEEVersion = JavaEEVersion.getJavaEEVersion( version );
-
-        // Initializes unpack types
-        List<String> unpackTypesList = createUnpackList();
-
-        // Copy modules
-        copyModules( javaEEVersion, unpackTypesList );
-
-        // Copy source files
-        try
-        {
-            File earSourceDir = earSourceDirectory;
-            if ( earSourceDir.exists() )
-            {
-                getLog().info( "Copy ear sources to " + getWorkDirectory().getAbsolutePath() );
-                String[] fileNames = getEarFiles( earSourceDir );
-                for ( String fileName : fileNames )
-                {
-                    copyFile( new File( earSourceDir, fileName ), new File( getWorkDirectory(), fileName ) );
-                }
-            }
-
-            if ( applicationXml != null && !"".equals( applicationXml ) )
-            {
-                // rename to application.xml
-                getLog().info( "Including custom application.xml[" + applicationXml + "]" );
-                File metaInfDir = new File( getWorkDirectory(), META_INF );
-                copyFile( new File( applicationXml ), new File( metaInfDir, "/application.xml" ) );
-            }
-
-        }
-        catch ( IOException e )
-        {
-            throw new MojoExecutionException( "Error copying EAR sources", e );
-        }
-        catch ( MavenFilteringException e )
-        {
-            throw new MojoExecutionException( "Error filtering EAR sources", e );
-        }
-
-        // Check if deployment descriptor is there
-        File ddFile = new File( getWorkDirectory(), APPLICATION_XML_URI );
-        if ( !ddFile.exists() && ( javaEEVersion.lt( JavaEEVersion.FIVE ) ) )
-        {
-            // CHECKSTYLE_OFF: LineLength
-            throw new MojoExecutionException( "Deployment descriptor: " + ddFile.getAbsolutePath() + " does not exist." );
-            // CHECKSTYLE_ON: LineLength
-        }
-
-        try
-        {
-            File earFile = getEarFile( outputDirectory, finalName, classifier );
-            final MavenArchiver archiver = new EarMavenArchiver( getModules() );
-            final JarArchiver theJarArchiver = getJarArchiver();
-            getLog().debug( "Jar archiver implementation [" + theJarArchiver.getClass().getName() + "]" );
-            archiver.setArchiver( theJarArchiver );
-            archiver.setOutputFile( earFile );
-
-            // Include custom manifest if necessary
-            includeCustomManifestFile();
-
-            getLog().debug( "Excluding " + Arrays.asList( getPackagingExcludes() ) + " from the generated EAR." );
-            getLog().debug( "Including " + Arrays.asList( getPackagingIncludes() ) + " in the generated EAR." );
-
-            archiver.getArchiver().addDirectory( getWorkDirectory(), getPackagingIncludes(), getPackagingExcludes() );
-            archiver.createArchive( session, getProject(), archive );
-
-            if ( classifier != null )
-            {
-                projectHelper.attachArtifact( getProject(), "ear", classifier, earFile );
-            }
-            else
-            {
-                getProject().getArtifact().setFile( earFile );
-            }
-        }
-        catch ( Exception e )
-        {
-            throw new MojoExecutionException( "Error assembling EAR", e );
-        }
-    }
-
-    private void copyModules( final JavaEEVersion javaEEVersion, List<String> unpackTypesList )
-        throws MojoExecutionException, MojoFailureException
-    {
-        try
-        {
-            // TODO: With the next major release the modules
-            // should be identified by a unique id instead of the
-            // the artifactId's only which means this
-            // check can be removed.
-            // http://jira.codehaus.org/browse/MEAR-209
-            checkModuleUniqueness();
-
-            for ( EarModule module : getModules() )
-            {
-                final File sourceFile = module.getArtifact().getFile();
-                final File destinationFile = buildDestinationFile( getWorkDirectory(), module.getUri() );
-                if ( !sourceFile.isFile() )
-                {
-                    throw new MojoExecutionException( "Cannot copy a directory: " + sourceFile.getAbsolutePath()
-                        + "; Did you package/install " + module.getArtifact() + "?" );
-                }
-
-                if ( destinationFile.getCanonicalPath().equals( sourceFile.getCanonicalPath() ) )
-                {
-                    getLog().info( "Skipping artifact [" + module + "], as it already exists at [" + module.getUri()
-                                       + "]" );
-                    continue;
-                }
-
-                // If the module is within the unpack list, make sure that no unpack wasn't forced (null or true)
-                // If the module is not in the unpack list, it should be true
-                // CHECKSTYLE_OFF: LineLength
-                if ( ( unpackTypesList.contains( module.getType() ) && ( module.shouldUnpack() == null || module.shouldUnpack() ) )
-                    || ( module.shouldUnpack() != null && module.shouldUnpack() ) )
-                // CHECKSTYLE_ON: LineLength
-                {
-                    getLog().info( "Copying artifact [" + module + "] to [" + module.getUri() + "] (unpacked)" );
-                    // Make sure that the destination is a directory to avoid plexus nasty stuff :)
-                    destinationFile.mkdirs();
-                    unpack( sourceFile, destinationFile );
-
-                    if ( skinnyWars && module.changeManifestClasspath() )
-                    {
-                        changeManifestClasspath( module, destinationFile, javaEEVersion );
-                    }
-                }
-                else
-                {
-                    if ( sourceFile.lastModified() > destinationFile.lastModified() )
-                    {
-                        getLog().info( "Copying artifact [" + module + "] to [" + module.getUri() + "]" );
-                        FileUtils.copyFile( sourceFile, destinationFile );
-
-                        if ( skinnyWars && module.changeManifestClasspath() )
-                        {
-                            changeManifestClasspath( module, destinationFile, javaEEVersion );
-                        }
-                    }
-                    else
-                    {
-                        getLog().debug( "Skipping artifact [" + module + "], as it is already up to date at ["
-                                            + module.getUri() + "]" );
-                    }
-                }
-            }
-        }
-        catch ( IOException e )
-        {
-            throw new MojoExecutionException( "Error copying EAR modules", e );
-        }
-        catch ( ArchiverException e )
-        {
-            throw new MojoExecutionException( "Error unpacking EAR modules", e );
-        }
-        catch ( NoSuchArchiverException e )
-        {
-            throw new MojoExecutionException( "No Archiver found for EAR modules", e );
-        }
-    }
-
-    private List<String> createUnpackList()
-        throws MojoExecutionException
-    {
-        List<String> unpackTypesList = new ArrayList<String>();
-        if ( unpackTypes != null )
-        {
-            unpackTypesList = Arrays.asList( unpackTypes.split( "," ) );
-            for ( String type : unpackTypesList )
-            {
-                if ( !EarModuleFactory.STANDARD_ARTIFACT_TYPE.contains( type ) )
-                {
-                    throw new MojoExecutionException( "Invalid type [" + type + "] supported types are "
-                        + EarModuleFactory.STANDARD_ARTIFACT_TYPE );
-                }
-            }
-            getLog().debug( "Initialized unpack types " + unpackTypesList );
-        }
-        return unpackTypesList;
-    }
-
-    /**
-     * @return {@link #applicationXml}
-     */
-    public String getApplicationXml()
-    {
-        return applicationXml;
-    }
-
-    /**
-     * @param applicationXml {@link #applicationXml}
-     */
-    public void setApplicationXml( String applicationXml )
-    {
-        this.applicationXml = applicationXml;
-    }
-
-    /**
-     * Returns a string array of the excludes to be used when assembling/copying the ear.
-     * 
-     * @return an array of tokens to exclude
-     */
-    protected String[] getExcludes()
-    {
-        List<String> excludeList = new ArrayList<String>( FileUtils.getDefaultExcludesAsList() );
-        if ( earSourceExcludes != null && !"".equals( earSourceExcludes ) )
-        {
-            excludeList.addAll( Arrays.asList( StringUtils.split( earSourceExcludes, "," ) ) );
-        }
-
-        // if applicationXml is specified, omit the one in the source directory
-        if ( getApplicationXml() != null && !"".equals( getApplicationXml() ) )
-        {
-            excludeList.add( "**/" + META_INF + "/application.xml" );
-        }
-
-        return excludeList.toArray( new String[excludeList.size()] );
-    }
-
-    /**
-     * Returns a string array of the includes to be used when assembling/copying the ear.
-     * 
-     * @return an array of tokens to include
-     */
-    protected String[] getIncludes()
-    {
-        return StringUtils.split( StringUtils.defaultString( earSourceIncludes ), "," );
-    }
-
-    /**
-     * @return The array with the packaging excludes.
-     */
-    public String[] getPackagingExcludes()
-    {
-        if ( StringUtils.isEmpty( packagingExcludes ) )
-        {
-            return new String[0];
-        }
-        else
-        {
-            return StringUtils.split( packagingExcludes, "," );
-        }
-    }
-
-    /**
-     * @param packagingExcludes {@link #packagingExcludes}
-     */
-    public void setPackagingExcludes( String packagingExcludes )
-    {
-        this.packagingExcludes = packagingExcludes;
-    }
-
-    /**
-     * @return The arrays with the includes.
-     */
-    public String[] getPackagingIncludes()
-    {
-        if ( StringUtils.isEmpty( packagingIncludes ) )
-        {
-            return new String[] { "**" };
-        }
-        else
-        {
-            return StringUtils.split( packagingIncludes, "," );
-        }
-    }
-
-    /**
-     * @param packagingIncludes {@link #packagingIncludes}
-     */
-    public void setPackagingIncludes( String packagingIncludes )
-    {
-        this.packagingIncludes = packagingIncludes;
-    }
-
-    private static File buildDestinationFile( File buildDir, String uri )
-    {
-        return new File( buildDir, uri );
-    }
-
-    private void includeCustomManifestFile()
-    {
-        if ( manifestFile == null )
-        {
-            manifestFile = new File( getWorkDirectory(), "META-INF/MANIFEST.MF" );
-        }
-
-        if ( !manifestFile.exists() )
-        {
-            getLog().info( "Could not find manifest file: " + manifestFile + " - Generating one" );
-        }
-        else
-        {
-            getLog().info( "Including custom manifest file [" + manifestFile + "]" );
-            archive.setManifestFile( manifestFile );
-        }
-    }
-
-    /**
-     * Returns the EAR file to generate, based on an optional classifier.
-     * 
-     * @param basedir the output directory
-     * @param finalName the name of the ear file
-     * @param classifier an optional classifier
-     * @return the EAR file to generate
-     */
-    private static File getEarFile( String basedir, String finalName, String classifier )
-    {
-        if ( classifier == null )
-        {
-            classifier = "";
-        }
-        else if ( classifier.trim().length() > 0 && !classifier.startsWith( "-" ) )
-        {
-            classifier = "-" + classifier;
-        }
-
-        return new File( basedir, finalName + classifier + ".ear" );
-    }
-
-    /**
-     * Returns a list of filenames that should be copied over to the destination directory.
-     * 
-     * @param sourceDir the directory to be scanned
-     * @return the array of filenames, relative to the sourceDir
-     */
-    private String[] getEarFiles( File sourceDir )
-    {
-        DirectoryScanner scanner = new DirectoryScanner();
-        scanner.setBasedir( sourceDir );
-        scanner.setExcludes( getExcludes() );
-        scanner.addDefaultExcludes();
-
-        scanner.setIncludes( getIncludes() );
-
-        scanner.scan();
-
-        return scanner.getIncludedFiles();
-    }
-
-    /**
-     * Unpacks the module into the EAR structure.
-     * 
-     * @param source File to be unpacked.
-     * @param destDir Location where to put the unpacked files.
-     * @throws NoSuchArchiverException In case of we don't have an appropriate archiver.
-     * @throws IOException In case of a general IOException.
-     */
-    public void unpack( File source, File destDir )
-        throws NoSuchArchiverException, IOException
-    {
-        UnArchiver unArchiver = archiverManager.getUnArchiver( "zip" );
-        unArchiver.setSourceFile( source );
-        unArchiver.setDestDirectory( destDir );
-
-        // Extract the module
-        unArchiver.extract();
-    }
-
-    /**
-     * Returns the {@link JarArchiver} implementation used to package the EAR file.
-     * <p/>
-     * By default the archiver is obtained from the Plexus container.
-     * 
-     * @return the archiver
-     */
-    protected JarArchiver getJarArchiver()
-    {
-        return jarArchiver;
-    }
-
-    private void copyFile( File source, File target )
-        throws MavenFilteringException, IOException, MojoExecutionException
-    {
-        if ( filtering && !isNonFilteredExtension( source.getName() ) )
-        {
-            // Silly that we have to do this ourselves
-            if ( target.getParentFile() != null && !target.getParentFile().exists() )
-            {
-                target.getParentFile().mkdirs();
-            }
-
-            mavenFileFilter.copyFile( source, target, true, getFilterWrappers(), encoding );
-        }
-        else
-        {
-            FileUtils.copyFile( source, target );
-        }
-    }
-
-    /**
-     * @param fileName The name of the file which should be checked.
-     * @return {@code true} if the name is part of the non filtered extensions {@code false} otherwise.
-     */
-    public boolean isNonFilteredExtension( String fileName )
-    {
-        return !mavenResourcesFiltering.filteredFileExtension( fileName, nonFilteredFileExtensions );
-    }
-
-    private List<FileUtils.FilterWrapper> getFilterWrappers()
-        throws MojoExecutionException
-    {
-        if ( filterWrappers == null )
-        {
-            try
-            {
-                MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution();
-                mavenResourcesExecution.setMavenProject( getProject() );
-                mavenResourcesExecution.setEscapedBackslashesInFilePath( escapedBackslashesInFilePath );
-                mavenResourcesExecution.setFilters( filters );
-                mavenResourcesExecution.setEscapeString( escapeString );
-
-                filterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenResourcesExecution );
-            }
-            catch ( MavenFilteringException e )
-            {
-                getLog().error( "Fail to build filtering wrappers " + e.getMessage() );
-                throw new MojoExecutionException( e.getMessage(), e );
-            }
-        }
-        return filterWrappers;
-    }
-
-    private void changeManifestClasspath( EarModule module, File original, JavaEEVersion javaEEVersion )
-        throws MojoFailureException
-    {
-        try
-        {
-            File workDirectory;
-
-            // Handle the case that the destination might be a directory (project-038)
-            if ( original.isFile() )
-            {
-                // Create a temporary work directory
-                // MEAR-167 use uri as directory to prevent merging of artifacts with the same artifactId
-                workDirectory = new File( new File( getTempFolder(), "temp" ), module.getUri() );
-                workDirectory.mkdirs();
-                getLog().debug( "Created a temporary work directory: " + workDirectory.getAbsolutePath() );
-
-                // Unpack the archive to a temporary work directory
-                zipUnArchiver.setSourceFile( original );
-                zipUnArchiver.setDestDirectory( workDirectory );
-                zipUnArchiver.extract();
-            }
-            else
-            {
-                workDirectory = original;
-            }
-
-            // Create a META-INF/MANIFEST.MF file if it doesn't exist (project-038)
-            File metaInfDirectory = new File( workDirectory, "META-INF" );
-            boolean newMetaInfCreated = metaInfDirectory.mkdirs();
-            if ( newMetaInfCreated )
-            {
-                // CHECKSTYLE_OFF: LineLength
-                getLog().debug( "This project did not have a META-INF directory before, so a new directory was created." );
-                // CHECKSTYLE_ON: LineLength
-            }
-            File newCreatedManifestFile = new File( metaInfDirectory, "MANIFEST.MF" );
-            boolean newManifestCreated = newCreatedManifestFile.createNewFile();
-            if ( newManifestCreated )
-            {
-                // CHECKSTYLE_OFF: LineLength
-                getLog().debug( "This project did not have a META-INF/MANIFEST.MF file before, so a new file was created." );
-                // CHECKSTYLE_ON: LineLength
-            }
-
-            // Read the manifest from disk
-            Manifest mf = new Manifest( new FileInputStream( newCreatedManifestFile ) );
-            Attribute classPath = mf.getMainSection().getAttribute( "Class-Path" );
-            List<String> classPathElements = new ArrayList<String>();
-
-            if ( classPath != null )
-            {
-                classPathElements.addAll( Arrays.asList( classPath.getValue().split( " " ) ) );
-            }
-            else
-            {
-                classPath = new Attribute( "Class-Path", "" );
-            }
-
-            // Modify the classpath entries in the manifest
-            for ( EarModule o : getModules() )
-            {
-                if ( o instanceof JarModule )
-                {
-                    JarModule jm = (JarModule) o;
-
-                    if ( module.getLibDir() != null )
-                    {
-                        // MEAR-189:
-                        // We use the original name, cause in case of fileNameMapping to no-version/full
-                        // we could not not delete it and it will end up in the resulting EAR and the WAR
-                        // will not be cleaned up.
-                        File artifact =
-                            new File( new File( workDirectory, module.getLibDir() ), jm.getOriginalBundleFileName() );
-
-                        if ( artifact.exists() )
-                        {
-                            getLog().debug( " -> Artifact to delete: " + artifact );
-                            if ( !artifact.delete() )
-                            {
-                                getLog().error( "Could not delete '" + artifact + "'" );
-                            }
-                        }
-                    }
-
-                    if ( classPathElements.contains( jm.getBundleFileName() ) )
-                    {
-                        classPathElements.set( classPathElements.indexOf( jm.getBundleFileName() ), jm.getUri() );
-                    }
-                    else
-                    {
-                        if ( !skipClassPathModification )
-                        {
-                            classPathElements.add( jm.getUri() );
-                        }
-                        else
-                        {
-                            if ( javaEEVersion.lt( JavaEEVersion.FIVE ) || defaultLibBundleDir == null )
-                            {
-                                classPathElements.add( jm.getUri() );
-                            }
-                        }
-                    }
-                }
-            }
-            classPath.setValue( StringUtils.join( classPathElements.iterator(), " " ) );
-            mf.getMainSection().addConfiguredAttribute( classPath );
-
-            // Write the manifest to disk
-            PrintWriter pw = new PrintWriter( newCreatedManifestFile );
-            mf.write( pw );
-            pw.close();
-
-            if ( original.isFile() )
-            {
-                // Pack up the archive again from the work directory
-                if ( !original.delete() )
-                {
-                    getLog().error( "Could not delete original artifact file " + original );
-                }
-
-                getLog().debug( "Zipping module" );
-                zipArchiver.setDestFile( original );
-                zipArchiver.addDirectory( workDirectory );
-                zipArchiver.createArchive();
-            }
-        }
-        catch ( ManifestException e )
-        {
-            throw new MojoFailureException( e.getMessage() );
-        }
-        catch ( ZipException e )
-        {
-            throw new MojoFailureException( e.getMessage() );
-        }
-        catch ( IOException e )
-        {
-            throw new MojoFailureException( e.getMessage() );
-        }
-        catch ( ArchiverException e )
-        {
-            throw new MojoFailureException( e.getMessage() );
-        }
-    }
-}
+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 java.io.File;

+import java.io.FileInputStream;

+import java.io.IOException;

+import java.io.PrintWriter;

+import java.util.ArrayList;

+import java.util.Arrays;

+import java.util.List;

+import java.util.Map;

+import java.util.Map.Entry;

+import java.util.zip.ZipException;

+

+import org.apache.maven.archiver.MavenArchiveConfiguration;

+import org.apache.maven.archiver.MavenArchiver;

+import org.apache.maven.execution.MavenSession;

+import org.apache.maven.plugin.MojoExecutionException;

+import org.apache.maven.plugin.MojoFailureException;

+import org.apache.maven.plugins.annotations.Component;

+import org.apache.maven.plugins.annotations.LifecyclePhase;

+import org.apache.maven.plugins.annotations.Mojo;

+import org.apache.maven.plugins.annotations.Parameter;

+import org.apache.maven.plugins.annotations.ResolutionScope;

+import org.apache.maven.plugins.ear.util.EarMavenArchiver;

+import org.apache.maven.plugins.ear.util.JavaEEVersion;

+import org.apache.maven.plugins.ear.util.ModuleIdentifierValidator;

+import org.apache.maven.project.MavenProjectHelper;

+import org.apache.maven.shared.filtering.MavenFileFilter;

+import org.apache.maven.shared.filtering.MavenFilteringException;

+import org.apache.maven.shared.filtering.MavenResourcesExecution;

+import org.apache.maven.shared.filtering.MavenResourcesFiltering;

+import org.apache.maven.shared.utils.io.FileUtils;

+import org.codehaus.plexus.archiver.Archiver;

+import org.codehaus.plexus.archiver.ArchiverException;

+import org.codehaus.plexus.archiver.UnArchiver;

+import org.codehaus.plexus.archiver.jar.JarArchiver;

+import org.codehaus.plexus.archiver.jar.Manifest;

+import org.codehaus.plexus.archiver.jar.Manifest.Attribute;

+import org.codehaus.plexus.archiver.jar.ManifestException;

+import org.codehaus.plexus.archiver.manager.ArchiverManager;

+import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;

+import org.codehaus.plexus.archiver.zip.ZipArchiver;

+import org.codehaus.plexus.archiver.zip.ZipUnArchiver;

+import org.codehaus.plexus.util.DirectoryScanner;

+import org.codehaus.plexus.util.StringUtils;

+

+/**

+ * Builds J2EE Enterprise Archive (EAR) files.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: EarMojo.java 1755539 2016-08-08 20:34:46Z rfscholte $

+ */

+// CHECKSTYLE_OFF: LineLength

+@Mojo( name = "ear", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true, requiresDependencyResolution = ResolutionScope.TEST )

+// CHECKSTYLE_ON: LineLength

+public class EarMojo

+    extends AbstractEarMojo

+{

+    /**

+     * Single directory for extra files to include in the EAR.

+     */

+    @Parameter( defaultValue = "${basedir}/src/main/application", required = true )

+    private File earSourceDirectory;

+

+    /**

+     * The comma separated list of tokens to include in the EAR.

+     */

+    @Parameter( alias = "includes", defaultValue = "**" )

+    private String earSourceIncludes;

+

+    /**

+     * The comma separated list of tokens to exclude from the EAR.

+     */

+    @Parameter( alias = "excludes" )

+    private String earSourceExcludes;

+

+    /**

+     * Specify that the EAR sources should be filtered.

+     * 

+     * @since 2.3.2

+     */

+    @Parameter( defaultValue = "false" )

+    private boolean filtering;

+

+    /**

+     * Filters (property files) to include during the interpolation of the pom.xml.

+     * 

+     * @since 2.3.2

+     */

+    @Parameter

+    private List<String> filters;

+

+    /**

+     * A list of file extensions that should not be filtered if filtering is enabled.

+     * 

+     * @since 2.3.2

+     */

+    @Parameter

+    private List<String> nonFilteredFileExtensions;

+

+    /**

+     * To escape interpolated value with Windows path c:\foo\bar will be replaced with c:\\foo\\bar.

+     * 

+     * @since 2.3.2

+     */

+    @Parameter( property = "maven.ear.escapedBackslashesInFilePath", defaultValue = "false" )

+    private boolean escapedBackslashesInFilePath;

+

+    /**

+     * Expression preceded with this String won't be interpolated \${foo} will be replaced with ${foo}.

+     * 

+     * @since 2.3.2

+     */

+    @Parameter( property = "maven.ear.escapeString" )

+    protected String escapeString;

+

+    /**

+     * In case of using the {@link #skinnyWars} and {@link #defaultLibBundleDir} usually the

+     * classpath will be modified.

+     * By settings this option {@code true} you can change this and keep the classpath untouched.

+     * This option has been introduced to keep the backward compatibility with earlier versions

+     * of the plugin.

+     * 

+     * @since 2.10

+     */

+    @Parameter( defaultValue = "false" )

+    private boolean skipClassPathModification;

+

+    /**

+     * The location of the manifest file to be used within the EAR file. If no value if specified, the default location

+     * in the workDirectory is taken. If the file does not exist, a manifest will be generated automatically.

+     */

+    @Parameter

+    private File manifestFile;

+

+    /**

+     * The location of a custom application.xml file to be used within the EAR file.

+     */

+    @Parameter

+    private String applicationXml;

+

+    /**

+     * The directory for the generated EAR.

+     */

+    @Parameter( defaultValue = "${project.build.directory}", required = true )

+    private String outputDirectory;

+

+    /**

+     * The name of the EAR file to generate.

+     */

+    @Parameter( alias = "earName", defaultValue = "${project.build.finalName}", required = true )

+    private String finalName;

+

+    /**

+     * The comma separated list of artifact's type(s) to unpack by default.

+     */

+    @Parameter

+    private String unpackTypes;

+

+    /**

+     * Classifier to add to the artifact generated. If given, the artifact will be an attachment instead.

+     */

+    @Parameter

+    private String classifier;

+

+    /**

+     * A comma separated list of tokens to exclude when packaging the EAR. By default nothing is excluded. Note that you

+     * can use the Java Regular Expressions engine to include and exclude specific pattern using the expression

+     * %regex[]. Hint: read the about (?!Pattern).

+     * 

+     * @since 2.7

+     */

+    @Parameter

+    private String packagingExcludes;

+

+    /**

+     * A comma separated list of tokens to include when packaging the EAR. By default everything is included. Note that

+     * you can use the Java Regular Expressions engine to include and exclude specific pattern using the expression

+     * %regex[].

+     * 

+     * @since 2.7

+     */

+    @Parameter

+    private String packagingIncludes;

+

+    /**

+     * Whether to create skinny WARs or not. A skinny WAR is a WAR that does not have all of its dependencies in

+     * WEB-INF/lib. Instead those dependencies are shared between the WARs through the EAR.

+     * 

+     * @since 2.7

+     */

+    @Parameter( property = "maven.ear.skinnyWars", defaultValue = "false" )

+    private boolean skinnyWars;

+

+    /**

+     * The Jar archiver.

+     */

+    @Component( role = Archiver.class, hint = "jar" )

+    private JarArchiver jarArchiver;

+

+    /**

+     * The Zip archiver.

+     */

+    @Component( role = Archiver.class, hint = "zip" )

+    private ZipArchiver zipArchiver;

+

+    /**

+     * The Zip Un archiver.

+     */

+    @Component( role = UnArchiver.class, hint = "zip" )

+    private ZipUnArchiver zipUnArchiver;

+

+    /**

+     * The archive configuration to use. See <a href="http://maven.apache.org/shared/maven-archiver/index.html">Maven

+     * Archiver Reference</a>.

+     */

+    @Parameter

+    private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();

+

+    /**

+     */

+    @Component

+    private MavenProjectHelper projectHelper;

+

+    /**

+     * The archive manager.

+     */

+    @Component

+    private ArchiverManager archiverManager;

+

+    /**

+     */

+    @Component( role = MavenFileFilter.class, hint = "default" )

+    private MavenFileFilter mavenFileFilter;

+

+    /**

+     */

+    @Component( role = MavenResourcesFiltering.class, hint = "default" )

+    private MavenResourcesFiltering mavenResourcesFiltering;

+

+    /**

+     * @since 2.3.2

+     */

+    @Parameter( defaultValue = "${session}", readonly = true, required = true )

+    private MavenSession session;

+

+    private List<FileUtils.FilterWrapper> filterWrappers;

+

+    /**

+     * @since 2.9

+     */

+    @Parameter( property = "maven.ear.useJvmChmod", defaultValue = "true" )

+    private boolean useJvmChmod = true;

+

+    /**

+     * The list of artifacts is checked and if you set this to {@code true} the build will fail if duplicate artifacts

+     * have been found within the build configuration.

+     * 

+     * @since 2.10

+     */

+    // TODO: This can be removed if we change to full unique identifiers in EAR (next major version!)

+    @Parameter( defaultValue = "false", property = "maven.ear.duplicateArtifactsBreakTheBuild" )

+    private boolean duplicateArtifactsBreakTheBuild;

+

+    private void checkModuleUniqueness()

+        throws MojoExecutionException

+    {

+        ModuleIdentifierValidator miv = new ModuleIdentifierValidator( getModules() );

+        miv.checkForDuplicateArtifacts();

+        if ( miv.existDuplicateArtifacts() )

+        {

+            Map<String, List<EarModule>> duplicateArtifacts = miv.getDuplicateArtifacts();

+            for ( Entry<String, List<EarModule>> entry : duplicateArtifacts.entrySet() )

+            {

+                getLog().warn( "The artifactId " + entry.getKey() + " exists more than once in the modules list." );

+                for ( EarModule earModule : entry.getValue() )

+                {

+                    getLog().warn( " --> " + earModule.getArtifact().getId() + " (" + earModule.getType() + ")" );

+                }

+            }

+

+            getLog().warn( "HINT: This can be simply solved by using the <fileNameMapping>full</fileNameMapping>" );

+

+            if ( duplicateArtifactsBreakTheBuild )

+            {

+                // CHECKSTYLE_OFF: LineLength

+                throw new MojoExecutionException(

+                                                  "The build contains duplicate artifacts which result in unpredictable ear content." );

+                // CHECKSTYLE_ON: LineLength

+            }

+        }

+

+    }

+

+    /** {@inheritDoc} */

+    public void execute()

+        throws MojoExecutionException, MojoFailureException

+    {

+        // Initializes ear modules

+        super.execute();

+

+        zipArchiver.setUseJvmChmod( useJvmChmod );

+        zipUnArchiver.setUseJvmChmod( useJvmChmod );

+

+        final JavaEEVersion javaEEVersion = JavaEEVersion.getJavaEEVersion( version );

+

+        // Initializes unpack types

+        List<String> unpackTypesList = createUnpackList();

+

+        // Copy modules

+        copyModules( javaEEVersion, unpackTypesList );

+

+        // Copy source files

+        try

+        {

+            File earSourceDir = earSourceDirectory;

+            if ( earSourceDir.exists() )

+            {

+                getLog().info( "Copy ear sources to " + getWorkDirectory().getAbsolutePath() );

+                String[] fileNames = getEarFiles( earSourceDir );

+                for ( String fileName : fileNames )

+                {

+                    copyFile( new File( earSourceDir, fileName ), new File( getWorkDirectory(), fileName ) );

+                }

+            }

+

+            if ( applicationXml != null && !"".equals( applicationXml ) )

+            {

+                // rename to application.xml

+                getLog().info( "Including custom application.xml[" + applicationXml + "]" );

+                File metaInfDir = new File( getWorkDirectory(), META_INF );

+                copyFile( new File( applicationXml ), new File( metaInfDir, "/application.xml" ) );

+            }

+

+        }

+        catch ( IOException e )

+        {

+            throw new MojoExecutionException( "Error copying EAR sources", e );

+        }

+        catch ( MavenFilteringException e )

+        {

+            throw new MojoExecutionException( "Error filtering EAR sources", e );

+        }

+

+        // Check if deployment descriptor is there

+        File ddFile = new File( getWorkDirectory(), APPLICATION_XML_URI );

+        if ( !ddFile.exists() && ( javaEEVersion.lt( JavaEEVersion.FIVE ) ) )

+        {

+            // CHECKSTYLE_OFF: LineLength

+            throw new MojoExecutionException( "Deployment descriptor: " + ddFile.getAbsolutePath() + " does not exist." );

+            // CHECKSTYLE_ON: LineLength

+        }

+

+        try

+        {

+            File earFile = getEarFile( outputDirectory, finalName, classifier );

+            final MavenArchiver archiver = new EarMavenArchiver( getModules() );

+            final JarArchiver theJarArchiver = getJarArchiver();

+            getLog().debug( "Jar archiver implementation [" + theJarArchiver.getClass().getName() + "]" );

+            archiver.setArchiver( theJarArchiver );

+            archiver.setOutputFile( earFile );

+

+            // Include custom manifest if necessary

+            includeCustomManifestFile();

+

+            getLog().debug( "Excluding " + Arrays.asList( getPackagingExcludes() ) + " from the generated EAR." );

+            getLog().debug( "Including " + Arrays.asList( getPackagingIncludes() ) + " in the generated EAR." );

+

+            archiver.getArchiver().addDirectory( getWorkDirectory(), getPackagingIncludes(), getPackagingExcludes() );

+            archiver.createArchive( session, getProject(), archive );

+

+            if ( classifier != null )

+            {

+                projectHelper.attachArtifact( getProject(), "ear", classifier, earFile );

+            }

+            else

+            {

+                getProject().getArtifact().setFile( earFile );

+            }

+        }

+        catch ( Exception e )

+        {

+            throw new MojoExecutionException( "Error assembling EAR", e );

+        }

+    }

+

+    private void copyModules( final JavaEEVersion javaEEVersion, List<String> unpackTypesList )

+        throws MojoExecutionException, MojoFailureException

+    {

+        try

+        {

+            // TODO: With the next major release the modules

+            // should be identified by a unique id instead of the

+            // the artifactId's only which means this

+            // check can be removed.

+            // http://jira.codehaus.org/browse/MEAR-209

+            checkModuleUniqueness();

+

+            for ( EarModule module : getModules() )

+            {

+                final File sourceFile = module.getArtifact().getFile();

+                final File destinationFile = buildDestinationFile( getWorkDirectory(), module.getUri() );

+                if ( !sourceFile.isFile() )

+                {

+                    throw new MojoExecutionException( "Cannot copy a directory: " + sourceFile.getAbsolutePath()

+                        + "; Did you package/install " + module.getArtifact() + "?" );

+                }

+

+                if ( destinationFile.getCanonicalPath().equals( sourceFile.getCanonicalPath() ) )

+                {

+                    getLog().info( "Skipping artifact [" + module + "], as it already exists at [" + module.getUri()

+                                       + "]" );

+                    continue;

+                }

+

+                // If the module is within the unpack list, make sure that no unpack wasn't forced (null or true)

+                // If the module is not in the unpack list, it should be true

+                // CHECKSTYLE_OFF: LineLength

+                if ( ( unpackTypesList.contains( module.getType() ) && ( module.shouldUnpack() == null || module.shouldUnpack() ) )

+                    || ( module.shouldUnpack() != null && module.shouldUnpack() ) )

+                // CHECKSTYLE_ON: LineLength

+                {

+                    getLog().info( "Copying artifact [" + module + "] to [" + module.getUri() + "] (unpacked)" );

+                    // Make sure that the destination is a directory to avoid plexus nasty stuff :)

+                    destinationFile.mkdirs();

+                    unpack( sourceFile, destinationFile );

+

+                    if ( skinnyWars && module.changeManifestClasspath() )

+                    {

+                        changeManifestClasspath( module, destinationFile, javaEEVersion );

+                    }

+                }

+                else

+                {

+                    if ( sourceFile.lastModified() > destinationFile.lastModified() )

+                    {

+                        getLog().info( "Copying artifact [" + module + "] to [" + module.getUri() + "]" );

+                        FileUtils.copyFile( sourceFile, destinationFile );

+

+                        if ( skinnyWars && module.changeManifestClasspath() )

+                        {

+                            changeManifestClasspath( module, destinationFile, javaEEVersion );

+                        }

+                    }

+                    else

+                    {

+                        getLog().debug( "Skipping artifact [" + module + "], as it is already up to date at ["

+                                            + module.getUri() + "]" );

+                    }

+                }

+            }

+        }

+        catch ( IOException e )

+        {

+            throw new MojoExecutionException( "Error copying EAR modules", e );

+        }

+        catch ( ArchiverException e )

+        {

+            throw new MojoExecutionException( "Error unpacking EAR modules", e );

+        }

+        catch ( NoSuchArchiverException e )

+        {

+            throw new MojoExecutionException( "No Archiver found for EAR modules", e );

+        }

+    }

+

+    private List<String> createUnpackList()

+        throws MojoExecutionException

+    {

+        List<String> unpackTypesList = new ArrayList<String>();

+        if ( unpackTypes != null )

+        {

+            unpackTypesList = Arrays.asList( unpackTypes.split( "," ) );

+            for ( String type : unpackTypesList )

+            {

+                if ( !EarModuleFactory.STANDARD_ARTIFACT_TYPE.contains( type ) )

+                {

+                    throw new MojoExecutionException( "Invalid type [" + type + "] supported types are "

+                        + EarModuleFactory.STANDARD_ARTIFACT_TYPE );

+                }

+            }

+            getLog().debug( "Initialized unpack types " + unpackTypesList );

+        }

+        return unpackTypesList;

+    }

+

+    /**

+     * @return {@link #applicationXml}

+     */

+    public String getApplicationXml()

+    {

+        return applicationXml;

+    }

+

+    /**

+     * @param applicationXml {@link #applicationXml}

+     */

+    public void setApplicationXml( String applicationXml )

+    {

+        this.applicationXml = applicationXml;

+    }

+

+    /**

+     * Returns a string array of the excludes to be used when assembling/copying the ear.

+     * 

+     * @return an array of tokens to exclude

+     */

+    protected String[] getExcludes()

+    {

+        List<String> excludeList = new ArrayList<String>( FileUtils.getDefaultExcludesAsList() );

+        if ( earSourceExcludes != null && !"".equals( earSourceExcludes ) )

+        {

+            excludeList.addAll( Arrays.asList( StringUtils.split( earSourceExcludes, "," ) ) );

+        }

+

+        // if applicationXml is specified, omit the one in the source directory

+        if ( getApplicationXml() != null && !"".equals( getApplicationXml() ) )

+        {

+            excludeList.add( "**/" + META_INF + "/application.xml" );

+        }

+

+        return excludeList.toArray( new String[excludeList.size()] );

+    }

+

+    /**

+     * Returns a string array of the includes to be used when assembling/copying the ear.

+     * 

+     * @return an array of tokens to include

+     */

+    protected String[] getIncludes()

+    {

+        return StringUtils.split( StringUtils.defaultString( earSourceIncludes ), "," );

+    }

+

+    /**

+     * @return The array with the packaging excludes.

+     */

+    public String[] getPackagingExcludes()

+    {

+        if ( StringUtils.isEmpty( packagingExcludes ) )

+        {

+            return new String[0];

+        }

+        else

+        {

+            return StringUtils.split( packagingExcludes, "," );

+        }

+    }

+

+    /**

+     * @param packagingExcludes {@link #packagingExcludes}

+     */

+    public void setPackagingExcludes( String packagingExcludes )

+    {

+        this.packagingExcludes = packagingExcludes;

+    }

+

+    /**

+     * @return The arrays with the includes.

+     */

+    public String[] getPackagingIncludes()

+    {

+        if ( StringUtils.isEmpty( packagingIncludes ) )

+        {

+            return new String[] { "**" };

+        }

+        else

+        {

+            return StringUtils.split( packagingIncludes, "," );

+        }

+    }

+

+    /**

+     * @param packagingIncludes {@link #packagingIncludes}

+     */

+    public void setPackagingIncludes( String packagingIncludes )

+    {

+        this.packagingIncludes = packagingIncludes;

+    }

+

+    private static File buildDestinationFile( File buildDir, String uri )

+    {

+        return new File( buildDir, uri );

+    }

+

+    private void includeCustomManifestFile()

+    {

+        if ( manifestFile == null )

+        {

+            manifestFile = new File( getWorkDirectory(), "META-INF/MANIFEST.MF" );

+        }

+

+        if ( !manifestFile.exists() )

+        {

+            getLog().info( "Could not find manifest file: " + manifestFile + " - Generating one" );

+        }

+        else

+        {

+            getLog().info( "Including custom manifest file [" + manifestFile + "]" );

+            archive.setManifestFile( manifestFile );

+        }

+    }

+

+    /**

+     * Returns the EAR file to generate, based on an optional classifier.

+     * 

+     * @param basedir the output directory

+     * @param finalName the name of the ear file

+     * @param classifier an optional classifier

+     * @return the EAR file to generate

+     */

+    private static File getEarFile( String basedir, String finalName, String classifier )

+    {

+        if ( classifier == null )

+        {

+            classifier = "";

+        }

+        else if ( classifier.trim().length() > 0 && !classifier.startsWith( "-" ) )

+        {

+            classifier = "-" + classifier;

+        }

+

+        return new File( basedir, finalName + classifier + ".ear" );

+    }

+

+    /**

+     * Returns a list of filenames that should be copied over to the destination directory.

+     * 

+     * @param sourceDir the directory to be scanned

+     * @return the array of filenames, relative to the sourceDir

+     */

+    private String[] getEarFiles( File sourceDir )

+    {

+        DirectoryScanner scanner = new DirectoryScanner();

+        scanner.setBasedir( sourceDir );

+        scanner.setExcludes( getExcludes() );

+        scanner.addDefaultExcludes();

+

+        scanner.setIncludes( getIncludes() );

+

+        scanner.scan();

+

+        return scanner.getIncludedFiles();

+    }

+

+    /**

+     * Unpacks the module into the EAR structure.

+     * 

+     * @param source File to be unpacked.

+     * @param destDir Location where to put the unpacked files.

+     * @throws NoSuchArchiverException In case of we don't have an appropriate archiver.

+     * @throws IOException In case of a general IOException.

+     */

+    public void unpack( File source, File destDir )

+        throws NoSuchArchiverException, IOException

+    {

+        UnArchiver unArchiver = archiverManager.getUnArchiver( "zip" );

+        unArchiver.setSourceFile( source );

+        unArchiver.setDestDirectory( destDir );

+

+        // Extract the module

+        unArchiver.extract();

+    }

+

+    /**

+     * Returns the {@link JarArchiver} implementation used to package the EAR file.

+     * <p/>

+     * By default the archiver is obtained from the Plexus container.

+     * 

+     * @return the archiver

+     */

+    protected JarArchiver getJarArchiver()

+    {

+        return jarArchiver;

+    }

+

+    private void copyFile( File source, File target )

+        throws MavenFilteringException, IOException, MojoExecutionException

+    {

+        if ( filtering && !isNonFilteredExtension( source.getName() ) )

+        {

+            // Silly that we have to do this ourselves

+            if ( target.getParentFile() != null && !target.getParentFile().exists() )

+            {

+                target.getParentFile().mkdirs();

+            }

+

+            mavenFileFilter.copyFile( source, target, true, getFilterWrappers(), encoding );

+        }

+        else

+        {

+            FileUtils.copyFile( source, target );

+        }

+    }

+

+    /**

+     * @param fileName The name of the file which should be checked.

+     * @return {@code true} if the name is part of the non filtered extensions {@code false} otherwise.

+     */

+    public boolean isNonFilteredExtension( String fileName )

+    {

+        return !mavenResourcesFiltering.filteredFileExtension( fileName, nonFilteredFileExtensions );

+    }

+

+    private List<FileUtils.FilterWrapper> getFilterWrappers()

+        throws MojoExecutionException

+    {

+        if ( filterWrappers == null )

+        {

+            try

+            {

+                MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution();

+                mavenResourcesExecution.setMavenProject( getProject() );

+                mavenResourcesExecution.setEscapedBackslashesInFilePath( escapedBackslashesInFilePath );

+                mavenResourcesExecution.setFilters( filters );

+                mavenResourcesExecution.setEscapeString( escapeString );

+

+                filterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenResourcesExecution );

+            }

+            catch ( MavenFilteringException e )

+            {

+                getLog().error( "Fail to build filtering wrappers " + e.getMessage() );

+                throw new MojoExecutionException( e.getMessage(), e );

+            }

+        }

+        return filterWrappers;

+    }

+

+    private void changeManifestClasspath( EarModule module, File original, JavaEEVersion javaEEVersion )

+        throws MojoFailureException

+    {

+        try

+        {

+            File workDirectory;

+

+            // Handle the case that the destination might be a directory (project-038)

+            if ( original.isFile() )

+            {

+                // Create a temporary work directory

+                // MEAR-167 use uri as directory to prevent merging of artifacts with the same artifactId

+                workDirectory = new File( new File( getTempFolder(), "temp" ), module.getUri() );

+                workDirectory.mkdirs();

+                getLog().debug( "Created a temporary work directory: " + workDirectory.getAbsolutePath() );

+

+                // Unpack the archive to a temporary work directory

+                zipUnArchiver.setSourceFile( original );

+                zipUnArchiver.setDestDirectory( workDirectory );

+                zipUnArchiver.extract();

+            }

+            else

+            {

+                workDirectory = original;

+            }

+

+            // Create a META-INF/MANIFEST.MF file if it doesn't exist (project-038)

+            File metaInfDirectory = new File( workDirectory, "META-INF" );

+            boolean newMetaInfCreated = metaInfDirectory.mkdirs();

+            if ( newMetaInfCreated )

+            {

+                // CHECKSTYLE_OFF: LineLength

+                getLog().debug( "This project did not have a META-INF directory before, so a new directory was created." );

+                // CHECKSTYLE_ON: LineLength

+            }

+            File newCreatedManifestFile = new File( metaInfDirectory, "MANIFEST.MF" );

+            boolean newManifestCreated = newCreatedManifestFile.createNewFile();

+            if ( newManifestCreated )

+            {

+                // CHECKSTYLE_OFF: LineLength

+                getLog().debug( "This project did not have a META-INF/MANIFEST.MF file before, so a new file was created." );

+                // CHECKSTYLE_ON: LineLength

+            }

+

+            // Read the manifest from disk

+            Manifest mf = new Manifest( new FileInputStream( newCreatedManifestFile ) );

+            Attribute classPath = mf.getMainSection().getAttribute( "Class-Path" );

+            List<String> classPathElements = new ArrayList<String>();

+

+            if ( classPath != null )

+            {

+                classPathElements.addAll( Arrays.asList( classPath.getValue().split( " " ) ) );

+            }

+            else

+            {

+                classPath = new Attribute( "Class-Path", "" );

+            }

+

+            // Modify the classpath entries in the manifest

+            for ( EarModule o : getModules() )

+            {

+                if ( o instanceof JarModule )

+                {

+                    JarModule jm = (JarModule) o;

+

+                    if ( module.getLibDir() != null )

+                    {

+                        // MEAR-189:

+                        // We use the original name, cause in case of fileNameMapping to no-version/full

+                        // we could not not delete it and it will end up in the resulting EAR and the WAR

+                        // will not be cleaned up.

+                        File artifact =

+                            new File( new File( workDirectory, module.getLibDir() ), jm.getOriginalBundleFileName() );

+

+                        if ( artifact.exists() )

+                        {

+                            getLog().debug( " -> Artifact to delete: " + artifact );

+                            if ( !artifact.delete() )

+                            {

+                                getLog().error( "Could not delete '" + artifact + "'" );

+                            }

+                        }

+                    }

+

+                    if ( classPathElements.contains( jm.getBundleFileName() ) )

+                    {

+                        classPathElements.set( classPathElements.indexOf( jm.getBundleFileName() ), jm.getUri() );

+                    }

+                    else

+                    {

+                        if ( !skipClassPathModification )

+                        {

+                            classPathElements.add( jm.getUri() );

+                        }

+                        else

+                        {

+                            if ( javaEEVersion.lt( JavaEEVersion.FIVE ) || defaultLibBundleDir == null )

+                            {

+                                classPathElements.add( jm.getUri() );

+                            }

+                        }

+                    }

+                }

+            }

+            classPath.setValue( StringUtils.join( classPathElements.iterator(), " " ) );

+            mf.getMainSection().addConfiguredAttribute( classPath );

+

+            // Write the manifest to disk

+            PrintWriter pw = new PrintWriter( newCreatedManifestFile );

+            mf.write( pw );

+            pw.close();

+

+            if ( original.isFile() )

+            {

+                // Pack up the archive again from the work directory

+                if ( !original.delete() )

+                {

+                    getLog().error( "Could not delete original artifact file " + original );

+                }

+

+                getLog().debug( "Zipping module" );

+                zipArchiver.setDestFile( original );

+                zipArchiver.addDirectory( workDirectory );

+                zipArchiver.createArchive();

+            }

+        }

+        catch ( ManifestException e )

+        {

+            throw new MojoFailureException( e.getMessage() );

+        }

+        catch ( ZipException e )

+        {

+            throw new MojoFailureException( e.getMessage() );

+        }

+        catch ( IOException e )

+        {

+            throw new MojoFailureException( e.getMessage() );

+        }

+        catch ( ArchiverException e )

+        {

+            throw new MojoFailureException( e.getMessage() );

+        }

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/EarPluginException.java b/src/main/java/org/apache/maven/plugins/ear/EarPluginException.java
similarity index 92%
rename from src/main/java/org/apache/maven/plugin/ear/EarPluginException.java
rename to src/main/java/org/apache/maven/plugins/ear/EarPluginException.java
index 1d9b54f..54ba145 100644
--- a/src/main/java/org/apache/maven/plugin/ear/EarPluginException.java
+++ b/src/main/java/org/apache/maven/plugins/ear/EarPluginException.java
@@ -1,68 +1,68 @@
-package org.apache.maven.plugin.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.
- */
-
-/**
- * The base exception of the EAR plugin.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public class EarPluginException
-    extends Exception
-{
-
-    /**
-     * 
-     */
-    private static final long serialVersionUID = -5540929953103327928L;
-
-    /**
-     * Create an instance.
-     */
-    public EarPluginException()
-    {
-    }
-
-    /**
-     * @param message The message for the exception.
-     */
-    public EarPluginException( String message )
-    {
-        super( message );
-    }
-
-    /**
-     * @param cause {@link Throwable}
-     */
-    public EarPluginException( Throwable cause )
-    {
-        super( cause );
-    }
-
-    /**
-     * @param message The message to emit.
-     * @param cause {@link Throwable}
-     */
-    public EarPluginException( String message, Throwable cause )
-    {
-        super( message, cause );
-    }
-}
+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.

+ */

+

+/**

+ * The base exception of the EAR plugin.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: EarPluginException.java 1645331 2014-12-13 17:31:09Z khmarbaise $

+ */

+public class EarPluginException

+    extends Exception

+{

+

+    /**

+     * 

+     */

+    private static final long serialVersionUID = -5540929953103327928L;

+

+    /**

+     * Create an instance.

+     */

+    public EarPluginException()

+    {

+    }

+

+    /**

+     * @param message The message for the exception.

+     */

+    public EarPluginException( String message )

+    {

+        super( message );

+    }

+

+    /**

+     * @param cause {@link Throwable}

+     */

+    public EarPluginException( Throwable cause )

+    {

+        super( cause );

+    }

+

+    /**

+     * @param message The message to emit.

+     * @param cause {@link Throwable}

+     */

+    public EarPluginException( String message, Throwable cause )

+    {

+        super( message, cause );

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/EjbClientModule.java b/src/main/java/org/apache/maven/plugins/ear/EjbClientModule.java
similarity index 92%
rename from src/main/java/org/apache/maven/plugin/ear/EjbClientModule.java
rename to src/main/java/org/apache/maven/plugins/ear/EjbClientModule.java
index 5663287..5ae965d 100644
--- a/src/main/java/org/apache/maven/plugin/ear/EjbClientModule.java
+++ b/src/main/java/org/apache/maven/plugins/ear/EjbClientModule.java
@@ -1,58 +1,58 @@
-package org.apache.maven.plugin.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;
-
-/**
- * The {@link EarModule} implementation for an ejb client module.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public class EjbClientModule
-    extends JarModule
-{
-
-    /**
-     * Create an instance.
-     */
-    public EjbClientModule()
-    {
-        super();
-    }
-
-    /**
-     * @param a {@link Artifact}
-     * @param defaultLibBundleDir The default lib bundle directory.
-     */
-    public EjbClientModule( Artifact a, String defaultLibBundleDir )
-    {
-        super( a, defaultLibBundleDir, Boolean.FALSE );
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getType()
-    {
-        return "ejb-client";
-    }
-}
+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;

+

+/**

+ * The {@link EarModule} implementation for an ejb client module.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: EjbClientModule.java 1645331 2014-12-13 17:31:09Z khmarbaise $

+ */

+public class EjbClientModule

+    extends JarModule

+{

+

+    /**

+     * Create an instance.

+     */

+    public EjbClientModule()

+    {

+        super();

+    }

+

+    /**

+     * @param a {@link Artifact}

+     * @param defaultLibBundleDir The default lib bundle directory.

+     */

+    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/plugin/ear/EjbModule.java b/src/main/java/org/apache/maven/plugins/ear/EjbModule.java
similarity index 93%
rename from src/main/java/org/apache/maven/plugin/ear/EjbModule.java
rename to src/main/java/org/apache/maven/plugins/ear/EjbModule.java
index 56fe390..1c4ed25 100644
--- a/src/main/java/org/apache/maven/plugin/ear/EjbModule.java
+++ b/src/main/java/org/apache/maven/plugins/ear/EjbModule.java
@@ -1,73 +1,73 @@
-package org.apache.maven.plugin.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.codehaus.plexus.util.xml.XMLWriter;
-
-/**
- * The {@link EarModule} implementation for an EJB module.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public class EjbModule
-    extends AbstractEarModule
-{
-    private static final String EJB_MODULE = "ejb";
-
-    /**
-     * Create an instance.
-     */
-    public EjbModule()
-    {
-    }
-
-    /**
-     * @param a {@link Artifact}
-     */
-    public EjbModule( Artifact a )
-    {
-        super( a );
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void appendModule( XMLWriter writer, String version, Boolean generateId )
-    {
-        startModuleElement( writer, generateId );
-        writer.startElement( EJB_MODULE );
-        writer.writeText( getUri() );
-        writer.endElement();
-
-        writeAltDeploymentDescriptor( writer, version );
-
-        writer.endElement();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getType()
-    {
-        return EJB_MODULE;
-    }
-}
+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.codehaus.plexus.util.xml.XMLWriter;

+

+/**

+ * The {@link EarModule} implementation for an EJB module.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: EjbModule.java 1645331 2014-12-13 17:31:09Z khmarbaise $

+ */

+public class EjbModule

+    extends AbstractEarModule

+{

+    private static final String EJB_MODULE = "ejb";

+

+    /**

+     * Create an instance.

+     */

+    public EjbModule()

+    {

+    }

+

+    /**

+     * @param a {@link Artifact}

+     */

+    public EjbModule( Artifact a )

+    {

+        super( a );

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public void appendModule( XMLWriter writer, String version, Boolean generateId )

+    {

+        startModuleElement( writer, generateId );

+        writer.startElement( EJB_MODULE );

+        writer.writeText( getUri() );

+        writer.endElement();

+

+        writeAltDeploymentDescriptor( writer, version );

+

+        writer.endElement();

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public String getType()

+    {

+        return EJB_MODULE;

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/EjbRef.java b/src/main/java/org/apache/maven/plugins/ear/EjbRef.java
similarity index 98%
rename from src/main/java/org/apache/maven/plugin/ear/EjbRef.java
rename to src/main/java/org/apache/maven/plugins/ear/EjbRef.java
index cfa64f0..622b6ad 100644
--- a/src/main/java/org/apache/maven/plugin/ear/EjbRef.java
+++ b/src/main/java/org/apache/maven/plugins/ear/EjbRef.java
@@ -1,4 +1,4 @@
-package org.apache.maven.plugin.ear;
+package org.apache.maven.plugins.ear;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
diff --git a/src/main/java/org/apache/maven/plugin/ear/EnvEntry.java b/src/main/java/org/apache/maven/plugins/ear/EnvEntry.java
similarity index 96%
rename from src/main/java/org/apache/maven/plugin/ear/EnvEntry.java
rename to src/main/java/org/apache/maven/plugins/ear/EnvEntry.java
index 2cbcd3b..4b1be70 100644
--- a/src/main/java/org/apache/maven/plugin/ear/EnvEntry.java
+++ b/src/main/java/org/apache/maven/plugins/ear/EnvEntry.java
@@ -1,138 +1,138 @@
-package org.apache.maven.plugin.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.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.xml.XMLWriter;
-
-/**
- * The representation of a env-entry entry within an application.xml file.
- * 
- * @author Jim Brownfield based on code by <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-class EnvEntry
-{
-
-    static final String ENV_ENTRY = "env-entry";
-
-    static final String DESCRIPTION = "description";
-
-    static final String ENV_ENTRY_NAME = "env-entry-name";
-
-    static final String ENV_ENTRY_TYPE = "env-entry-type";
-
-    static final String ENV_ENTRY_VALUE = "env-entry-value";
-
-    private final String description;
-
-    private final String name;
-
-    private final String type;
-
-    private final String value;
-
-    public EnvEntry( String description, String name, String type, String value )
-    {
-        if ( StringUtils.isEmpty( name ) )
-        {
-            throw new IllegalArgumentException( ENV_ENTRY_NAME + " in " + ENV_ENTRY + " element cannot be null." );
-        }
-        else if ( StringUtils.isEmpty( type ) && StringUtils.isEmpty( value ) )
-        {
-            throw new IllegalArgumentException( ENV_ENTRY_TYPE + " in " + ENV_ENTRY + " element cannot be null if no "
-                + ENV_ENTRY_VALUE + " was specified." );
-
-        }
-
-        this.description = description;
-        this.name = name;
-        this.type = type;
-        this.value = value;
-    }
-
-    public String getDescription()
-    {
-        return description;
-    }
-
-    public String getName()
-    {
-        return name;
-    }
-
-    public String getType()
-    {
-        return type;
-    }
-
-    public String getValue()
-    {
-        return value;
-    }
-
-    /**
-     * Appends the <tt>XML</tt> representation of this env-entry.
-     * 
-     * @param writer the writer to use
-     */
-    public void appendEnvEntry( XMLWriter writer )
-    {
-        System.out.println( "appendEnvEntry()" );
-        writer.startElement( ENV_ENTRY );
-
-        // description
-        if ( getDescription() != null )
-        {
-            doWriteElement( writer, DESCRIPTION, getDescription() );
-        }
-
-        // env entry name
-        doWriteElement( writer, ENV_ENTRY_NAME, getName() );
-
-        // env entry type
-        if ( getType() != null )
-        {
-            doWriteElement( writer, ENV_ENTRY_TYPE, getType() );
-        }
-
-        // env entry value
-        if ( getValue() != null )
-        {
-            doWriteElement( writer, ENV_ENTRY_VALUE, getValue() );
-        }
-
-        // end of env-entry
-        writer.endElement();
-    }
-
-    private void doWriteElement( XMLWriter writer, String element, String text )
-    {
-        writer.startElement( element );
-        writer.writeText( text );
-        writer.endElement();
-    }
-
-    public String toString()
-    {
-        return "env-entry [name=" + getName() + ", type=" + getType() + ", value=" + getValue() + "]";
-    }
-
+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.codehaus.plexus.util.StringUtils;

+import org.codehaus.plexus.util.xml.XMLWriter;

+

+/**

+ * The representation of a env-entry entry within an application.xml file.

+ * 

+ * @author Jim Brownfield based on code by <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: EnvEntry.java 1648055 2014-12-27 14:59:45Z khmarbaise $

+ */

+class EnvEntry

+{

+

+    static final String ENV_ENTRY = "env-entry";

+

+    static final String DESCRIPTION = "description";

+

+    static final String ENV_ENTRY_NAME = "env-entry-name";

+

+    static final String ENV_ENTRY_TYPE = "env-entry-type";

+

+    static final String ENV_ENTRY_VALUE = "env-entry-value";

+

+    private final String description;

+

+    private final String name;

+

+    private final String type;

+

+    private final String value;

+

+    public EnvEntry( String description, String name, String type, String value )

+    {

+        if ( StringUtils.isEmpty( name ) )

+        {

+            throw new IllegalArgumentException( ENV_ENTRY_NAME + " in " + ENV_ENTRY + " element cannot be null." );

+        }

+        else if ( StringUtils.isEmpty( type ) && StringUtils.isEmpty( value ) )

+        {

+            throw new IllegalArgumentException( ENV_ENTRY_TYPE + " in " + ENV_ENTRY + " element cannot be null if no "

+                + ENV_ENTRY_VALUE + " was specified." );

+

+        }

+

+        this.description = description;

+        this.name = name;

+        this.type = type;

+        this.value = value;

+    }

+

+    public String getDescription()

+    {

+        return description;

+    }

+

+    public String getName()

+    {

+        return name;

+    }

+

+    public String getType()

+    {

+        return type;

+    }

+

+    public String getValue()

+    {

+        return value;

+    }

+

+    /**

+     * Appends the <tt>XML</tt> representation of this env-entry.

+     * 

+     * @param writer the writer to use

+     */

+    public void appendEnvEntry( XMLWriter writer )

+    {

+        System.out.println( "appendEnvEntry()" );

+        writer.startElement( ENV_ENTRY );

+

+        // description

+        if ( getDescription() != null )

+        {

+            doWriteElement( writer, DESCRIPTION, getDescription() );

+        }

+

+        // env entry name

+        doWriteElement( writer, ENV_ENTRY_NAME, getName() );

+

+        // env entry type

+        if ( getType() != null )

+        {

+            doWriteElement( writer, ENV_ENTRY_TYPE, getType() );

+        }

+

+        // env entry value

+        if ( getValue() != null )

+        {

+            doWriteElement( writer, ENV_ENTRY_VALUE, getValue() );

+        }

+

+        // end of env-entry

+        writer.endElement();

+    }

+

+    private void doWriteElement( XMLWriter writer, String element, String text )

+    {

+        writer.startElement( element );

+        writer.writeText( text );

+        writer.endElement();

+    }

+

+    public String toString()

+    {

+        return "env-entry [name=" + getName() + ", type=" + getType() + ", value=" + getValue() + "]";

+    }

+

 }
\ No newline at end of file
diff --git a/src/main/java/org/apache/maven/plugin/ear/GenerateApplicationXmlMojo.java b/src/main/java/org/apache/maven/plugins/ear/GenerateApplicationXmlMojo.java
similarity index 98%
rename from src/main/java/org/apache/maven/plugin/ear/GenerateApplicationXmlMojo.java
rename to src/main/java/org/apache/maven/plugins/ear/GenerateApplicationXmlMojo.java
index 071d924..501d5fe 100644
--- a/src/main/java/org/apache/maven/plugin/ear/GenerateApplicationXmlMojo.java
+++ b/src/main/java/org/apache/maven/plugins/ear/GenerateApplicationXmlMojo.java
@@ -1,462 +1,462 @@
-package org.apache.maven.plugin.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 java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.ear.util.JavaEEVersion;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.codehaus.plexus.configuration.PlexusConfiguration;
-import org.codehaus.plexus.interpolation.InterpolationException;
-import org.codehaus.plexus.interpolation.Interpolator;
-import org.codehaus.plexus.interpolation.MapBasedValueSource;
-import org.codehaus.plexus.interpolation.StringSearchInterpolator;
-import org.codehaus.plexus.interpolation.ValueSource;
-import org.codehaus.plexus.util.FileUtils;
-
-/**
- * Generates the EAR deployment descriptor file(s).
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-// CHECKSTYLE_OFF: LineLength
-@Mojo( name = "generate-application-xml", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, threadSafe = true, requiresDependencyResolution = ResolutionScope.TEST )
-// CHECKSTYLE_ON: LineLength
-public class GenerateApplicationXmlMojo
-    extends AbstractEarMojo
-{
-
-    /**
-     * The DEFAULT library folder.
-     */
-    public static final String DEFAULT = "DEFAULT";
-
-    /**
-     * The empty folder.
-     */
-    public static final String EMPTY = "EMPTY";
-
-    /**
-     * The NONE not existent folder.
-     */
-    public static final String NONE = "NONE";
-
-    /**
-     * Whether the application.xml should be generated or not.
-     */
-    @Parameter( defaultValue = "true" )
-    private Boolean generateApplicationXml = Boolean.TRUE;
-
-    /**
-     * Whether a module ID should be generated if none is specified.
-     */
-    @Parameter( defaultValue = "false" )
-    private Boolean generateModuleId = Boolean.FALSE;
-
-    /**
-     * Application name of the application to be used when the application.xml file is auto-generated. Since JavaEE6.
-     */
-    @Parameter
-    private String applicationName;
-
-    /**
-     * Display name of the application to be used when the application.xml file is auto-generated.
-     */
-    @Parameter( defaultValue = "${project.artifactId}" )
-    private String displayName;
-
-    /**
-     * Description of the application to be used when the application.xml file is auto-generated.
-     */
-    @Parameter( defaultValue = "${project.description}" )
-    private String description;
-
-    /**
-     * Defines how the <tt>library-directory</tt> element should be written in the application.xml file.
-     * <p/>
-     * Three special values can be set:
-     * <ul>
-     * <li><code>DEFAULT</code> (default) generates a <tt>library-directory</tt> element with the value of the
-     * <tt>defaultLibBundleDir</tt> parameter</li>
-     * <li><code>EMPTY</code> generates an empty <tt>library-directory</tt> element. Per spec, this disables the
-     * scanning of jar files in the <tt>lib</tt> directory of the ear file</li>
-     * <li><code>NONE</code> does not write the library-directory element at all. A corner case that can be used in
-     * Oracle Weblogic to delegate the classloading to the container</li>
-     * </ul>
-     * <p/>
-     * Since JavaEE5.
-     */
-    @Parameter( defaultValue = DEFAULT )
-    private String libraryDirectoryMode;
-
-    /**
-     * Defines the value of the initialize in order element to be used when the application.xml file is auto-generated.
-     * When set to true, modules must be initialized in the order they're listed in this deployment descriptor, with the
-     * exception of application client modules, which can be initialized in any order. If initialize-in-order is not set
-     * or set to false, the order of initialization is unspecified and may be product-dependent. Since JavaEE6.
-     */
-    @Parameter
-    private Boolean initializeInOrder;
-
-    /**
-     * Defines the application id used when generating the deployment descriptor.
-     * 
-     * @since 2.9
-     */
-    @Parameter
-    private String applicationId;
-
-    /**
-     * The security-roles to be added to the auto-generated application.xml file.
-     */
-    @Parameter
-    private PlexusConfiguration security;
-
-    /**
-     * The env-entries to be added to the auto-generated application.xml file. Since JavaEE6.
-     */
-    @Parameter( alias = "env-entries" )
-    private PlexusConfiguration envEntries;
-
-    /**
-     * The {@code ejb-ref} entries.
-     */
-    @Parameter( alias = "ejb-refs" )
-    private PlexusConfiguration ejbRefs;
-
-    /**
-     * {@inheritDoc}
-     */
-    public void execute()
-        throws MojoExecutionException, MojoFailureException
-    {
-        // Initializes ear modules
-        super.execute();
-
-        // Handle application.xml
-        if ( !generateApplicationXml )
-        {
-            getLog().debug( "Generation of application.xml is disabled" );
-        }
-        else
-        {
-            final JavaEEVersion javaEEVersion = JavaEEVersion.getJavaEEVersion( version );
-
-            // Generate deployment descriptor and copy it to the build directory
-            getLog().info( "Generating application.xml" );
-            try
-            {
-                generateStandardDeploymentDescriptor( javaEEVersion );
-            }
-            catch ( EarPluginException e )
-            {
-                throw new MojoExecutionException( "Failed to generate application.xml", e );
-            }
-
-            try
-            {
-                FileUtils.copyFileToDirectory( new File( generatedDescriptorLocation, "application.xml" ),
-                                               new File( getWorkDirectory(), "META-INF" ) );
-            }
-            catch ( IOException e )
-            {
-                throw new MojoExecutionException( "Unable to copy application.xml to final destination", e );
-            }
-        }
-
-        // Handle jboss-app.xml
-        if ( getJbossConfiguration() == null )
-        {
-            getLog().debug( "Generation of jboss-app.xml is disabled" );
-        }
-        else
-        {
-            // Generate deployment descriptor and copy it to the build directory
-            getLog().info( "Generating jboss-app.xml" );
-            try
-            {
-                generateJbossDeploymentDescriptor();
-            }
-            catch ( EarPluginException e )
-            {
-                throw new MojoExecutionException( "Failed to generate jboss-app.xml", e );
-            }
-
-            try
-            {
-                FileUtils.copyFileToDirectory( new File( generatedDescriptorLocation, "jboss-app.xml" ),
-                                               new File( getWorkDirectory(), "META-INF" ) );
-            }
-            catch ( IOException e )
-            {
-                throw new MojoExecutionException( "Unable to copy jboss-app.xml to final destination", e );
-            }
-        }
-    }
-
-    /**
-     * Generates the deployment descriptor.
-     * 
-     * @param javaEEVersion {@link JavaEEVersion}
-     * @throws EarPluginException if the configuration is invalid
-     */
-    protected void generateStandardDeploymentDescriptor( JavaEEVersion javaEEVersion )
-        throws EarPluginException
-    {
-        File outputDir = new File( generatedDescriptorLocation );
-        if ( !outputDir.exists() )
-        {
-            outputDir.mkdirs();
-        }
-
-        File descriptor = new File( outputDir, "application.xml" );
-
-        final ApplicationXmlWriter writer = new ApplicationXmlWriter( javaEEVersion, encoding, generateModuleId );
-        final ApplicationXmlWriterContext context =
-            new ApplicationXmlWriterContext( descriptor, getModules(), buildSecurityRoles(), buildEnvEntries(),
-                                             buildEjbEntries(), displayName, description, getActualLibraryDirectory(),
-                                             applicationName, initializeInOrder ).setApplicationId( applicationId );
-        writer.write( context );
-    }
-
-    /**
-     * Generates the jboss deployment descriptor.
-     * 
-     * @throws EarPluginException if the configuration is invalid
-     */
-    protected void generateJbossDeploymentDescriptor()
-        throws EarPluginException
-    {
-        File outputDir = new File( generatedDescriptorLocation );
-        if ( !outputDir.exists() )
-        {
-            outputDir.mkdirs();
-        }
-
-        File descriptor = new File( outputDir, "jboss-app.xml" );
-
-        JbossAppXmlWriter writer = new JbossAppXmlWriter( encoding );
-        writer.write( descriptor, getJbossConfiguration(), getModules() );
-    }
-
-    /**
-     * Builds the security roles based on the configuration.
-     * 
-     * @return a list of SecurityRole object(s)
-     * @throws EarPluginException if the configuration is invalid
-     */
-    private List<SecurityRole> buildSecurityRoles()
-        throws EarPluginException
-    {
-        final List<SecurityRole> result = new ArrayList<SecurityRole>();
-        if ( security == null )
-        {
-            return result;
-        }
-        final PlexusConfiguration[] securityRoles = security.getChildren( SecurityRole.SECURITY_ROLE );
-
-        for ( PlexusConfiguration securityRole : securityRoles )
-        {
-            final String id = securityRole.getAttribute( SecurityRole.ID_ATTRIBUTE );
-            final String childRoleName = securityRole.getChild( SecurityRole.ROLE_NAME ).getValue();
-            final String childRoleNameId =
-                securityRole.getChild( SecurityRole.ROLE_NAME ).getAttribute( SecurityRole.ID_ATTRIBUTE );
-            final String childDescription = securityRole.getChild( SecurityRole.DESCRIPTION ).getValue();
-            final String childDescriptionId =
-                securityRole.getChild( SecurityRole.DESCRIPTION ).getAttribute( SecurityRole.ID_ATTRIBUTE );
-
-            if ( childRoleName == null )
-            {
-                throw new EarPluginException( "Invalid security-role configuration, role-name could not be null." );
-            }
-            else
-            {
-                result.add( new SecurityRole( childRoleName, childRoleNameId, id, childDescription,
-                                              childDescriptionId ) );
-            }
-        }
-        return result;
-    }
-
-    /**
-     * This help method was needed otherwise the interpolate method of interpolator will make an empty string of a
-     * {@code null} element which results in supplemental elements for env-entry.
-     * 
-     * @param interpolator The interpolator
-     * @param element The element
-     * @return The interpolated elements.
-     * @throws InterpolationException in case of an error.
-     */
-    private String interpolate( Interpolator interpolator, String element )
-        throws InterpolationException
-    {
-        if ( element == null )
-        {
-            return element;
-        }
-        else
-        {
-            return interpolator.interpolate( element );
-        }
-    }
-
-    /**
-     * Builds the env-entries based on the configuration.
-     * 
-     * @return a list of EnvEntry object(s)
-     * @throws EarPluginException if the configuration is invalid
-     */
-    private List<EnvEntry> buildEnvEntries()
-        throws EarPluginException
-    {
-        final List<EnvEntry> result = new ArrayList<EnvEntry>();
-        if ( envEntries == null )
-        {
-            return result;
-        }
-        try
-        {
-            StringSearchInterpolator ssi = new StringSearchInterpolator();
-            ValueSource vs = new MapBasedValueSource( project.getProperties() );
-            ssi.addValueSource( vs );
-
-            final PlexusConfiguration[] allEnvEntries = envEntries.getChildren( EnvEntry.ENV_ENTRY );
-
-            for ( PlexusConfiguration envEntry : allEnvEntries )
-            {
-                // CHECKSTYLE_OFF: LineLength
-                final String childDescription =
-                    interpolate( ssi, envEntry.getChild( EnvEntry.DESCRIPTION ).getValue() );
-                final String childEnvEntryName =
-                    interpolate( ssi, envEntry.getChild( EnvEntry.ENV_ENTRY_NAME ).getValue() );
-                final String childEnvEntryType =
-                    interpolate( ssi, envEntry.getChild( EnvEntry.ENV_ENTRY_TYPE ).getValue() );
-                final String childEnvEntryValue =
-                    interpolate( ssi, envEntry.getChild( EnvEntry.ENV_ENTRY_VALUE ).getValue() );
-                // CHECKSTYLE_ON: LineLength
-
-                try
-                {
-                    result.add( new EnvEntry( childDescription, childEnvEntryName, childEnvEntryType,
-                                              childEnvEntryValue ) );
-                }
-                catch ( IllegalArgumentException e )
-                {
-                    throw new EarPluginException( "Invalid env-entry [" + envEntry + "]", e );
-                }
-            }
-            return result;
-        }
-        catch ( InterpolationException e )
-        {
-            throw new EarPluginException( "Interpolation exception:", e );
-        }
-
-    }
-
-    /**
-     * Builds the ejb-ref based on the configuration.
-     * 
-     * @return a list of EjbRef object(s)
-     * @throws EarPluginException if the configuration is invalid
-     */
-    private List<EjbRef> buildEjbEntries()
-        throws EarPluginException
-    {
-        final List<EjbRef> result = new ArrayList<EjbRef>();
-        if ( ejbRefs == null )
-        {
-            return result;
-        }
-        try
-        {
-            StringSearchInterpolator ssi = new StringSearchInterpolator();
-            ValueSource vs = new MapBasedValueSource( project.getProperties() );
-            ssi.addValueSource( vs );
-
-            final PlexusConfiguration[] allEjbEntries = ejbRefs.getChildren( EjbRef.EJB_REF );
-
-            for ( PlexusConfiguration ejbEntry : allEjbEntries )
-            {
-                // CHECKSTYLE_OFF: LineLength
-                final String childDescription =
-                    interpolate( ssi, ejbEntry.getChild( EnvEntry.DESCRIPTION ).getValue() );
-                final String childEjbEntryName = interpolate( ssi, ejbEntry.getChild( EjbRef.EJB_NAME ).getValue() );
-                final String childEjbEntryType = interpolate( ssi, ejbEntry.getChild( EjbRef.EJB_TYPE ).getValue() );
-                final String childEjbLookupNameValue =
-                    interpolate( ssi, ejbEntry.getChild( EjbRef.EJB_LOOKUP_NAME ).getValue() );
-                // CHECKSTYLE_ON: LineLength
-
-                try
-                {
-                    result.add( new EjbRef( childDescription, childEjbEntryName, childEjbEntryType,
-                                            childEjbLookupNameValue ) );
-                }
-                catch ( IllegalArgumentException e )
-                {
-                    throw new EarPluginException( "Invalid ejb-ref [" + ejbEntry + "]", e );
-                }
-            }
-            return result;
-        }
-        catch ( InterpolationException e )
-        {
-            throw new EarPluginException( "Interpolation exception:", e );
-        }
-
-    }
-
-    /**
-     * Returns the value to use for the <tt>library-directory</tt> element, based on the library directory mode.
-     */
-    private String getActualLibraryDirectory()
-        throws EarPluginException
-    {
-        final String mode = libraryDirectoryMode == null ? DEFAULT : libraryDirectoryMode.toUpperCase();
-
-        if ( DEFAULT.equals( mode ) )
-        {
-            return defaultLibBundleDir;
-        }
-        else if ( EMPTY.equals( mode ) )
-        {
-            return "";
-        }
-        else if ( NONE.equals( mode ) )
-        {
-            return null;
-        }
-        else
-        {
-            throw new EarPluginException( "Unsupported library directory mode [" + libraryDirectoryMode
-                + "] Supported modes " + ( Arrays.asList( DEFAULT, EMPTY, NONE ) ) );
-        }
-    }
+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 java.io.File;

+import java.io.IOException;

+import java.util.ArrayList;

+import java.util.Arrays;

+import java.util.List;

+

+import org.apache.maven.plugin.MojoExecutionException;

+import org.apache.maven.plugin.MojoFailureException;

+import org.apache.maven.plugins.annotations.LifecyclePhase;

+import org.apache.maven.plugins.annotations.Mojo;

+import org.apache.maven.plugins.annotations.Parameter;

+import org.apache.maven.plugins.annotations.ResolutionScope;

+import org.apache.maven.plugins.ear.util.JavaEEVersion;

+import org.codehaus.plexus.configuration.PlexusConfiguration;

+import org.codehaus.plexus.interpolation.InterpolationException;

+import org.codehaus.plexus.interpolation.Interpolator;

+import org.codehaus.plexus.interpolation.MapBasedValueSource;

+import org.codehaus.plexus.interpolation.StringSearchInterpolator;

+import org.codehaus.plexus.interpolation.ValueSource;

+import org.codehaus.plexus.util.FileUtils;

+

+/**

+ * Generates the EAR deployment descriptor file(s).

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: GenerateApplicationXmlMojo.java 1713543 2015-11-09 21:32:15Z khmarbaise $

+ */

+// CHECKSTYLE_OFF: LineLength

+@Mojo( name = "generate-application-xml", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, threadSafe = true, requiresDependencyResolution = ResolutionScope.TEST )

+// CHECKSTYLE_ON: LineLength

+public class GenerateApplicationXmlMojo

+    extends AbstractEarMojo

+{

+

+    /**

+     * The DEFAULT library folder.

+     */

+    public static final String DEFAULT = "DEFAULT";

+

+    /**

+     * The empty folder.

+     */

+    public static final String EMPTY = "EMPTY";

+

+    /**

+     * The NONE not existent folder.

+     */

+    public static final String NONE = "NONE";

+

+    /**

+     * Whether the application.xml should be generated or not.

+     */

+    @Parameter( defaultValue = "true" )

+    private Boolean generateApplicationXml = Boolean.TRUE;

+

+    /**

+     * Whether a module ID should be generated if none is specified.

+     */

+    @Parameter( defaultValue = "false" )

+    private Boolean generateModuleId = Boolean.FALSE;

+

+    /**

+     * Application name of the application to be used when the application.xml file is auto-generated. Since JavaEE6.

+     */

+    @Parameter

+    private String applicationName;

+

+    /**

+     * Display name of the application to be used when the application.xml file is auto-generated.

+     */

+    @Parameter( defaultValue = "${project.artifactId}" )

+    private String displayName;

+

+    /**

+     * Description of the application to be used when the application.xml file is auto-generated.

+     */

+    @Parameter( defaultValue = "${project.description}" )

+    private String description;

+

+    /**

+     * Defines how the <tt>library-directory</tt> element should be written in the application.xml file.

+     * <p/>

+     * Three special values can be set:

+     * <ul>

+     * <li><code>DEFAULT</code> (default) generates a <tt>library-directory</tt> element with the value of the

+     * <tt>defaultLibBundleDir</tt> parameter</li>

+     * <li><code>EMPTY</code> generates an empty <tt>library-directory</tt> element. Per spec, this disables the

+     * scanning of jar files in the <tt>lib</tt> directory of the ear file</li>

+     * <li><code>NONE</code> does not write the library-directory element at all. A corner case that can be used in

+     * Oracle Weblogic to delegate the classloading to the container</li>

+     * </ul>

+     * <p/>

+     * Since JavaEE5.

+     */

+    @Parameter( defaultValue = DEFAULT )

+    private String libraryDirectoryMode;

+

+    /**

+     * Defines the value of the initialize in order element to be used when the application.xml file is auto-generated.

+     * When set to true, modules must be initialized in the order they're listed in this deployment descriptor, with the

+     * exception of application client modules, which can be initialized in any order. If initialize-in-order is not set

+     * or set to false, the order of initialization is unspecified and may be product-dependent. Since JavaEE6.

+     */

+    @Parameter

+    private Boolean initializeInOrder;

+

+    /**

+     * Defines the application id used when generating the deployment descriptor.

+     * 

+     * @since 2.9

+     */

+    @Parameter

+    private String applicationId;

+

+    /**

+     * The security-roles to be added to the auto-generated application.xml file.

+     */

+    @Parameter

+    private PlexusConfiguration security;

+

+    /**

+     * The env-entries to be added to the auto-generated application.xml file. Since JavaEE6.

+     */

+    @Parameter( alias = "env-entries" )

+    private PlexusConfiguration envEntries;

+

+    /**

+     * The {@code ejb-ref} entries.

+     */

+    @Parameter( alias = "ejb-refs" )

+    private PlexusConfiguration ejbRefs;

+

+    /**

+     * {@inheritDoc}

+     */

+    public void execute()

+        throws MojoExecutionException, MojoFailureException

+    {

+        // Initializes ear modules

+        super.execute();

+

+        // Handle application.xml

+        if ( !generateApplicationXml )

+        {

+            getLog().debug( "Generation of application.xml is disabled" );

+        }

+        else

+        {

+            final JavaEEVersion javaEEVersion = JavaEEVersion.getJavaEEVersion( version );

+

+            // Generate deployment descriptor and copy it to the build directory

+            getLog().info( "Generating application.xml" );

+            try

+            {

+                generateStandardDeploymentDescriptor( javaEEVersion );

+            }

+            catch ( EarPluginException e )

+            {

+                throw new MojoExecutionException( "Failed to generate application.xml", e );

+            }

+

+            try

+            {

+                FileUtils.copyFileToDirectory( new File( generatedDescriptorLocation, "application.xml" ),

+                                               new File( getWorkDirectory(), "META-INF" ) );

+            }

+            catch ( IOException e )

+            {

+                throw new MojoExecutionException( "Unable to copy application.xml to final destination", e );

+            }

+        }

+

+        // Handle jboss-app.xml

+        if ( getJbossConfiguration() == null )

+        {

+            getLog().debug( "Generation of jboss-app.xml is disabled" );

+        }

+        else

+        {

+            // Generate deployment descriptor and copy it to the build directory

+            getLog().info( "Generating jboss-app.xml" );

+            try

+            {

+                generateJbossDeploymentDescriptor();

+            }

+            catch ( EarPluginException e )

+            {

+                throw new MojoExecutionException( "Failed to generate jboss-app.xml", e );

+            }

+

+            try

+            {

+                FileUtils.copyFileToDirectory( new File( generatedDescriptorLocation, "jboss-app.xml" ),

+                                               new File( getWorkDirectory(), "META-INF" ) );

+            }

+            catch ( IOException e )

+            {

+                throw new MojoExecutionException( "Unable to copy jboss-app.xml to final destination", e );

+            }

+        }

+    }

+

+    /**

+     * Generates the deployment descriptor.

+     * 

+     * @param javaEEVersion {@link JavaEEVersion}

+     * @throws EarPluginException if the configuration is invalid

+     */

+    protected void generateStandardDeploymentDescriptor( JavaEEVersion javaEEVersion )

+        throws EarPluginException

+    {

+        File outputDir = new File( generatedDescriptorLocation );

+        if ( !outputDir.exists() )

+        {

+            outputDir.mkdirs();

+        }

+

+        File descriptor = new File( outputDir, "application.xml" );

+

+        final ApplicationXmlWriter writer = new ApplicationXmlWriter( javaEEVersion, encoding, generateModuleId );

+        final ApplicationXmlWriterContext context =

+            new ApplicationXmlWriterContext( descriptor, getModules(), buildSecurityRoles(), buildEnvEntries(),

+                                             buildEjbEntries(), displayName, description, getActualLibraryDirectory(),

+                                             applicationName, initializeInOrder ).setApplicationId( applicationId );

+        writer.write( context );

+    }

+

+    /**

+     * Generates the jboss deployment descriptor.

+     * 

+     * @throws EarPluginException if the configuration is invalid

+     */

+    protected void generateJbossDeploymentDescriptor()

+        throws EarPluginException

+    {

+        File outputDir = new File( generatedDescriptorLocation );

+        if ( !outputDir.exists() )

+        {

+            outputDir.mkdirs();

+        }

+

+        File descriptor = new File( outputDir, "jboss-app.xml" );

+

+        JbossAppXmlWriter writer = new JbossAppXmlWriter( encoding );

+        writer.write( descriptor, getJbossConfiguration(), getModules() );

+    }

+

+    /**

+     * Builds the security roles based on the configuration.

+     * 

+     * @return a list of SecurityRole object(s)

+     * @throws EarPluginException if the configuration is invalid

+     */

+    private List<SecurityRole> buildSecurityRoles()

+        throws EarPluginException

+    {

+        final List<SecurityRole> result = new ArrayList<SecurityRole>();

+        if ( security == null )

+        {

+            return result;

+        }

+        final PlexusConfiguration[] securityRoles = security.getChildren( SecurityRole.SECURITY_ROLE );

+

+        for ( PlexusConfiguration securityRole : securityRoles )

+        {

+            final String id = securityRole.getAttribute( SecurityRole.ID_ATTRIBUTE );

+            final String childRoleName = securityRole.getChild( SecurityRole.ROLE_NAME ).getValue();

+            final String childRoleNameId =

+                securityRole.getChild( SecurityRole.ROLE_NAME ).getAttribute( SecurityRole.ID_ATTRIBUTE );

+            final String childDescription = securityRole.getChild( SecurityRole.DESCRIPTION ).getValue();

+            final String childDescriptionId =

+                securityRole.getChild( SecurityRole.DESCRIPTION ).getAttribute( SecurityRole.ID_ATTRIBUTE );

+

+            if ( childRoleName == null )

+            {

+                throw new EarPluginException( "Invalid security-role configuration, role-name could not be null." );

+            }

+            else

+            {

+                result.add( new SecurityRole( childRoleName, childRoleNameId, id, childDescription,

+                                              childDescriptionId ) );

+            }

+        }

+        return result;

+    }

+

+    /**

+     * This help method was needed otherwise the interpolate method of interpolator will make an empty string of a

+     * {@code null} element which results in supplemental elements for env-entry.

+     * 

+     * @param interpolator The interpolator

+     * @param element The element

+     * @return The interpolated elements.

+     * @throws InterpolationException in case of an error.

+     */

+    private String interpolate( Interpolator interpolator, String element )

+        throws InterpolationException

+    {

+        if ( element == null )

+        {

+            return element;

+        }

+        else

+        {

+            return interpolator.interpolate( element );

+        }

+    }

+

+    /**

+     * Builds the env-entries based on the configuration.

+     * 

+     * @return a list of EnvEntry object(s)

+     * @throws EarPluginException if the configuration is invalid

+     */

+    private List<EnvEntry> buildEnvEntries()

+        throws EarPluginException

+    {

+        final List<EnvEntry> result = new ArrayList<EnvEntry>();

+        if ( envEntries == null )

+        {

+            return result;

+        }

+        try

+        {

+            StringSearchInterpolator ssi = new StringSearchInterpolator();

+            ValueSource vs = new MapBasedValueSource( project.getProperties() );

+            ssi.addValueSource( vs );

+

+            final PlexusConfiguration[] allEnvEntries = envEntries.getChildren( EnvEntry.ENV_ENTRY );

+

+            for ( PlexusConfiguration envEntry : allEnvEntries )

+            {

+                // CHECKSTYLE_OFF: LineLength

+                final String childDescription =

+                    interpolate( ssi, envEntry.getChild( EnvEntry.DESCRIPTION ).getValue() );

+                final String childEnvEntryName =

+                    interpolate( ssi, envEntry.getChild( EnvEntry.ENV_ENTRY_NAME ).getValue() );

+                final String childEnvEntryType =

+                    interpolate( ssi, envEntry.getChild( EnvEntry.ENV_ENTRY_TYPE ).getValue() );

+                final String childEnvEntryValue =

+                    interpolate( ssi, envEntry.getChild( EnvEntry.ENV_ENTRY_VALUE ).getValue() );

+                // CHECKSTYLE_ON: LineLength

+

+                try

+                {

+                    result.add( new EnvEntry( childDescription, childEnvEntryName, childEnvEntryType,

+                                              childEnvEntryValue ) );

+                }

+                catch ( IllegalArgumentException e )

+                {

+                    throw new EarPluginException( "Invalid env-entry [" + envEntry + "]", e );

+                }

+            }

+            return result;

+        }

+        catch ( InterpolationException e )

+        {

+            throw new EarPluginException( "Interpolation exception:", e );

+        }

+

+    }

+

+    /**

+     * Builds the ejb-ref based on the configuration.

+     * 

+     * @return a list of EjbRef object(s)

+     * @throws EarPluginException if the configuration is invalid

+     */

+    private List<EjbRef> buildEjbEntries()

+        throws EarPluginException

+    {

+        final List<EjbRef> result = new ArrayList<EjbRef>();

+        if ( ejbRefs == null )

+        {

+            return result;

+        }

+        try

+        {

+            StringSearchInterpolator ssi = new StringSearchInterpolator();

+            ValueSource vs = new MapBasedValueSource( project.getProperties() );

+            ssi.addValueSource( vs );

+

+            final PlexusConfiguration[] allEjbEntries = ejbRefs.getChildren( EjbRef.EJB_REF );

+

+            for ( PlexusConfiguration ejbEntry : allEjbEntries )

+            {

+                // CHECKSTYLE_OFF: LineLength

+                final String childDescription =

+                    interpolate( ssi, ejbEntry.getChild( EnvEntry.DESCRIPTION ).getValue() );

+                final String childEjbEntryName = interpolate( ssi, ejbEntry.getChild( EjbRef.EJB_NAME ).getValue() );

+                final String childEjbEntryType = interpolate( ssi, ejbEntry.getChild( EjbRef.EJB_TYPE ).getValue() );

+                final String childEjbLookupNameValue =

+                    interpolate( ssi, ejbEntry.getChild( EjbRef.EJB_LOOKUP_NAME ).getValue() );

+                // CHECKSTYLE_ON: LineLength

+

+                try

+                {

+                    result.add( new EjbRef( childDescription, childEjbEntryName, childEjbEntryType,

+                                            childEjbLookupNameValue ) );

+                }

+                catch ( IllegalArgumentException e )

+                {

+                    throw new EarPluginException( "Invalid ejb-ref [" + ejbEntry + "]", e );

+                }

+            }

+            return result;

+        }

+        catch ( InterpolationException e )

+        {

+            throw new EarPluginException( "Interpolation exception:", e );

+        }

+

+    }

+

+    /**

+     * Returns the value to use for the <tt>library-directory</tt> element, based on the library directory mode.

+     */

+    private String getActualLibraryDirectory()

+        throws EarPluginException

+    {

+        final String mode = libraryDirectoryMode == null ? DEFAULT : libraryDirectoryMode.toUpperCase();

+

+        if ( DEFAULT.equals( mode ) )

+        {

+            return defaultLibBundleDir;

+        }

+        else if ( EMPTY.equals( mode ) )

+        {

+            return "";

+        }

+        else if ( NONE.equals( mode ) )

+        {

+            return null;

+        }

+        else

+        {

+            throw new EarPluginException( "Unsupported library directory mode [" + libraryDirectoryMode

+                + "] Supported modes " + ( Arrays.asList( DEFAULT, EMPTY, NONE ) ) );

+        }

+    }

 }
\ No newline at end of file
diff --git a/src/main/java/org/apache/maven/plugin/ear/HarModule.java b/src/main/java/org/apache/maven/plugins/ear/HarModule.java
similarity index 94%
rename from src/main/java/org/apache/maven/plugin/ear/HarModule.java
rename to src/main/java/org/apache/maven/plugins/ear/HarModule.java
index 852ea88..0f38df6 100644
--- a/src/main/java/org/apache/maven/plugin/ear/HarModule.java
+++ b/src/main/java/org/apache/maven/plugins/ear/HarModule.java
@@ -1,79 +1,79 @@
-package org.apache.maven.plugin.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.codehaus.plexus.util.xml.XMLWriter;
-
-/**
- * The {@link EarModule} implementation for a JBoss Hibernate archive.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public class HarModule
-    extends AbstractEarModule
-    implements JbossEarModule
-{
-    /**
-     * Create an instance.
-     */
-    public HarModule()
-    {
-    }
-
-    /**
-     * @param a {@link Artifact}
-     */
-    public HarModule( Artifact a )
-    {
-        super( a );
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void appendModule( XMLWriter writer, String version, Boolean generateId )
-    {
-        // No entry is generated by this artifact ; it should be
-        // defined in the jboss-app.xml.
-        // See http://docs.jboss.org/jbossas/getting_started/v4/html/hibernate.html
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void appendJbossModule( XMLWriter writer, String version )
-    {
-        writer.startElement( MODULE_ELEMENT );
-        writer.startElement( "har" );
-        writer.writeText( getUri() );
-        writer.endElement();
-        writer.endElement();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getType()
-    {
-        return "har";
-    }
-}
+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.codehaus.plexus.util.xml.XMLWriter;

+

+/**

+ * The {@link EarModule} implementation for a JBoss Hibernate archive.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: HarModule.java 1645331 2014-12-13 17:31:09Z khmarbaise $

+ */

+public class HarModule

+    extends AbstractEarModule

+    implements JbossEarModule

+{

+    /**

+     * Create an instance.

+     */

+    public HarModule()

+    {

+    }

+

+    /**

+     * @param a {@link Artifact}

+     */

+    public HarModule( Artifact a )

+    {

+        super( a );

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public void appendModule( XMLWriter writer, String version, Boolean generateId )

+    {

+        // No entry is generated by this artifact ; it should be

+        // defined in the jboss-app.xml.

+        // See http://docs.jboss.org/jbossas/getting_started/v4/html/hibernate.html

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public void appendJbossModule( XMLWriter writer, String version )

+    {

+        writer.startElement( MODULE_ELEMENT );

+        writer.startElement( "har" );

+        writer.writeText( getUri() );

+        writer.endElement();

+        writer.endElement();

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public String getType()

+    {

+        return "har";

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/JarModule.java b/src/main/java/org/apache/maven/plugins/ear/JarModule.java
similarity index 94%
rename from src/main/java/org/apache/maven/plugin/ear/JarModule.java
rename to src/main/java/org/apache/maven/plugins/ear/JarModule.java
index e2b63de..fd59898 100644
--- a/src/main/java/org/apache/maven/plugin/ear/JarModule.java
+++ b/src/main/java/org/apache/maven/plugins/ear/JarModule.java
@@ -1,123 +1,123 @@
-package org.apache.maven.plugin.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 a non J2EE module such as third party libraries.
- * <p/>
- * Such module is not incorporated in the generated <tt>application.xml<tt>
- * but some application servers support it. To include it in the generated
- * deployment descriptor anyway, set the <tt>includeInApplicationXml</tt> boolean flag.
- * <p/>
- * This class deprecates {@link org.apache.maven.plugin.ear.JavaModule}.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public class JarModule
-    extends AbstractEarModule
-{
-    private Boolean includeInApplicationXml = Boolean.FALSE;
-
-    /**
-     * Create an instance.
-     */
-    public JarModule()
-    {
-        super();
-    }
-
-    /**
-     * @param a {@link Artifact}
-     * @param defaultLibBundleDir The default library bundle directory.
-     * @param includeInApplicationXml Include the application xml or not.
-     */
-    public JarModule( 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( JAVA_MODULE );
-            writer.writeText( getUri() );
-            writer.endElement();
-
-            writeAltDeploymentDescriptor( writer, version );
-
-            writer.endElement();
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void resolveArtifact( Set<Artifact> 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 "jar";
-    }
-
-    private void setLibBundleDir( String defaultLibBundleDir )
-    {
-        if ( defaultLibBundleDir != null && bundleDir == null )
-        {
-            this.bundleDir = defaultLibBundleDir;
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean changeManifestClasspath()
-    {
-        return false;
-    }
-}
+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 a non J2EE module such as third party libraries.

+ * <p/>

+ * Such module is not incorporated in the generated <tt>application.xml<tt>

+ * but some application servers support it. To include it in the generated

+ * deployment descriptor anyway, set the <tt>includeInApplicationXml</tt> boolean flag.

+ * <p/>

+ * This class deprecates {@link org.apache.maven.plugins.ear.JavaModule}.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: JarModule.java 1648046 2014-12-27 11:07:02Z khmarbaise $

+ */

+public class JarModule

+    extends AbstractEarModule

+{

+    private Boolean includeInApplicationXml = Boolean.FALSE;

+

+    /**

+     * Create an instance.

+     */

+    public JarModule()

+    {

+        super();

+    }

+

+    /**

+     * @param a {@link Artifact}

+     * @param defaultLibBundleDir The default library bundle directory.

+     * @param includeInApplicationXml Include the application xml or not.

+     */

+    public JarModule( 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( JAVA_MODULE );

+            writer.writeText( getUri() );

+            writer.endElement();

+

+            writeAltDeploymentDescriptor( writer, version );

+

+            writer.endElement();

+        }

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public void resolveArtifact( Set<Artifact> 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 "jar";

+    }

+

+    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/plugin/ear/JbossAppXmlWriter.java b/src/main/java/org/apache/maven/plugins/ear/JbossAppXmlWriter.java
similarity index 98%
rename from src/main/java/org/apache/maven/plugin/ear/JbossAppXmlWriter.java
rename to src/main/java/org/apache/maven/plugins/ear/JbossAppXmlWriter.java
index 52d533d..938231e 100644
--- a/src/main/java/org/apache/maven/plugin/ear/JbossAppXmlWriter.java
+++ b/src/main/java/org/apache/maven/plugins/ear/JbossAppXmlWriter.java
@@ -1,191 +1,191 @@
-package org.apache.maven.plugin.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 java.io.File;
-import java.io.Writer;
-import java.util.List;
-
-import org.codehaus.plexus.util.xml.XMLWriter;
-
-/**
- * An <tt>XmlWriter</tt> based implementation used to generate a <tt>jboss-app.xml</tt> file
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-final class JbossAppXmlWriter
-    extends AbstractXmlWriter
-{
-
-    public static final String DOCTYPE_3_2 = "jboss-app PUBLIC\n" + "\t\"-//JBoss//DTD J2EE Application 1.3//EN\"\n"
-        + "\t\"http://www.jboss.org/j2ee/dtd/jboss-app_3_2.dtd\"";
-
-    public static final String DOCTYPE_4 = "jboss-app PUBLIC\n" + "\t\"-//JBoss//DTD J2EE Application 1.4//EN\"\n"
-        + "\t\"http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd\"";
-
-    public static final String DOCTYPE_4_2 = "jboss-app PUBLIC\n" + "\t\"-//JBoss//DTD J2EE Application 4.2//EN\"\n"
-        + "\t\"http://www.jboss.org/j2ee/dtd/jboss-app_4_2.dtd\"";
-
-    public static final String DOCTYPE_5 = "jboss-app PUBLIC\n" + "\t\"-//JBoss//DTD Java EE Application 5.0//EN\"\n"
-        + "\t\"http://www.jboss.org/j2ee/dtd/jboss-app_5_0.dtd\"";
-
-    private static final String JBOSS_APP_ELEMENT = "jboss-app";
-
-    JbossAppXmlWriter( String encoding )
-    {
-        super( encoding );
-    }
-
-    public void write( File destinationFile, JbossConfiguration jbossConfiguration, List<EarModule> earModules )
-        throws EarPluginException
-    {
-        final Writer w = initializeWriter( destinationFile );
-
-        XMLWriter writer;
-        if ( jbossConfiguration.isJbossThreeDotTwo() )
-        {
-            writer = initializeXmlWriter( w, DOCTYPE_3_2 );
-        }
-        else if ( jbossConfiguration.isJbossFour() )
-        {
-            writer = initializeXmlWriter( w, DOCTYPE_4 );
-        }
-        else if ( jbossConfiguration.isJbossFourDotTwo() )
-        {
-            writer = initializeXmlWriter( w, DOCTYPE_4_2 );
-        }
-        else
-        {
-            writer = initializeXmlWriter( w, DOCTYPE_5 );
-        }
-        writer.startElement( JBOSS_APP_ELEMENT );
-
-        // Make sure to write the things in the right order so that the DTD validates
-
-        // module-order (only available as from 4.2)
-        if ( jbossConfiguration.isJbossFourDotTwoOrHigher() && jbossConfiguration.getModuleOrder() != null )
-        {
-            writer.startElement( JbossConfiguration.MODULE_ORDER );
-            writer.writeText( jbossConfiguration.getModuleOrder() );
-            writer.endElement();
-        }
-
-        // If JBoss 4, write the jboss4 specific stuff
-        if ( jbossConfiguration.isJbossFourOrHigher() )
-        {
-            if ( jbossConfiguration.getSecurityDomain() != null )
-            {
-                writer.startElement( JbossConfiguration.SECURITY_DOMAIN );
-                writer.writeText( jbossConfiguration.getSecurityDomain() );
-                writer.endElement();
-            }
-            if ( jbossConfiguration.getUnauthenticatedPrincipal() != null )
-            {
-                writer.startElement( JbossConfiguration.UNAUHTHENTICTED_PRINCIPAL );
-                writer.writeText( jbossConfiguration.getUnauthenticatedPrincipal() );
-                writer.endElement();
-            }
-        }
-
-        // classloader repository
-        // CHECKSTYLE_OFF: LineLength
-        if ( jbossConfiguration.getLoaderRepository() != null || jbossConfiguration.getLoaderRepositoryConfig() != null )
-        // CHECKSTYLE_ON: LineLength
-        {
-            writer.startElement( JbossConfiguration.LOADER_REPOSITORY );
-
-            // classloader repository class
-            if ( jbossConfiguration.getLoaderRepositoryClass() != null )
-            {
-                writer.addAttribute( JbossConfiguration.LOADER_REPOSITORY_CLASS_ATTRIBUTE,
-                                     jbossConfiguration.getLoaderRepositoryClass() );
-            }
-
-            // we don't need to write any text if only the loader repo configuration is changed
-            if ( jbossConfiguration.getLoaderRepository() != null )
-            {
-                writer.writeText( jbossConfiguration.getLoaderRepository() );
-            }
-
-            // classloader configuration
-            if ( jbossConfiguration.getLoaderRepositoryConfig() != null )
-            {
-                writer.startElement( JbossConfiguration.LOADER_REPOSITORY_CONFIG );
-
-                // classloader configuration parser
-                if ( jbossConfiguration.getConfigParserClass() != null )
-                {
-                    writer.addAttribute( JbossConfiguration.CONFIG_PARSER_CLASS_ATTRIBUTE,
-                                         jbossConfiguration.getConfigParserClass() );
-                }
-                writer.writeText( jbossConfiguration.getLoaderRepositoryConfig() );
-                writer.endElement();
-            }
-
-            writer.endElement();
-        }
-
-        // jmx name
-        if ( jbossConfiguration.getJmxName() != null )
-        {
-            writer.startElement( JbossConfiguration.JMX_NAME );
-            writer.writeText( jbossConfiguration.getJmxName() );
-            writer.endElement();
-        }
-
-        // library-directory (only available as from 4.2)
-        if ( jbossConfiguration.isJbossFourDotTwoOrHigher() && jbossConfiguration.getLibraryDirectory() != null )
-        {
-            writer.startElement( JbossConfiguration.LIBRARY_DIRECTORY );
-            writer.writeText( jbossConfiguration.getLibraryDirectory() );
-            writer.endElement();
-        }
-
-        // Modules
-
-        List<String> dataSources = jbossConfiguration.getDataSources();
-        // Write out data source modules first
-        if ( dataSources != null )
-        {
-            for ( String dsPath : dataSources )
-            {
-                writer.startElement( MODULE_ELEMENT );
-                writer.startElement( SERVICE_ELEMENT );
-                writer.writeText( dsPath );
-                writer.endElement();
-                writer.endElement();
-            }
-        }
-
-        // Write the JBoss specific modules
-        for ( EarModule earModule : earModules )
-        {
-            if ( JbossEarModule.class.isInstance( earModule ) )
-            {
-                JbossEarModule jbossEarModule = (JbossEarModule) earModule;
-                jbossEarModule.appendJbossModule( writer, jbossConfiguration.getVersion() );
-            }
-        }
-        writer.endElement();
-
-        close( w );
-    }
+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 java.io.File;

+import java.io.Writer;

+import java.util.List;

+

+import org.codehaus.plexus.util.xml.XMLWriter;

+

+/**

+ * An <tt>XmlWriter</tt> based implementation used to generate a <tt>jboss-app.xml</tt> file

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: JbossAppXmlWriter.java 1636449 2014-11-03 21:27:36Z khmarbaise $

+ */

+final class JbossAppXmlWriter

+    extends AbstractXmlWriter

+{

+

+    public static final String DOCTYPE_3_2 = "jboss-app PUBLIC\n" + "\t\"-//JBoss//DTD J2EE Application 1.3//EN\"\n"

+        + "\t\"http://www.jboss.org/j2ee/dtd/jboss-app_3_2.dtd\"";

+

+    public static final String DOCTYPE_4 = "jboss-app PUBLIC\n" + "\t\"-//JBoss//DTD J2EE Application 1.4//EN\"\n"

+        + "\t\"http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd\"";

+

+    public static final String DOCTYPE_4_2 = "jboss-app PUBLIC\n" + "\t\"-//JBoss//DTD J2EE Application 4.2//EN\"\n"

+        + "\t\"http://www.jboss.org/j2ee/dtd/jboss-app_4_2.dtd\"";

+

+    public static final String DOCTYPE_5 = "jboss-app PUBLIC\n" + "\t\"-//JBoss//DTD Java EE Application 5.0//EN\"\n"

+        + "\t\"http://www.jboss.org/j2ee/dtd/jboss-app_5_0.dtd\"";

+

+    private static final String JBOSS_APP_ELEMENT = "jboss-app";

+

+    JbossAppXmlWriter( String encoding )

+    {

+        super( encoding );

+    }

+

+    public void write( File destinationFile, JbossConfiguration jbossConfiguration, List<EarModule> earModules )

+        throws EarPluginException

+    {

+        final Writer w = initializeWriter( destinationFile );

+

+        XMLWriter writer;

+        if ( jbossConfiguration.isJbossThreeDotTwo() )

+        {

+            writer = initializeXmlWriter( w, DOCTYPE_3_2 );

+        }

+        else if ( jbossConfiguration.isJbossFour() )

+        {

+            writer = initializeXmlWriter( w, DOCTYPE_4 );

+        }

+        else if ( jbossConfiguration.isJbossFourDotTwo() )

+        {

+            writer = initializeXmlWriter( w, DOCTYPE_4_2 );

+        }

+        else

+        {

+            writer = initializeXmlWriter( w, DOCTYPE_5 );

+        }

+        writer.startElement( JBOSS_APP_ELEMENT );

+

+        // Make sure to write the things in the right order so that the DTD validates

+

+        // module-order (only available as from 4.2)

+        if ( jbossConfiguration.isJbossFourDotTwoOrHigher() && jbossConfiguration.getModuleOrder() != null )

+        {

+            writer.startElement( JbossConfiguration.MODULE_ORDER );

+            writer.writeText( jbossConfiguration.getModuleOrder() );

+            writer.endElement();

+        }

+

+        // If JBoss 4, write the jboss4 specific stuff

+        if ( jbossConfiguration.isJbossFourOrHigher() )

+        {

+            if ( jbossConfiguration.getSecurityDomain() != null )

+            {

+                writer.startElement( JbossConfiguration.SECURITY_DOMAIN );

+                writer.writeText( jbossConfiguration.getSecurityDomain() );

+                writer.endElement();

+            }

+            if ( jbossConfiguration.getUnauthenticatedPrincipal() != null )

+            {

+                writer.startElement( JbossConfiguration.UNAUHTHENTICTED_PRINCIPAL );

+                writer.writeText( jbossConfiguration.getUnauthenticatedPrincipal() );

+                writer.endElement();

+            }

+        }

+

+        // classloader repository

+        // CHECKSTYLE_OFF: LineLength

+        if ( jbossConfiguration.getLoaderRepository() != null || jbossConfiguration.getLoaderRepositoryConfig() != null )

+        // CHECKSTYLE_ON: LineLength

+        {

+            writer.startElement( JbossConfiguration.LOADER_REPOSITORY );

+

+            // classloader repository class

+            if ( jbossConfiguration.getLoaderRepositoryClass() != null )

+            {

+                writer.addAttribute( JbossConfiguration.LOADER_REPOSITORY_CLASS_ATTRIBUTE,

+                                     jbossConfiguration.getLoaderRepositoryClass() );

+            }

+

+            // we don't need to write any text if only the loader repo configuration is changed

+            if ( jbossConfiguration.getLoaderRepository() != null )

+            {

+                writer.writeText( jbossConfiguration.getLoaderRepository() );

+            }

+

+            // classloader configuration

+            if ( jbossConfiguration.getLoaderRepositoryConfig() != null )

+            {

+                writer.startElement( JbossConfiguration.LOADER_REPOSITORY_CONFIG );

+

+                // classloader configuration parser

+                if ( jbossConfiguration.getConfigParserClass() != null )

+                {

+                    writer.addAttribute( JbossConfiguration.CONFIG_PARSER_CLASS_ATTRIBUTE,

+                                         jbossConfiguration.getConfigParserClass() );

+                }

+                writer.writeText( jbossConfiguration.getLoaderRepositoryConfig() );

+                writer.endElement();

+            }

+

+            writer.endElement();

+        }

+

+        // jmx name

+        if ( jbossConfiguration.getJmxName() != null )

+        {

+            writer.startElement( JbossConfiguration.JMX_NAME );

+            writer.writeText( jbossConfiguration.getJmxName() );

+            writer.endElement();

+        }

+

+        // library-directory (only available as from 4.2)

+        if ( jbossConfiguration.isJbossFourDotTwoOrHigher() && jbossConfiguration.getLibraryDirectory() != null )

+        {

+            writer.startElement( JbossConfiguration.LIBRARY_DIRECTORY );

+            writer.writeText( jbossConfiguration.getLibraryDirectory() );

+            writer.endElement();

+        }

+

+        // Modules

+

+        List<String> dataSources = jbossConfiguration.getDataSources();

+        // Write out data source modules first

+        if ( dataSources != null )

+        {

+            for ( String dsPath : dataSources )

+            {

+                writer.startElement( MODULE_ELEMENT );

+                writer.startElement( SERVICE_ELEMENT );

+                writer.writeText( dsPath );

+                writer.endElement();

+                writer.endElement();

+            }

+        }

+

+        // Write the JBoss specific modules

+        for ( EarModule earModule : earModules )

+        {

+            if ( JbossEarModule.class.isInstance( earModule ) )

+            {

+                JbossEarModule jbossEarModule = (JbossEarModule) earModule;

+                jbossEarModule.appendJbossModule( writer, jbossConfiguration.getVersion() );

+            }

+        }

+        writer.endElement();

+

+        close( w );

+    }

 }
\ No newline at end of file
diff --git a/src/main/java/org/apache/maven/plugin/ear/JbossConfiguration.java b/src/main/java/org/apache/maven/plugins/ear/JbossConfiguration.java
similarity index 98%
rename from src/main/java/org/apache/maven/plugin/ear/JbossConfiguration.java
rename to src/main/java/org/apache/maven/plugins/ear/JbossConfiguration.java
index bb1bee5..e79283a 100644
--- a/src/main/java/org/apache/maven/plugin/ear/JbossConfiguration.java
+++ b/src/main/java/org/apache/maven/plugins/ear/JbossConfiguration.java
@@ -1,360 +1,360 @@
-package org.apache.maven.plugin.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 java.util.List;
-
-/**
- * The JBoss specific configuration, used to generate the jboss-app.xml deployment descriptor file
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-class JbossConfiguration
-{
-    static final String VERSION_3_2 = "3.2";
-
-    static final String VERSION_4 = "4";
-
-    static final String VERSION_4_2 = "4.2";
-
-    static final String VERSION_5 = "5";
-
-    static final String VERSION = "version";
-
-    static final String SECURITY_DOMAIN = "security-domain";
-
-    static final String UNAUHTHENTICTED_PRINCIPAL = "unauthenticated-principal";
-
-    static final String JMX_NAME = "jmx-name";
-
-    static final String LOADER_REPOSITORY = "loader-repository";
-
-    static final String LOADER_REPOSITORY_CLASS_ATTRIBUTE = "loaderRepositoryClass";
-
-    static final String LOADER_REPOSITORY_CONFIG = "loader-repository-config";
-
-    static final String CONFIG_PARSER_CLASS_ATTRIBUTE = "configParserClass";
-
-    static final String MODULE_ORDER = "module-order";
-
-    static final String DATASOURCES = "data-sources";
-
-    static final String DATASOURCE = "data-source";
-
-    static final String LIBRARY_DIRECTORY = "library-directory";
-
-    private final String version;
-
-    private boolean jbossThreeDotTwo;
-
-    private boolean jbossFour;
-
-    private boolean jbossFourDotTwo;
-
-    private boolean jbossFive;
-
-    private final String securityDomain;
-
-    private final String unauthenticatedPrincipal;
-
-    private final String jmxName;
-
-    private final String loaderRepository;
-
-    private final String loaderRepositoryConfig;
-
-    private final String loaderRepositoryClass;
-
-    private final String configParserClass;
-
-    private final String moduleOrder;
-
-    private final List<String> dataSources;
-
-    private final String libraryDirectory;
-
-    public JbossConfiguration( String version, String securityDomain, String unauthenticatedPrincipal, String jmxName,
-                               String loaderRepository, String moduleOrder, List<String> dataSources,
-                               String libraryDirectory, String loaderRepositoryConfig, String loaderRepositoryClass,
-                               String configParserClass )
-        throws EarPluginException
-    {
-        if ( version == null )
-        {
-            throw new EarPluginException( "jboss version could not be null." );
-        }
-        else
-        {
-            this.version = version;
-            if ( version.equals( JbossConfiguration.VERSION_3_2 ) )
-            {
-                this.jbossThreeDotTwo = true;
-            }
-            else if ( version.equals( JbossConfiguration.VERSION_4 ) )
-            {
-                this.jbossFour = true;
-            }
-            else if ( version.equals( JbossConfiguration.VERSION_4_2 ) )
-            {
-                this.jbossFourDotTwo = true;
-            }
-            else if ( version.equals( JbossConfiguration.VERSION_5 ) )
-            {
-                this.jbossFive = true;
-            }
-            else
-            {
-                // CHECKSTYLE_OFF: LineLength
-                throw new EarPluginException( "Invalid JBoss configuration, version[" + version + "] is not supported." );
-                // CHECKSTYLE_ON: LineLength
-            }
-            this.securityDomain = securityDomain;
-            this.unauthenticatedPrincipal = unauthenticatedPrincipal;
-            this.jmxName = jmxName;
-            this.loaderRepository = loaderRepository;
-            this.moduleOrder = moduleOrder;
-            this.dataSources = dataSources;
-            this.libraryDirectory = libraryDirectory;
-            this.loaderRepositoryConfig = loaderRepositoryConfig;
-            this.loaderRepositoryClass = loaderRepositoryClass;
-            this.configParserClass = configParserClass;
-        }
-    }
-
-    /**
-     * Returns the targeted version of JBoss.
-     * 
-     * @return the jboss version
-     */
-    public String getVersion()
-    {
-        return version;
-    }
-
-    /**
-     * Returns true if the targeted JBoss version is 3.2.
-     * 
-     * @return if the targeted version is 3.2
-     */
-    public boolean isJbossThreeDotTwo()
-    {
-        return jbossThreeDotTwo;
-    }
-
-    /**
-     * Returns true if the targeted JBoss version is 4.
-     * 
-     * @return if the targeted version is 4
-     */
-    public boolean isJbossFour()
-    {
-        return jbossFour;
-    }
-
-    /**
-     * Returns true if the targeted JBoss version if 4 or higher (that is 4, 4.2 or 5).
-     * 
-     * @return true if the targeted version is 4+
-     */
-    public boolean isJbossFourOrHigher()
-    {
-        return jbossFour || jbossFourDotTwo || jbossFive;
-    }
-
-    /**
-     * Returns true if the targeted JBoss version is 4.2.
-     * 
-     * @return if the targeted version is 4.2
-     */
-    public boolean isJbossFourDotTwo()
-    {
-        return jbossFourDotTwo;
-    }
-
-    /**
-     * Returns true if the targeted JBoss version if 4.2 or higher (that is 4.2 or 5).
-     * 
-     * @return true if the targeted version is 4.2+
-     */
-    public boolean isJbossFourDotTwoOrHigher()
-    {
-        return jbossFourDotTwo || jbossFive;
-    }
-
-    /**
-     * Returns true if the targeted JBoss version is 5.
-     * 
-     * @return if the targeted version is 5
-     */
-    public boolean isJbossFive()
-    {
-        return jbossFive;
-    }
-
-    /**
-     * The security-domain element specifies the JNDI name of the security manager that implements the
-     * EJBSecurityManager and RealmMapping for the domain. When specified at the jboss level it specifies the security
-     * domain for all j2ee components in the deployment unit.
-     * <p/>
-     * One can override the global security-domain at the container level using the security-domain element at the
-     * container-configuration level.
-     * <p/>
-     * Only available as from JBoss 4.
-     * 
-     * @return the JNDI name of the security manager
-     */
-    public String getSecurityDomain()
-    {
-        return securityDomain;
-    }
-
-    /**
-     * The unauthenticated-principal element specifies the name of the principal that will be returned by the
-     * EJBContext.getCallerPrincipal() method if there is no authenticated user. This Principal has no roles or
-     * privileges to call any other beans.
-     * <p/>
-     * Only available as from JBoss 4.
-     * 
-     * @return the unauthenticated principal
-     */
-    public String getUnauthenticatedPrincipal()
-    {
-        return unauthenticatedPrincipal;
-    }
-
-    /**
-     * The jmx-name element allows one to specify the JMX ObjectName to use for the MBean associated with the ear
-     * module. This must be a unique name and valid JMX ObjectName string.
-     * 
-     * @return the object name of the ear mbean
-     */
-    public String getJmxName()
-    {
-        return jmxName;
-    }
-
-    /**
-     * The loader-repository specifies the name of the UnifiedLoaderRepository MBean to use for the ear to provide ear
-     * level scoping of classes deployed in the ear. It is a unique JMX ObjectName string.
-     * <p/>
-     * <P>
-     * Example:
-     * </P>
-     * &lt;loader-repository>jboss.test:loader=cts-cmp2v1-sar.ear&lt;/loader-repository>
-     * 
-     * @return the object name of the ear mbean
-     */
-    public String getLoaderRepository()
-    {
-        return loaderRepository;
-    }
-
-    /**
-     * The module-order specifies the order in which the modules specified in the application.xml file gets loaded.
-     * Allowed values are:
-     * <p/>
-     * <module-order>strict</module-order> The strict value indicates that the deployments of the modules will be done
-     * in the order that would be specified in the application.xml and jboss-app.xml file.
-     * <p/>
-     * <module-order>implicit</module-order> The implicit value indicates the deployment would follow the order which
-     * would be specified in the DeploymentSorter.
-     * <p/>
-     * Returns <tt>null</tt> if no module order is set.
-     * <p/>
-     * Only available in JBoss 4.2 and 4.3. Has no effect in JBoss 5 and is not added when mentioned version is used.
-     * 
-     * @return the module order
-     */
-    public String getModuleOrder()
-    {
-        return moduleOrder;
-    }
-
-    /**
-     * Returns the list of datasources to include in the <tt>jboss-app.xml</tt> file as services. Each element of the
-     * list is the relative path to the datasource file contained in the EAR archive.
-     * 
-     * @return the list of datasources paths
-     */
-    public List<String> getDataSources()
-    {
-        return dataSources;
-    }
-
-    /**
-     * Returns the library directory to include in the <tt>jboss-app.xml</tt> file. It tells JBoss where to find
-     * non-Java EE libraries included in the EAR.
-     * 
-     * @return the library directory
-     */
-    public String getLibraryDirectory()
-    {
-        return libraryDirectory;
-    }
-
-    /**
-     * Returns the class loader repository configuration to include in the <tt>jboss-app.xml</tt> file. The content of
-     * this element is handed to the class loader, thereby altering it's default behaviour.
-     * <p/>
-     * This element is added as a child to the <tt>loader-repository</tt> element. If the element is not present in the
-     * configuration, it will be added.
-     * <p/>
-     * Example: &lt;loader-repository-config>java2ParentDelegaton=true&lt;/loader-repository-config>
-     * 
-     * @return the class loader repository configuration
-     */
-    public String getLoaderRepositoryConfig()
-    {
-        return loaderRepositoryConfig;
-    }
-
-    /**
-     * Returns the class loader repository class to include in the <tt>jboss-app.xml</tt> file. It tells JBoss which
-     * loader repository implementation to use.
-     * <p/>
-     * This element is added as an attribute to the <tt>loader-repository</tt> element, therefore it is not added if no
-     * such element configuration is present.
-     * <p/>
-     * Example: &lt;loader-repository-class>org.mindbug.jboss.AlternateLoaderRepository&lt;/loader-repository-class>
-     * 
-     * @return the class loader repository class
-     */
-    public String getLoaderRepositoryClass()
-    {
-        return loaderRepositoryClass;
-    }
-
-    /**
-     * Returns the class loader's configuration parser class to include in the <tt>jboss-app.xml</tt> file. It tells
-     * JBoss how to parse the configuration given in the <tt>loader-repository-config</tt> element.
-     * <p/>
-     * This element is added as an attribute to the <tt>loader-repository-config</tt> element, therefore it is not added
-     * if no such element configuration is present.
-     * <p/>
-     * Example: &lt;config-parser-class>org.mindbug.jboss.AlternateLoaderRepositoryConfigParser&lt;/config-parser-class>
-     * 
-     * @return the class loader's configuration parser class
-     */
-    public String getConfigParserClass()
-    {
-        return configParserClass;
-    }
-}
+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 java.util.List;

+

+/**

+ * The JBoss specific configuration, used to generate the jboss-app.xml deployment descriptor file

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: JbossConfiguration.java 1636449 2014-11-03 21:27:36Z khmarbaise $

+ */

+class JbossConfiguration

+{

+    static final String VERSION_3_2 = "3.2";

+

+    static final String VERSION_4 = "4";

+

+    static final String VERSION_4_2 = "4.2";

+

+    static final String VERSION_5 = "5";

+

+    static final String VERSION = "version";

+

+    static final String SECURITY_DOMAIN = "security-domain";

+

+    static final String UNAUHTHENTICTED_PRINCIPAL = "unauthenticated-principal";

+

+    static final String JMX_NAME = "jmx-name";

+

+    static final String LOADER_REPOSITORY = "loader-repository";

+

+    static final String LOADER_REPOSITORY_CLASS_ATTRIBUTE = "loaderRepositoryClass";

+

+    static final String LOADER_REPOSITORY_CONFIG = "loader-repository-config";

+

+    static final String CONFIG_PARSER_CLASS_ATTRIBUTE = "configParserClass";

+

+    static final String MODULE_ORDER = "module-order";

+

+    static final String DATASOURCES = "data-sources";

+

+    static final String DATASOURCE = "data-source";

+

+    static final String LIBRARY_DIRECTORY = "library-directory";

+

+    private final String version;

+

+    private boolean jbossThreeDotTwo;

+

+    private boolean jbossFour;

+

+    private boolean jbossFourDotTwo;

+

+    private boolean jbossFive;

+

+    private final String securityDomain;

+

+    private final String unauthenticatedPrincipal;

+

+    private final String jmxName;

+

+    private final String loaderRepository;

+

+    private final String loaderRepositoryConfig;

+

+    private final String loaderRepositoryClass;

+

+    private final String configParserClass;

+

+    private final String moduleOrder;

+

+    private final List<String> dataSources;

+

+    private final String libraryDirectory;

+

+    public JbossConfiguration( String version, String securityDomain, String unauthenticatedPrincipal, String jmxName,

+                               String loaderRepository, String moduleOrder, List<String> dataSources,

+                               String libraryDirectory, String loaderRepositoryConfig, String loaderRepositoryClass,

+                               String configParserClass )

+        throws EarPluginException

+    {

+        if ( version == null )

+        {

+            throw new EarPluginException( "jboss version could not be null." );

+        }

+        else

+        {

+            this.version = version;

+            if ( version.equals( JbossConfiguration.VERSION_3_2 ) )

+            {

+                this.jbossThreeDotTwo = true;

+            }

+            else if ( version.equals( JbossConfiguration.VERSION_4 ) )

+            {

+                this.jbossFour = true;

+            }

+            else if ( version.equals( JbossConfiguration.VERSION_4_2 ) )

+            {

+                this.jbossFourDotTwo = true;

+            }

+            else if ( version.equals( JbossConfiguration.VERSION_5 ) )

+            {

+                this.jbossFive = true;

+            }

+            else

+            {

+                // CHECKSTYLE_OFF: LineLength

+                throw new EarPluginException( "Invalid JBoss configuration, version[" + version + "] is not supported." );

+                // CHECKSTYLE_ON: LineLength

+            }

+            this.securityDomain = securityDomain;

+            this.unauthenticatedPrincipal = unauthenticatedPrincipal;

+            this.jmxName = jmxName;

+            this.loaderRepository = loaderRepository;

+            this.moduleOrder = moduleOrder;

+            this.dataSources = dataSources;

+            this.libraryDirectory = libraryDirectory;

+            this.loaderRepositoryConfig = loaderRepositoryConfig;

+            this.loaderRepositoryClass = loaderRepositoryClass;

+            this.configParserClass = configParserClass;

+        }

+    }

+

+    /**

+     * Returns the targeted version of JBoss.

+     * 

+     * @return the jboss version

+     */

+    public String getVersion()

+    {

+        return version;

+    }

+

+    /**

+     * Returns true if the targeted JBoss version is 3.2.

+     * 

+     * @return if the targeted version is 3.2

+     */

+    public boolean isJbossThreeDotTwo()

+    {

+        return jbossThreeDotTwo;

+    }

+

+    /**

+     * Returns true if the targeted JBoss version is 4.

+     * 

+     * @return if the targeted version is 4

+     */

+    public boolean isJbossFour()

+    {

+        return jbossFour;

+    }

+

+    /**

+     * Returns true if the targeted JBoss version if 4 or higher (that is 4, 4.2 or 5).

+     * 

+     * @return true if the targeted version is 4+

+     */

+    public boolean isJbossFourOrHigher()

+    {

+        return jbossFour || jbossFourDotTwo || jbossFive;

+    }

+

+    /**

+     * Returns true if the targeted JBoss version is 4.2.

+     * 

+     * @return if the targeted version is 4.2

+     */

+    public boolean isJbossFourDotTwo()

+    {

+        return jbossFourDotTwo;

+    }

+

+    /**

+     * Returns true if the targeted JBoss version if 4.2 or higher (that is 4.2 or 5).

+     * 

+     * @return true if the targeted version is 4.2+

+     */

+    public boolean isJbossFourDotTwoOrHigher()

+    {

+        return jbossFourDotTwo || jbossFive;

+    }

+

+    /**

+     * Returns true if the targeted JBoss version is 5.

+     * 

+     * @return if the targeted version is 5

+     */

+    public boolean isJbossFive()

+    {

+        return jbossFive;

+    }

+

+    /**

+     * The security-domain element specifies the JNDI name of the security manager that implements the

+     * EJBSecurityManager and RealmMapping for the domain. When specified at the jboss level it specifies the security

+     * domain for all j2ee components in the deployment unit.

+     * <p/>

+     * One can override the global security-domain at the container level using the security-domain element at the

+     * container-configuration level.

+     * <p/>

+     * Only available as from JBoss 4.

+     * 

+     * @return the JNDI name of the security manager

+     */

+    public String getSecurityDomain()

+    {

+        return securityDomain;

+    }

+

+    /**

+     * The unauthenticated-principal element specifies the name of the principal that will be returned by the

+     * EJBContext.getCallerPrincipal() method if there is no authenticated user. This Principal has no roles or

+     * privileges to call any other beans.

+     * <p/>

+     * Only available as from JBoss 4.

+     * 

+     * @return the unauthenticated principal

+     */

+    public String getUnauthenticatedPrincipal()

+    {

+        return unauthenticatedPrincipal;

+    }

+

+    /**

+     * The jmx-name element allows one to specify the JMX ObjectName to use for the MBean associated with the ear

+     * module. This must be a unique name and valid JMX ObjectName string.

+     * 

+     * @return the object name of the ear mbean

+     */

+    public String getJmxName()

+    {

+        return jmxName;

+    }

+

+    /**

+     * The loader-repository specifies the name of the UnifiedLoaderRepository MBean to use for the ear to provide ear

+     * level scoping of classes deployed in the ear. It is a unique JMX ObjectName string.

+     * <p/>

+     * <P>

+     * Example:

+     * </P>

+     * &lt;loader-repository>jboss.test:loader=cts-cmp2v1-sar.ear&lt;/loader-repository>

+     * 

+     * @return the object name of the ear mbean

+     */

+    public String getLoaderRepository()

+    {

+        return loaderRepository;

+    }

+

+    /**

+     * The module-order specifies the order in which the modules specified in the application.xml file gets loaded.

+     * Allowed values are:

+     * <p/>

+     * <module-order>strict</module-order> The strict value indicates that the deployments of the modules will be done

+     * in the order that would be specified in the application.xml and jboss-app.xml file.

+     * <p/>

+     * <module-order>implicit</module-order> The implicit value indicates the deployment would follow the order which

+     * would be specified in the DeploymentSorter.

+     * <p/>

+     * Returns <tt>null</tt> if no module order is set.

+     * <p/>

+     * Only available in JBoss 4.2 and 4.3. Has no effect in JBoss 5 and is not added when mentioned version is used.

+     * 

+     * @return the module order

+     */

+    public String getModuleOrder()

+    {

+        return moduleOrder;

+    }

+

+    /**

+     * Returns the list of datasources to include in the <tt>jboss-app.xml</tt> file as services. Each element of the

+     * list is the relative path to the datasource file contained in the EAR archive.

+     * 

+     * @return the list of datasources paths

+     */

+    public List<String> getDataSources()

+    {

+        return dataSources;

+    }

+

+    /**

+     * Returns the library directory to include in the <tt>jboss-app.xml</tt> file. It tells JBoss where to find

+     * non-Java EE libraries included in the EAR.

+     * 

+     * @return the library directory

+     */

+    public String getLibraryDirectory()

+    {

+        return libraryDirectory;

+    }

+

+    /**

+     * Returns the class loader repository configuration to include in the <tt>jboss-app.xml</tt> file. The content of

+     * this element is handed to the class loader, thereby altering it's default behaviour.

+     * <p/>

+     * This element is added as a child to the <tt>loader-repository</tt> element. If the element is not present in the

+     * configuration, it will be added.

+     * <p/>

+     * Example: &lt;loader-repository-config>java2ParentDelegaton=true&lt;/loader-repository-config>

+     * 

+     * @return the class loader repository configuration

+     */

+    public String getLoaderRepositoryConfig()

+    {

+        return loaderRepositoryConfig;

+    }

+

+    /**

+     * Returns the class loader repository class to include in the <tt>jboss-app.xml</tt> file. It tells JBoss which

+     * loader repository implementation to use.

+     * <p/>

+     * This element is added as an attribute to the <tt>loader-repository</tt> element, therefore it is not added if no

+     * such element configuration is present.

+     * <p/>

+     * Example: &lt;loader-repository-class>org.mindbug.jboss.AlternateLoaderRepository&lt;/loader-repository-class>

+     * 

+     * @return the class loader repository class

+     */

+    public String getLoaderRepositoryClass()

+    {

+        return loaderRepositoryClass;

+    }

+

+    /**

+     * Returns the class loader's configuration parser class to include in the <tt>jboss-app.xml</tt> file. It tells

+     * JBoss how to parse the configuration given in the <tt>loader-repository-config</tt> element.

+     * <p/>

+     * This element is added as an attribute to the <tt>loader-repository-config</tt> element, therefore it is not added

+     * if no such element configuration is present.

+     * <p/>

+     * Example: &lt;config-parser-class>org.mindbug.jboss.AlternateLoaderRepositoryConfigParser&lt;/config-parser-class>

+     * 

+     * @return the class loader's configuration parser class

+     */

+    public String getConfigParserClass()

+    {

+        return configParserClass;

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/JbossEarModule.java b/src/main/java/org/apache/maven/plugins/ear/JbossEarModule.java
similarity index 91%
rename from src/main/java/org/apache/maven/plugin/ear/JbossEarModule.java
rename to src/main/java/org/apache/maven/plugins/ear/JbossEarModule.java
index 3eb7595..b8ea5b8 100644
--- a/src/main/java/org/apache/maven/plugin/ear/JbossEarModule.java
+++ b/src/main/java/org/apache/maven/plugins/ear/JbossEarModule.java
@@ -1,39 +1,39 @@
-package org.apache.maven.plugin.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.codehaus.plexus.util.xml.XMLWriter;
-
-/**
- * Represents a JBoss specific ear module.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public interface JbossEarModule
-{
-    /**
-     * Appends the <tt>XML</tt> representation of this module for the jboss-app.xml file.
-     * 
-     * @param writer the writer to use
-     * @param version the version of the <tt>jboss-app.xml</tt> file
-     */
-    void appendJbossModule( XMLWriter writer, String version );
-}
+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.codehaus.plexus.util.xml.XMLWriter;

+

+/**

+ * Represents a JBoss specific ear module.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: JbossEarModule.java 1542511 2013-11-16 13:33:56Z rfscholte $

+ */

+public interface JbossEarModule

+{

+    /**

+     * Appends the <tt>XML</tt> representation of this module for the jboss-app.xml file.

+     * 

+     * @param writer the writer to use

+     * @param version the version of the <tt>jboss-app.xml</tt> file

+     */

+    void appendJbossModule( XMLWriter writer, String version );

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/ParModule.java b/src/main/java/org/apache/maven/plugins/ear/ParModule.java
similarity index 91%
rename from src/main/java/org/apache/maven/plugin/ear/ParModule.java
rename to src/main/java/org/apache/maven/plugins/ear/ParModule.java
index 3b4f8dd..be092a7 100644
--- a/src/main/java/org/apache/maven/plugin/ear/ParModule.java
+++ b/src/main/java/org/apache/maven/plugins/ear/ParModule.java
@@ -1,58 +1,58 @@
-package org.apache.maven.plugin.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;
-
-/**
- * The {@link EarModule} implementation for a Par module.
- * 
- * @author Stephane Nicoll <snicoll@apache.org>
- * @author $Author$ (last edit)
- * @version $Revision$
- */
-public class ParModule
-    extends EjbModule
-{
-
-    /**
-     * Create an instance.
-     */
-    public ParModule()
-    {
-        super();
-    }
-
-    /**
-     * @param a {@link Artifact}
-     */
-    public ParModule( Artifact a )
-    {
-        super( a );
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getType()
-    {
-        return "par";
-    }
-}
+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;

+

+/**

+ * The {@link EarModule} implementation for a Par module.

+ * 

+ * @author Stephane Nicoll <snicoll@apache.org>

+ * @author $Author: khmarbaise $ (last edit)

+ * @version $Revision: 1645331 $

+ */

+public class ParModule

+    extends EjbModule

+{

+

+    /**

+     * Create an instance.

+     */

+    public ParModule()

+    {

+        super();

+    }

+

+    /**

+     * @param a {@link Artifact}

+     */

+    public ParModule( Artifact a )

+    {

+        super( a );

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public String getType()

+    {

+        return "par";

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/RarModule.java b/src/main/java/org/apache/maven/plugins/ear/RarModule.java
similarity index 93%
rename from src/main/java/org/apache/maven/plugin/ear/RarModule.java
rename to src/main/java/org/apache/maven/plugins/ear/RarModule.java
index 775c212..8549cfb 100644
--- a/src/main/java/org/apache/maven/plugin/ear/RarModule.java
+++ b/src/main/java/org/apache/maven/plugins/ear/RarModule.java
@@ -1,73 +1,73 @@
-package org.apache.maven.plugin.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.codehaus.plexus.util.xml.XMLWriter;
-
-/**
- * The {@link EarModule} implementation for an J2EE connector module.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public class RarModule
-    extends AbstractEarModule
-{
-    private static final String RAR_MODULE = "connector";
-
-    /**
-     * Create an instance.
-     */
-    public RarModule()
-    {
-    }
-
-    /**
-     * @param a {@link Artifact}
-     */
-    public RarModule( Artifact a )
-    {
-        super( a );
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void appendModule( XMLWriter writer, String version, Boolean generateId )
-    {
-        startModuleElement( writer, generateId );
-        writer.startElement( RAR_MODULE );
-        writer.writeText( getUri() );
-        writer.endElement();
-
-        writeAltDeploymentDescriptor( writer, version );
-
-        writer.endElement();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getType()
-    {
-        return "rar";
-    }
-}
+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.codehaus.plexus.util.xml.XMLWriter;

+

+/**

+ * The {@link EarModule} implementation for an J2EE connector module.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: RarModule.java 1660473 2015-02-17 19:33:00Z khmarbaise $

+ */

+public class RarModule

+    extends AbstractEarModule

+{

+    private static final String RAR_MODULE = "connector";

+

+    /**

+     * Create an instance.

+     */

+    public RarModule()

+    {

+    }

+

+    /**

+     * @param a {@link Artifact}

+     */

+    public RarModule( Artifact a )

+    {

+        super( a );

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public void appendModule( XMLWriter writer, String version, Boolean generateId )

+    {

+        startModuleElement( writer, generateId );

+        writer.startElement( RAR_MODULE );

+        writer.writeText( getUri() );

+        writer.endElement();

+

+        writeAltDeploymentDescriptor( writer, version );

+

+        writer.endElement();

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public String getType()

+    {

+        return "rar";

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/SarModule.java b/src/main/java/org/apache/maven/plugins/ear/SarModule.java
similarity index 94%
rename from src/main/java/org/apache/maven/plugin/ear/SarModule.java
rename to src/main/java/org/apache/maven/plugins/ear/SarModule.java
index 3b256ca..624ad80 100644
--- a/src/main/java/org/apache/maven/plugin/ear/SarModule.java
+++ b/src/main/java/org/apache/maven/plugins/ear/SarModule.java
@@ -1,92 +1,92 @@
-package org.apache.maven.plugin.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.codehaus.plexus.util.xml.XMLWriter;
-
-/**
- * The {@link EarModule} implementation for a JBoss sar module.
- * 
- * @author Stephane Nicoll <snicoll@apache.org>
- * @author $Author$ (last edit)
- * @version $Revision$
- */
-/**
- * @author kama
- *
- */
-public class SarModule
-    extends AbstractEarModule
-    implements JbossEarModule
-{
-    private static final String SAR_MODULE = "connector";
-
-    /**
-     * Create an instance.
-     */
-    public SarModule()
-    {
-    }
-
-    /**
-     * @param a {@link Artifact}
-     */
-    public SarModule( Artifact a )
-    {
-        super( a );
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void appendModule( XMLWriter writer, String version, Boolean generateId )
-    {
-        // If JBoss is not configured, add the module as a connector element
-        if ( !earExecutionContext.isJbossConfigured() )
-        {
-            startModuleElement( writer, generateId );
-            writer.startElement( SAR_MODULE );
-            writer.writeText( getUri() );
-            writer.endElement();
-            writer.endElement();
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void appendJbossModule( XMLWriter writer, String version )
-    {
-        writer.startElement( MODULE_ELEMENT );
-        writer.startElement( "service" );
-        writer.writeText( getUri() );
-        writer.endElement();
-        writer.endElement();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getType()
-    {
-        return "sar";
-    }
-}
+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.codehaus.plexus.util.xml.XMLWriter;

+

+/**

+ * The {@link EarModule} implementation for a JBoss sar module.

+ * 

+ * @author Stephane Nicoll <snicoll@apache.org>

+ * @author $Author: khmarbaise $ (last edit)

+ * @version $Revision: 1645331 $

+ */

+/**

+ * @author kama

+ *

+ */

+public class SarModule

+    extends AbstractEarModule

+    implements JbossEarModule

+{

+    private static final String SAR_MODULE = "connector";

+

+    /**

+     * Create an instance.

+     */

+    public SarModule()

+    {

+    }

+

+    /**

+     * @param a {@link Artifact}

+     */

+    public SarModule( Artifact a )

+    {

+        super( a );

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public void appendModule( XMLWriter writer, String version, Boolean generateId )

+    {

+        // If JBoss is not configured, add the module as a connector element

+        if ( !earExecutionContext.isJbossConfigured() )

+        {

+            startModuleElement( writer, generateId );

+            writer.startElement( SAR_MODULE );

+            writer.writeText( getUri() );

+            writer.endElement();

+            writer.endElement();

+        }

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public void appendJbossModule( XMLWriter writer, String version )

+    {

+        writer.startElement( MODULE_ELEMENT );

+        writer.startElement( "service" );

+        writer.writeText( getUri() );

+        writer.endElement();

+        writer.endElement();

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public String getType()

+    {

+        return "sar";

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/SecurityRole.java b/src/main/java/org/apache/maven/plugins/ear/SecurityRole.java
similarity index 96%
rename from src/main/java/org/apache/maven/plugin/ear/SecurityRole.java
rename to src/main/java/org/apache/maven/plugins/ear/SecurityRole.java
index 3b6ad0a..9ef85d8 100644
--- a/src/main/java/org/apache/maven/plugin/ear/SecurityRole.java
+++ b/src/main/java/org/apache/maven/plugins/ear/SecurityRole.java
@@ -1,135 +1,135 @@
-package org.apache.maven.plugin.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.codehaus.plexus.util.xml.XMLWriter;
-
-/**
- * The representation of a security-role entry within an application.xml file.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-class SecurityRole
-{
-
-    protected static final String SECURITY_ROLE = "security-role";
-
-    protected static final String ID_ATTRIBUTE = "id";
-
-    protected static final String DESCRIPTION = "description";
-
-    protected static final String ROLE_NAME = "role-name";
-
-    private final String roleName;
-
-    private final String roleNameId;
-
-    private final String roleId;
-
-    private final String description;
-
-    private final String descriptionId;
-
-    public SecurityRole( String roleName, String roleNameId, String roleId, String description, String descriptionId )
-    {
-        if ( roleName == null )
-        {
-            throw new NullPointerException( "role-name in security-role element could not be null." );
-        }
-        this.roleName = roleName;
-        this.roleNameId = roleNameId;
-        this.roleId = roleId;
-        this.description = description;
-        this.descriptionId = descriptionId;
-    }
-
-    public String getRoleName()
-    {
-        return roleName;
-    }
-
-    public String getRoleNameId()
-    {
-        return roleNameId;
-    }
-
-    public String getRoleId()
-    {
-        return roleId;
-    }
-
-    public String getDescription()
-    {
-        return description;
-    }
-
-    public String getDescriptionId()
-    {
-        return descriptionId;
-    }
-
-    /**
-     * Appends the <tt>XML</tt> representation of this security role.
-     * 
-     * @param writer the writer to use
-     */
-    public void appendSecurityRole( XMLWriter writer )
-    {
-        writer.startElement( SECURITY_ROLE );
-
-        // role id
-        if ( getRoleId() != null )
-        {
-            writer.addAttribute( ID_ATTRIBUTE, getRoleId() );
-        }
-
-        // description
-        if ( getDescription() != null )
-        {
-            writer.startElement( DESCRIPTION );
-            if ( getDescriptionId() != null )
-            {
-                writer.addAttribute( ID_ATTRIBUTE, getDescriptionId() );
-            }
-            writer.writeText( getDescription() );
-            writer.endElement();
-
-        }
-
-        // role name
-        writer.startElement( ROLE_NAME );
-        if ( getRoleNameId() != null )
-        {
-            writer.addAttribute( ID_ATTRIBUTE, getRoleNameId() );
-        }
-        writer.writeText( getRoleName() );
-        writer.endElement();
-
-        // end of security-role
-        writer.endElement();
-    }
-
-    public String toString()
-    {
-        return "Security role " + getRoleName();
-    }
-
-}
+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.codehaus.plexus.util.xml.XMLWriter;

+

+/**

+ * The representation of a security-role entry within an application.xml file.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: SecurityRole.java 1542508 2013-11-16 13:21:35Z rfscholte $

+ */

+class SecurityRole

+{

+

+    protected static final String SECURITY_ROLE = "security-role";

+

+    protected static final String ID_ATTRIBUTE = "id";

+

+    protected static final String DESCRIPTION = "description";

+

+    protected static final String ROLE_NAME = "role-name";

+

+    private final String roleName;

+

+    private final String roleNameId;

+

+    private final String roleId;

+

+    private final String description;

+

+    private final String descriptionId;

+

+    public SecurityRole( String roleName, String roleNameId, String roleId, String description, String descriptionId )

+    {

+        if ( roleName == null )

+        {

+            throw new NullPointerException( "role-name in security-role element could not be null." );

+        }

+        this.roleName = roleName;

+        this.roleNameId = roleNameId;

+        this.roleId = roleId;

+        this.description = description;

+        this.descriptionId = descriptionId;

+    }

+

+    public String getRoleName()

+    {

+        return roleName;

+    }

+

+    public String getRoleNameId()

+    {

+        return roleNameId;

+    }

+

+    public String getRoleId()

+    {

+        return roleId;

+    }

+

+    public String getDescription()

+    {

+        return description;

+    }

+

+    public String getDescriptionId()

+    {

+        return descriptionId;

+    }

+

+    /**

+     * Appends the <tt>XML</tt> representation of this security role.

+     * 

+     * @param writer the writer to use

+     */

+    public void appendSecurityRole( XMLWriter writer )

+    {

+        writer.startElement( SECURITY_ROLE );

+

+        // role id

+        if ( getRoleId() != null )

+        {

+            writer.addAttribute( ID_ATTRIBUTE, getRoleId() );

+        }

+

+        // description

+        if ( getDescription() != null )

+        {

+            writer.startElement( DESCRIPTION );

+            if ( getDescriptionId() != null )

+            {

+                writer.addAttribute( ID_ATTRIBUTE, getDescriptionId() );

+            }

+            writer.writeText( getDescription() );

+            writer.endElement();

+

+        }

+

+        // role name

+        writer.startElement( ROLE_NAME );

+        if ( getRoleNameId() != null )

+        {

+            writer.addAttribute( ID_ATTRIBUTE, getRoleNameId() );

+        }

+        writer.writeText( getRoleName() );

+        writer.endElement();

+

+        // end of security-role

+        writer.endElement();

+    }

+

+    public String toString()

+    {

+        return "Security role " + getRoleName();

+    }

+

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/UnknownArtifactTypeException.java b/src/main/java/org/apache/maven/plugins/ear/UnknownArtifactTypeException.java
similarity index 91%
rename from src/main/java/org/apache/maven/plugin/ear/UnknownArtifactTypeException.java
rename to src/main/java/org/apache/maven/plugins/ear/UnknownArtifactTypeException.java
index 3f588bb..dc200c0 100644
--- a/src/main/java/org/apache/maven/plugin/ear/UnknownArtifactTypeException.java
+++ b/src/main/java/org/apache/maven/plugins/ear/UnknownArtifactTypeException.java
@@ -1,51 +1,51 @@
-package org.apache.maven.plugin.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.
- */
-
-/**
- * Thrown if an unknown artifact type is encountered.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public class UnknownArtifactTypeException
-    extends EarPluginException
-{
-
-    /**
-     * 
-     */
-    private static final long serialVersionUID = 2738931967722457793L;
-
-    /**
-     * Create an instance.
-     */
-    public UnknownArtifactTypeException()
-    {
-    }
-
-    /**
-     * @param message The message of the problem.
-     */
-    public UnknownArtifactTypeException( String message )
-    {
-        super( message );
-    }
-}
+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.

+ */

+

+/**

+ * Thrown if an unknown artifact type is encountered.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: UnknownArtifactTypeException.java 1645331 2014-12-13 17:31:09Z khmarbaise $

+ */

+public class UnknownArtifactTypeException

+    extends EarPluginException

+{

+

+    /**

+     * 

+     */

+    private static final long serialVersionUID = 2738931967722457793L;

+

+    /**

+     * Create an instance.

+     */

+    public UnknownArtifactTypeException()

+    {

+    }

+

+    /**

+     * @param message The message of the problem.

+     */

+    public UnknownArtifactTypeException( String message )

+    {

+        super( message );

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/WebModule.java b/src/main/java/org/apache/maven/plugins/ear/WebModule.java
similarity index 96%
rename from src/main/java/org/apache/maven/plugin/ear/WebModule.java
rename to src/main/java/org/apache/maven/plugins/ear/WebModule.java
index a93e9fc..b1fd84c 100644
--- a/src/main/java/org/apache/maven/plugin/ear/WebModule.java
+++ b/src/main/java/org/apache/maven/plugins/ear/WebModule.java
@@ -1,141 +1,141 @@
-package org.apache.maven.plugin.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 a Web application module.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public class WebModule
-    extends AbstractEarModule
-{
-    private static final String WEB_MODULE = "web";
-
-    private static final String WEB_URI_FIELD = "web-uri";
-
-    private static final String CONTEXT_ROOT_FIELD = "context-root";
-
-    private String contextRoot;
-
-    /**
-     * Create an instance.
-     */
-    public WebModule()
-    {
-    }
-
-    /**
-     * @param a {@link Artifact}
-     */
-    public WebModule( Artifact a )
-    {
-        super( a );
-        this.contextRoot = getDefaultContextRoot( a );
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void appendModule( XMLWriter writer, String version, Boolean generateId )
-    {
-        startModuleElement( writer, generateId );
-        writer.startElement( WEB_MODULE );
-        writer.startElement( WEB_URI_FIELD );
-        writer.writeText( getUri() );
-        writer.endElement(); // web-uri
-
-        writer.startElement( CONTEXT_ROOT_FIELD );
-        writer.writeText( getContextRoot() );
-        writer.endElement(); // context-root
-
-        writer.endElement(); // web
-
-        writeAltDeploymentDescriptor( writer, version );
-
-        writer.endElement(); // module
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void resolveArtifact( Set<Artifact> artifacts )
-        throws EarPluginException, MojoFailureException
-    {
-        // Let's resolve the artifact
-        super.resolveArtifact( artifacts );
-
-        // Context root has not been customized - using default
-        if ( contextRoot == null )
-        {
-            contextRoot = getDefaultContextRoot( getArtifact() );
-        }
-    }
-
-    /**
-     * Returns the context root to use for the web module.
-     * <p/>
-     * Note that this might return <tt>null</tt> till the artifact has been resolved.
-     * 
-     * @return the context root
-     */
-    public String getContextRoot()
-    {
-        return contextRoot;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getType()
-    {
-        return "war";
-    }
-
-    /**
-     * Generates a default context root for the given artifact, based on the <tt>artifactId</tt>.
-     * 
-     * @param a the artifact
-     * @return a context root for the artifact
-     */
-    private static String getDefaultContextRoot( Artifact a )
-    {
-        if ( a == null )
-        {
-            throw new NullPointerException( "Artifact could not be null." );
-        }
-        return "/" + a.getArtifactId();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getLibDir()
-    {
-        return "WEB-INF/lib";
-    }
-}
+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 a Web application module.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: WebModule.java 1645331 2014-12-13 17:31:09Z khmarbaise $

+ */

+public class WebModule

+    extends AbstractEarModule

+{

+    private static final String WEB_MODULE = "web";

+

+    private static final String WEB_URI_FIELD = "web-uri";

+

+    private static final String CONTEXT_ROOT_FIELD = "context-root";

+

+    private String contextRoot;

+

+    /**

+     * Create an instance.

+     */

+    public WebModule()

+    {

+    }

+

+    /**

+     * @param a {@link Artifact}

+     */

+    public WebModule( Artifact a )

+    {

+        super( a );

+        this.contextRoot = getDefaultContextRoot( a );

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public void appendModule( XMLWriter writer, String version, Boolean generateId )

+    {

+        startModuleElement( writer, generateId );

+        writer.startElement( WEB_MODULE );

+        writer.startElement( WEB_URI_FIELD );

+        writer.writeText( getUri() );

+        writer.endElement(); // web-uri

+

+        writer.startElement( CONTEXT_ROOT_FIELD );

+        writer.writeText( getContextRoot() );

+        writer.endElement(); // context-root

+

+        writer.endElement(); // web

+

+        writeAltDeploymentDescriptor( writer, version );

+

+        writer.endElement(); // module

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public void resolveArtifact( Set<Artifact> artifacts )

+        throws EarPluginException, MojoFailureException

+    {

+        // Let's resolve the artifact

+        super.resolveArtifact( artifacts );

+

+        // Context root has not been customized - using default

+        if ( contextRoot == null )

+        {

+            contextRoot = getDefaultContextRoot( getArtifact() );

+        }

+    }

+

+    /**

+     * Returns the context root to use for the web module.

+     * <p/>

+     * Note that this might return <tt>null</tt> till the artifact has been resolved.

+     * 

+     * @return the context root

+     */

+    public String getContextRoot()

+    {

+        return contextRoot;

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public String getType()

+    {

+        return "war";

+    }

+

+    /**

+     * Generates a default context root for the given artifact, based on the <tt>artifactId</tt>.

+     * 

+     * @param a the artifact

+     * @return a context root for the artifact

+     */

+    private static String getDefaultContextRoot( Artifact a )

+    {

+        if ( a == null )

+        {

+            throw new NullPointerException( "Artifact could not be null." );

+        }

+        return "/" + a.getArtifactId();

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public String getLibDir()

+    {

+        return "WEB-INF/lib";

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/WsrModule.java b/src/main/java/org/apache/maven/plugins/ear/WsrModule.java
similarity index 91%
rename from src/main/java/org/apache/maven/plugin/ear/WsrModule.java
rename to src/main/java/org/apache/maven/plugins/ear/WsrModule.java
index 9c1d644..0c249dd 100644
--- a/src/main/java/org/apache/maven/plugin/ear/WsrModule.java
+++ b/src/main/java/org/apache/maven/plugins/ear/WsrModule.java
@@ -1,56 +1,56 @@
-package org.apache.maven.plugin.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;
-
-/**
- * The {@link EarModule} implementation for a JBoss wsr module.
- * 
- * @author Brad O'Hearne <brado@neurofire.com>
- * @author $Author$ (last edit)
- * @version $Revision$
- */
-public class WsrModule
-    extends RarModule
-{
-    /**
-     * Create an instance.
-     */
-    public WsrModule()
-    {
-    }
-
-    /**
-     * @param a {@link Artifact}
-     */
-    public WsrModule( Artifact a )
-    {
-        super( a );
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getType()
-    {
-        return "wsr";
-    }
+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;

+

+/**

+ * The {@link EarModule} implementation for a JBoss wsr module.

+ * 

+ * @author Brad O'Hearne <brado@neurofire.com>

+ * @author $Author: khmarbaise $ (last edit)

+ * @version $Revision: 1645331 $

+ */

+public class WsrModule

+    extends RarModule

+{

+    /**

+     * Create an instance.

+     */

+    public WsrModule()

+    {

+    }

+

+    /**

+     * @param a {@link Artifact}

+     */

+    public WsrModule( Artifact a )

+    {

+        super( a );

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public String getType()

+    {

+        return "wsr";

+    }

 }
\ No newline at end of file
diff --git a/src/main/java/org/apache/maven/plugin/ear/output/AbstractFileNameMapping.java b/src/main/java/org/apache/maven/plugins/ear/output/AbstractFileNameMapping.java
similarity index 98%
rename from src/main/java/org/apache/maven/plugin/ear/output/AbstractFileNameMapping.java
rename to src/main/java/org/apache/maven/plugins/ear/output/AbstractFileNameMapping.java
index 583c463..24b64d7 100644
--- a/src/main/java/org/apache/maven/plugin/ear/output/AbstractFileNameMapping.java
+++ b/src/main/java/org/apache/maven/plugins/ear/output/AbstractFileNameMapping.java
@@ -1,80 +1,80 @@
-package org.apache.maven.plugin.ear.output;
-
-/*
- * 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;
-
-/**
- * A base class used to generate the standard name of an artifact instead of relying on the (potentially) wrong file
- * name provided by {@link org.apache.maven.artifact.Artifact#getFile()}.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- */
-public abstract class AbstractFileNameMapping
-    implements FileNameMapping
-{
-
-    private boolean useBaseVersion = false;
-
-    /** {@inheritDoc} */
-    public final void setUseBaseVersion( boolean useBaseVersion )
-    {
-        this.useBaseVersion = useBaseVersion;
-    }
-
-    /**
-     * Generates a standard file name for the specified {@link Artifact}.
-     * <p/>
-     * Returns something like <tt>artifactId-version[-classifier].extension</tt> if <tt>addVersion</tt> is true.
-     * Otherwise it generates something like <tt>artifactId[-classifier].extension</tt>
-     * 
-     * @param a the artifact to generate a filename from
-     * @param addVersion whether the version should be added
-     * @return the filename, with a standard format
-     */
-    protected String generateFileName( final Artifact a, boolean addVersion )
-    {
-        final String extension = a.getArtifactHandler().getExtension();
-
-        final StringBuilder buffer = new StringBuilder( 128 );
-        buffer.append( a.getArtifactId() );
-        if ( addVersion )
-        {
-            if ( useBaseVersion )
-            {
-                buffer.append( '-' ).append( a.getBaseVersion() );
-            }
-            else
-            {
-                buffer.append( '-' ).append( a.getVersion() );
-            }
-        }
-        if ( a.hasClassifier() )
-        {
-            buffer.append( '-' ).append( a.getClassifier() );
-        }
-        if ( extension != null && extension.length() > 0 )
-        {
-            buffer.append( '.' ).append( extension );
-        }
-
-        return buffer.toString();
-    }
-}
+package org.apache.maven.plugins.ear.output;

+

+/*

+ * 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;

+

+/**

+ * A base class used to generate the standard name of an artifact instead of relying on the (potentially) wrong file

+ * name provided by {@link org.apache.maven.artifact.Artifact#getFile()}.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ */

+public abstract class AbstractFileNameMapping

+    implements FileNameMapping

+{

+

+    private boolean useBaseVersion = false;

+

+    /** {@inheritDoc} */

+    public final void setUseBaseVersion( boolean useBaseVersion )

+    {

+        this.useBaseVersion = useBaseVersion;

+    }

+

+    /**

+     * Generates a standard file name for the specified {@link Artifact}.

+     * <p/>

+     * Returns something like <tt>artifactId-version[-classifier].extension</tt> if <tt>addVersion</tt> is true.

+     * Otherwise it generates something like <tt>artifactId[-classifier].extension</tt>

+     * 

+     * @param a the artifact to generate a filename from

+     * @param addVersion whether the version should be added

+     * @return the filename, with a standard format

+     */

+    protected String generateFileName( final Artifact a, boolean addVersion )

+    {

+        final String extension = a.getArtifactHandler().getExtension();

+

+        final StringBuilder buffer = new StringBuilder( 128 );

+        buffer.append( a.getArtifactId() );

+        if ( addVersion )

+        {

+            if ( useBaseVersion )

+            {

+                buffer.append( '-' ).append( a.getBaseVersion() );

+            }

+            else

+            {

+                buffer.append( '-' ).append( a.getVersion() );

+            }

+        }

+        if ( a.hasClassifier() )

+        {

+            buffer.append( '-' ).append( a.getClassifier() );

+        }

+        if ( extension != null && extension.length() > 0 )

+        {

+            buffer.append( '.' ).append( extension );

+        }

+

+        return buffer.toString();

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/output/FileNameMapping.java b/src/main/java/org/apache/maven/plugins/ear/output/FileNameMapping.java
similarity index 91%
rename from src/main/java/org/apache/maven/plugin/ear/output/FileNameMapping.java
rename to src/main/java/org/apache/maven/plugins/ear/output/FileNameMapping.java
index 61a245c..530ba0a 100644
--- a/src/main/java/org/apache/maven/plugin/ear/output/FileNameMapping.java
+++ b/src/main/java/org/apache/maven/plugins/ear/output/FileNameMapping.java
@@ -1,47 +1,47 @@
-package org.apache.maven.plugin.ear.output;
-
-/*
- * 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;
-
-/**
- * Maps file name {@link Artifact}.
- * <p/>
- * TODO: it might be easier to use a token-based approach instead.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public interface FileNameMapping
-{
-
-    /**
-     * @param useBaseVersion true if the base version will be use false otherwise.
-     */
-    void setUseBaseVersion( boolean useBaseVersion );
-
-    /**
-     * Returns the file name of the specified artifact.
-     * 
-     * @param a the artifact
-     * @return the name of the file for the specified artifact
-     */
-    String mapFileName( final Artifact a );
-}
+package org.apache.maven.plugins.ear.output;

+

+/*

+ * 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;

+

+/**

+ * Maps file name {@link Artifact}.

+ * <p/>

+ * TODO: it might be easier to use a token-based approach instead.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: FileNameMapping.java 1645331 2014-12-13 17:31:09Z khmarbaise $

+ */

+public interface FileNameMapping

+{

+

+    /**

+     * @param useBaseVersion true if the base version will be use false otherwise.

+     */

+    void setUseBaseVersion( boolean useBaseVersion );

+

+    /**

+     * Returns the file name of the specified artifact.

+     * 

+     * @param a the artifact

+     * @return the name of the file for the specified artifact

+     */

+    String mapFileName( final Artifact a );

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/output/FileNameMappingFactory.java b/src/main/java/org/apache/maven/plugins/ear/output/FileNameMappingFactory.java
similarity index 96%
rename from src/main/java/org/apache/maven/plugin/ear/output/FileNameMappingFactory.java
rename to src/main/java/org/apache/maven/plugins/ear/output/FileNameMappingFactory.java
index af8782d..6dfbba8 100644
--- a/src/main/java/org/apache/maven/plugin/ear/output/FileNameMappingFactory.java
+++ b/src/main/java/org/apache/maven/plugins/ear/output/FileNameMappingFactory.java
@@ -1,106 +1,106 @@
-package org.apache.maven.plugin.ear.output;
-
-/*
- * 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.
- */
-
-/**
- * Provides access to {@link FileNameMapping} implementations.
- * <p/>
- * Two basic implementations are provided by default:
- * <ul>
- * <li>standard: the default implementation</li>
- * <li>full: an implementation that maps to a 'full' file name, i.e. containing the groupId</li>
- * </ul>
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public class FileNameMappingFactory
-{
-    static final String STANDARD_FILE_NAME_MAPPING = "standard";
-
-    static final String FULL_FILE_NAME_MAPPING = "full";
-
-    static final String NO_VERSION_FILE_NAME_MAPPING = "no-version";
-
-    static final String NO_VERSION_FOR_EJB_FILE_NAME_MAPPING = "no-version-for-ejb";
-
-    private FileNameMappingFactory()
-    {
-    }
-
-    /**
-     * @return {@link StandardFileNameMapping}
-     */
-    public static FileNameMapping getDefaultFileNameMapping()
-    {
-        return new StandardFileNameMapping();
-    }
-
-    /**
-     * Returns the file name mapping implementation based on a logical name of a fully qualified name of the class.
-     * 
-     * @param nameOrClass a name of the fqn of the implementation
-     * @return the file name mapping implementation
-     */
-    public static FileNameMapping getFileNameMapping( final String nameOrClass )
-    {
-        if ( STANDARD_FILE_NAME_MAPPING.equals( nameOrClass ) )
-        {
-            return getDefaultFileNameMapping();
-        }
-        if ( FULL_FILE_NAME_MAPPING.equals( nameOrClass ) )
-        {
-            return new FullFileNameMapping();
-        }
-        if ( NO_VERSION_FILE_NAME_MAPPING.equals( nameOrClass ) )
-        {
-            return new NoVersionFileNameMapping();
-        }
-        if ( NO_VERSION_FOR_EJB_FILE_NAME_MAPPING.equals( nameOrClass ) )
-        {
-            return new NoVersionForEjbFileNameMapping();
-        }
-        try
-        {
-            final Class<?> c = Class.forName( nameOrClass );
-            return (FileNameMapping) c.newInstance();
-        }
-        catch ( ClassNotFoundException e )
-        {
-            throw new IllegalStateException( "File name mapping implementation[" + nameOrClass + "] was not found "
-                + e.getMessage() );
-        }
-        catch ( InstantiationException e )
-        {
-            throw new IllegalStateException( "Could not instantiate file name mapping implementation[" + nameOrClass
-                + "] make sure it has a default public constructor" );
-        }
-        catch ( IllegalAccessException e )
-        {
-            throw new IllegalStateException( "Could not access file name mapping implementation[" + nameOrClass
-                + "] make sure it has a default public constructor" );
-        }
-        catch ( ClassCastException e )
-        {
-            throw new IllegalStateException( "Specified class[" + nameOrClass + "] does not implement["
-                + FileNameMapping.class.getName() + "]" );
-        }
-    }
-}
+package org.apache.maven.plugins.ear.output;

+

+/*

+ * 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.

+ */

+

+/**

+ * Provides access to {@link FileNameMapping} implementations.

+ * <p/>

+ * Two basic implementations are provided by default:

+ * <ul>

+ * <li>standard: the default implementation</li>

+ * <li>full: an implementation that maps to a 'full' file name, i.e. containing the groupId</li>

+ * </ul>

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: FileNameMappingFactory.java 1645331 2014-12-13 17:31:09Z khmarbaise $

+ */

+public class FileNameMappingFactory

+{

+    static final String STANDARD_FILE_NAME_MAPPING = "standard";

+

+    static final String FULL_FILE_NAME_MAPPING = "full";

+

+    static final String NO_VERSION_FILE_NAME_MAPPING = "no-version";

+

+    static final String NO_VERSION_FOR_EJB_FILE_NAME_MAPPING = "no-version-for-ejb";

+

+    private FileNameMappingFactory()

+    {

+    }

+

+    /**

+     * @return {@link StandardFileNameMapping}

+     */

+    public static FileNameMapping getDefaultFileNameMapping()

+    {

+        return new StandardFileNameMapping();

+    }

+

+    /**

+     * Returns the file name mapping implementation based on a logical name of a fully qualified name of the class.

+     * 

+     * @param nameOrClass a name of the fqn of the implementation

+     * @return the file name mapping implementation

+     */

+    public static FileNameMapping getFileNameMapping( final String nameOrClass )

+    {

+        if ( STANDARD_FILE_NAME_MAPPING.equals( nameOrClass ) )

+        {

+            return getDefaultFileNameMapping();

+        }

+        if ( FULL_FILE_NAME_MAPPING.equals( nameOrClass ) )

+        {

+            return new FullFileNameMapping();

+        }

+        if ( NO_VERSION_FILE_NAME_MAPPING.equals( nameOrClass ) )

+        {

+            return new NoVersionFileNameMapping();

+        }

+        if ( NO_VERSION_FOR_EJB_FILE_NAME_MAPPING.equals( nameOrClass ) )

+        {

+            return new NoVersionForEjbFileNameMapping();

+        }

+        try

+        {

+            final Class<?> c = Class.forName( nameOrClass );

+            return (FileNameMapping) c.newInstance();

+        }

+        catch ( ClassNotFoundException e )

+        {

+            throw new IllegalStateException( "File name mapping implementation[" + nameOrClass + "] was not found "

+                + e.getMessage() );

+        }

+        catch ( InstantiationException e )

+        {

+            throw new IllegalStateException( "Could not instantiate file name mapping implementation[" + nameOrClass

+                + "] make sure it has a default public constructor" );

+        }

+        catch ( IllegalAccessException e )

+        {

+            throw new IllegalStateException( "Could not access file name mapping implementation[" + nameOrClass

+                + "] make sure it has a default public constructor" );

+        }

+        catch ( ClassCastException e )

+        {

+            throw new IllegalStateException( "Specified class[" + nameOrClass + "] does not implement["

+                + FileNameMapping.class.getName() + "]" );

+        }

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/output/FullFileNameMapping.java b/src/main/java/org/apache/maven/plugins/ear/output/FullFileNameMapping.java
similarity index 90%
rename from src/main/java/org/apache/maven/plugin/ear/output/FullFileNameMapping.java
rename to src/main/java/org/apache/maven/plugins/ear/output/FullFileNameMapping.java
index 59b6b9a..2a68f20 100644
--- a/src/main/java/org/apache/maven/plugin/ear/output/FullFileNameMapping.java
+++ b/src/main/java/org/apache/maven/plugins/ear/output/FullFileNameMapping.java
@@ -1,42 +1,42 @@
-package org.apache.maven.plugin.ear.output;
-
-/*
- * 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;
-
-/**
- * A full file name mapping, useful if artifacts might have the same name across groups.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public class FullFileNameMapping
-    extends AbstractFileNameMapping
-{
-
-    /**
-     * {@inheritDoc}
-     */
-    public String mapFileName( final Artifact a )
-    {
-        final String dashedGroupId = a.getGroupId().replace( '.', '-' );
-        return dashedGroupId + "-" + generateFileName( a, true );
-    }
-}
+package org.apache.maven.plugins.ear.output;

+

+/*

+ * 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;

+

+/**

+ * A full file name mapping, useful if artifacts might have the same name across groups.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: FullFileNameMapping.java 1645331 2014-12-13 17:31:09Z khmarbaise $

+ */

+public class FullFileNameMapping

+    extends AbstractFileNameMapping

+{

+

+    /**

+     * {@inheritDoc}

+     */

+    public String mapFileName( final Artifact a )

+    {

+        final String dashedGroupId = a.getGroupId().replace( '.', '-' );

+        return dashedGroupId + "-" + generateFileName( a, true );

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/output/NoVersionFileNameMapping.java b/src/main/java/org/apache/maven/plugins/ear/output/NoVersionFileNameMapping.java
similarity index 96%
rename from src/main/java/org/apache/maven/plugin/ear/output/NoVersionFileNameMapping.java
rename to src/main/java/org/apache/maven/plugins/ear/output/NoVersionFileNameMapping.java
index 2903b9e..bcb1904 100644
--- a/src/main/java/org/apache/maven/plugin/ear/output/NoVersionFileNameMapping.java
+++ b/src/main/java/org/apache/maven/plugins/ear/output/NoVersionFileNameMapping.java
@@ -1,41 +1,41 @@
-package org.apache.maven.plugin.ear.output;
-
-/*
- * 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;
-
-/**
- * A simplified version of the standard file name mapping which does not retain the version in the generated file name.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- */
-public class NoVersionFileNameMapping
-    extends AbstractFileNameMapping
-{
-
-    /**
-     * {@inheritDoc}
-     */
-    public String mapFileName( Artifact a )
-    {
-        return generateFileName( a, false );
-    }
-
-}
+package org.apache.maven.plugins.ear.output;

+

+/*

+ * 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;

+

+/**

+ * A simplified version of the standard file name mapping which does not retain the version in the generated file name.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ */

+public class NoVersionFileNameMapping

+    extends AbstractFileNameMapping

+{

+

+    /**

+     * {@inheritDoc}

+     */

+    public String mapFileName( Artifact a )

+    {

+        return generateFileName( a, false );

+    }

+

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/output/NoVersionForEjbFileNameMapping.java b/src/main/java/org/apache/maven/plugins/ear/output/NoVersionForEjbFileNameMapping.java
similarity index 96%
rename from src/main/java/org/apache/maven/plugin/ear/output/NoVersionForEjbFileNameMapping.java
rename to src/main/java/org/apache/maven/plugins/ear/output/NoVersionForEjbFileNameMapping.java
index 8160cc4..7ccbc23 100644
--- a/src/main/java/org/apache/maven/plugin/ear/output/NoVersionForEjbFileNameMapping.java
+++ b/src/main/java/org/apache/maven/plugins/ear/output/NoVersionForEjbFileNameMapping.java
@@ -1,43 +1,43 @@
-package org.apache.maven.plugin.ear.output;
-
-/*
- * 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;
-
-/**
- * A more sophisticated file name mapping which retains the version only for library jars and leaves it out for for
- * ejb-jars.
- * 
- * @author <a href="mailto:philippe.marschall@gmail.com">Philippe Marschall</a>
- */
-public class NoVersionForEjbFileNameMapping
-    extends AbstractFileNameMapping
-{
-
-    /**
-     * {@inheritDoc}
-     */
-    public String mapFileName( Artifact a )
-    {
-        boolean isEjb = "ejb".equals( a.getType() );
-        return generateFileName( a, !isEjb );
-    }
-
-}
+package org.apache.maven.plugins.ear.output;

+

+/*

+ * 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;

+

+/**

+ * A more sophisticated file name mapping which retains the version only for library jars and leaves it out for for

+ * ejb-jars.

+ * 

+ * @author <a href="mailto:philippe.marschall@gmail.com">Philippe Marschall</a>

+ */

+public class NoVersionForEjbFileNameMapping

+    extends AbstractFileNameMapping

+{

+

+    /**

+     * {@inheritDoc}

+     */

+    public String mapFileName( Artifact a )

+    {

+        boolean isEjb = "ejb".equals( a.getType() );

+        return generateFileName( a, !isEjb );

+    }

+

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/output/StandardFileNameMapping.java b/src/main/java/org/apache/maven/plugins/ear/output/StandardFileNameMapping.java
similarity index 90%
rename from src/main/java/org/apache/maven/plugin/ear/output/StandardFileNameMapping.java
rename to src/main/java/org/apache/maven/plugins/ear/output/StandardFileNameMapping.java
index 8cfff2f..3053037 100644
--- a/src/main/java/org/apache/maven/plugin/ear/output/StandardFileNameMapping.java
+++ b/src/main/java/org/apache/maven/plugins/ear/output/StandardFileNameMapping.java
@@ -1,42 +1,42 @@
-package org.apache.maven.plugin.ear.output;
-
-/*
- * 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;
-
-/**
- * The standard file name mapping. It returns the name of the file in the local repository.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public class StandardFileNameMapping
-    extends AbstractFileNameMapping
-{
-
-    /**
-     * {@inheritDoc}
-     */
-    public String mapFileName( final Artifact a )
-    {
-        return generateFileName( a, true );
-    }
-
-}
+package org.apache.maven.plugins.ear.output;

+

+/*

+ * 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;

+

+/**

+ * The standard file name mapping. It returns the name of the file in the local repository.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: StandardFileNameMapping.java 1645331 2014-12-13 17:31:09Z khmarbaise $

+ */

+public class StandardFileNameMapping

+    extends AbstractFileNameMapping

+{

+

+    /**

+     * {@inheritDoc}

+     */

+    public String mapFileName( final Artifact a )

+    {

+        return generateFileName( a, true );

+    }

+

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/util/ArtifactRepository.java b/src/main/java/org/apache/maven/plugins/ear/util/ArtifactRepository.java
similarity index 96%
rename from src/main/java/org/apache/maven/plugin/ear/util/ArtifactRepository.java
rename to src/main/java/org/apache/maven/plugins/ear/util/ArtifactRepository.java
index 8133e82..aa8e3aa 100644
--- a/src/main/java/org/apache/maven/plugin/ear/util/ArtifactRepository.java
+++ b/src/main/java/org/apache/maven/plugins/ear/util/ArtifactRepository.java
@@ -1,147 +1,147 @@
-package org.apache.maven.plugin.ear.util;
-
-/*
- * 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 java.util.Set;
-import java.util.TreeSet;
-
-import org.apache.maven.artifact.Artifact;
-
-/**
- * An artifact repository used to resolve {@link org.apache.maven.plugin.ear.EarModule}.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public class ArtifactRepository
-{
-    private final Set<Artifact> artifacts;
-
-    private final String mainArtifactId;
-
-    private final ArtifactTypeMappingService artifactTypeMappingService;
-
-    /**
-     * Creates a new repository wih the specified artifacts.
-     * 
-     * @param artifacts the artifacts
-     * @param mainArtifactId the id to use for the main artifact (no classifier)
-     * @param artifactTypeMappingService {@link ArtifactTypeMappingService}
-     */
-    public ArtifactRepository( Set<Artifact> artifacts, String mainArtifactId,
-                               ArtifactTypeMappingService artifactTypeMappingService )
-    {
-        this.artifacts = artifacts;
-        this.mainArtifactId = mainArtifactId;
-        this.artifactTypeMappingService = artifactTypeMappingService;
-    }
-
-    /**
-     * Returns the artifact with the specified parameters.
-     * <p/>
-     * If the artifact is classified and is the only one with the specified groupI, artifactId and type, it will be
-     * returned.
-     * <p/>
-     * If the artifact is classified and is not the only one with the specified groupI, artifactId and type, it returns
-     * null.
-     * <p/>
-     * If the artifact is not found, it returns null.
-     * 
-     * @param groupId the group id
-     * @param artifactId the artifact id
-     * @param type the type
-     * @param classifier the classifier
-     * @return the artifact or null if no artifact were found
-     */
-    public Artifact getUniqueArtifact( String groupId, String artifactId, String type, String classifier )
-    {
-        final Set<Artifact> candidates = getArtifacts( groupId, artifactId, type );
-        if ( candidates.size() == 0 )
-        {
-            return null;
-        }
-        else if ( candidates.size() == 1 && classifier == null )
-        {
-            return candidates.iterator().next();
-        }
-        else if ( classifier != null )
-        {
-            for ( Artifact a : candidates )
-            {
-                if ( a.getClassifier() == null && classifier.equals( mainArtifactId ) )
-                {
-                    return a;
-                }
-                else if ( classifier.equals( a.getClassifier() ) )
-                {
-                    return a;
-                }
-            }
-        }
-        // All other cases, classifier is null and more than one candidate ; artifact not found
-        return null;
-    }
-
-    /**
-     * Returns the artifact with the specified parameters.
-     * <p/>
-     * If the artifact is classified and is the only one with the specified groupI, artifactId and type, it will be
-     * returned.
-     * <p/>
-     * If the artifact is classified and is not the only one with the specified groupI, artifactId and type, it returns
-     * null.
-     * <p/>
-     * If the artifact is not found, it returns null.
-     * 
-     * @param groupId the group id
-     * @param artifactId the artifact id
-     * @param type the type
-     * @return the artifact or null if no artifact were found
-     */
-    public Artifact getUniqueArtifact( String groupId, String artifactId, String type )
-    {
-        return getUniqueArtifact( groupId, artifactId, type, null );
-    }
-
-    /**
-     * Returns the artifacts with the specified parameters.
-     * 
-     * @param groupId the group id
-     * @param artifactId the artifact id
-     * @param type the type
-     * @return the artifacts or an empty set if no artifact were found
-     */
-    public Set<Artifact> getArtifacts( String groupId, String artifactId, String type )
-    {
-        final Set<Artifact> result = new TreeSet<Artifact>();
-        for ( Artifact a : artifacts )
-        {
-            // If the groupId, the artifactId and if the
-            // artifact's type is known, then we have found a candidate.
-            if ( a.getGroupId().equals( groupId ) && a.getArtifactId().equals( artifactId )
-                && artifactTypeMappingService.isMappedToType( type, a.getType() ) )
-            {
-                result.add( a );
-
-            }
-        }
-        return result;
-    }
+package org.apache.maven.plugins.ear.util;

+

+/*

+ * 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 java.util.Set;

+import java.util.TreeSet;

+

+import org.apache.maven.artifact.Artifact;

+

+/**

+ * An artifact repository used to resolve {@link org.apache.maven.plugins.ear.EarModule}.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: ArtifactRepository.java 1645331 2014-12-13 17:31:09Z khmarbaise $

+ */

+public class ArtifactRepository

+{

+    private final Set<Artifact> artifacts;

+

+    private final String mainArtifactId;

+

+    private final ArtifactTypeMappingService artifactTypeMappingService;

+

+    /**

+     * Creates a new repository wih the specified artifacts.

+     * 

+     * @param artifacts the artifacts

+     * @param mainArtifactId the id to use for the main artifact (no classifier)

+     * @param artifactTypeMappingService {@link ArtifactTypeMappingService}

+     */

+    public ArtifactRepository( Set<Artifact> artifacts, String mainArtifactId,

+                               ArtifactTypeMappingService artifactTypeMappingService )

+    {

+        this.artifacts = artifacts;

+        this.mainArtifactId = mainArtifactId;

+        this.artifactTypeMappingService = artifactTypeMappingService;

+    }

+

+    /**

+     * Returns the artifact with the specified parameters.

+     * <p/>

+     * If the artifact is classified and is the only one with the specified groupI, artifactId and type, it will be

+     * returned.

+     * <p/>

+     * If the artifact is classified and is not the only one with the specified groupI, artifactId and type, it returns

+     * null.

+     * <p/>

+     * If the artifact is not found, it returns null.

+     * 

+     * @param groupId the group id

+     * @param artifactId the artifact id

+     * @param type the type

+     * @param classifier the classifier

+     * @return the artifact or null if no artifact were found

+     */

+    public Artifact getUniqueArtifact( String groupId, String artifactId, String type, String classifier )

+    {

+        final Set<Artifact> candidates = getArtifacts( groupId, artifactId, type );

+        if ( candidates.size() == 0 )

+        {

+            return null;

+        }

+        else if ( candidates.size() == 1 && classifier == null )

+        {

+            return candidates.iterator().next();

+        }

+        else if ( classifier != null )

+        {

+            for ( Artifact a : candidates )

+            {

+                if ( a.getClassifier() == null && classifier.equals( mainArtifactId ) )

+                {

+                    return a;

+                }

+                else if ( classifier.equals( a.getClassifier() ) )

+                {

+                    return a;

+                }

+            }

+        }

+        // All other cases, classifier is null and more than one candidate ; artifact not found

+        return null;

+    }

+

+    /**

+     * Returns the artifact with the specified parameters.

+     * <p/>

+     * If the artifact is classified and is the only one with the specified groupI, artifactId and type, it will be

+     * returned.

+     * <p/>

+     * If the artifact is classified and is not the only one with the specified groupI, artifactId and type, it returns

+     * null.

+     * <p/>

+     * If the artifact is not found, it returns null.

+     * 

+     * @param groupId the group id

+     * @param artifactId the artifact id

+     * @param type the type

+     * @return the artifact or null if no artifact were found

+     */

+    public Artifact getUniqueArtifact( String groupId, String artifactId, String type )

+    {

+        return getUniqueArtifact( groupId, artifactId, type, null );

+    }

+

+    /**

+     * Returns the artifacts with the specified parameters.

+     * 

+     * @param groupId the group id

+     * @param artifactId the artifact id

+     * @param type the type

+     * @return the artifacts or an empty set if no artifact were found

+     */

+    public Set<Artifact> getArtifacts( String groupId, String artifactId, String type )

+    {

+        final Set<Artifact> result = new TreeSet<Artifact>();

+        for ( Artifact a : artifacts )

+        {

+            // If the groupId, the artifactId and if the

+            // artifact's type is known, then we have found a candidate.

+            if ( a.getGroupId().equals( groupId ) && a.getArtifactId().equals( artifactId )

+                && artifactTypeMappingService.isMappedToType( type, a.getType() ) )

+            {

+                result.add( a );

+

+            }

+        }

+        return result;

+    }

 }
\ No newline at end of file
diff --git a/src/main/java/org/apache/maven/plugin/ear/util/ArtifactTypeMappingService.java b/src/main/java/org/apache/maven/plugins/ear/util/ArtifactTypeMappingService.java
similarity index 95%
rename from src/main/java/org/apache/maven/plugin/ear/util/ArtifactTypeMappingService.java
rename to src/main/java/org/apache/maven/plugins/ear/util/ArtifactTypeMappingService.java
index 313c271..7d3aeb7 100644
--- a/src/main/java/org/apache/maven/plugin/ear/util/ArtifactTypeMappingService.java
+++ b/src/main/java/org/apache/maven/plugins/ear/util/ArtifactTypeMappingService.java
@@ -1,179 +1,179 @@
-package org.apache.maven.plugin.ear.util;
-
-/*
- * 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 java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.maven.plugin.ear.EarModuleFactory;
-import org.apache.maven.plugin.ear.EarPluginException;
-import org.apache.maven.plugin.ear.UnknownArtifactTypeException;
-import org.codehaus.plexus.configuration.PlexusConfiguration;
-import org.codehaus.plexus.configuration.PlexusConfigurationException;
-
-/**
- * Allows to map custom artifact type to standard type.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public class ArtifactTypeMappingService
-{
-    static final String ARTIFACT_TYPE_MAPPING_ELEMENT = "artifactTypeMapping";
-
-    static final String TYPE_ATTRIBUTE = "type";
-
-    static final String MAPPING_ATTRIBUTE = "mapping";
-
-    // A standard type to a list of customType
-    private final Map<String, List<String>> typeMappings;
-
-    // The user-defined mapping for direct access
-    private final Map<String, String> customMappings;
-
-    /**
-     * Create an instance.
-     */
-    public ArtifactTypeMappingService()
-    {
-        this.typeMappings = new HashMap<String, List<String>>();
-        this.customMappings = new HashMap<String, String>();
-        init();
-    }
-
-    /**
-     * @param plexusConfiguration {@link PlexusConfiguration}
-     * @throws EarPluginException {@link EarPluginException}
-     * @throws PlexusConfigurationException {@link PlexusConfigurationException}
-     */
-    public void configure( final PlexusConfiguration plexusConfiguration )
-        throws EarPluginException, PlexusConfigurationException
-    {
-
-        // No user defined configuration
-        if ( plexusConfiguration == null )
-        {
-            return;
-        }
-
-        // Inject users configuration
-        final PlexusConfiguration[] artifactTypeMappings =
-            plexusConfiguration.getChildren( ARTIFACT_TYPE_MAPPING_ELEMENT );
-        for ( PlexusConfiguration artifactTypeMapping : artifactTypeMappings )
-        {
-            final String customType = artifactTypeMapping.getAttribute( TYPE_ATTRIBUTE );
-            final String mapping = artifactTypeMapping.getAttribute( MAPPING_ATTRIBUTE );
-
-            if ( customType == null )
-            {
-                throw new EarPluginException( "Invalid artifact type mapping, type attribute should be set." );
-            }
-            else if ( mapping == null )
-            {
-                throw new EarPluginException( "Invalid artifact type mapping, mapping attribute should be set." );
-            }
-            else if ( !EarModuleFactory.isStandardArtifactType( mapping ) )
-            {
-                throw new EarPluginException( "Invalid artifact type mapping, mapping[" + mapping
-                    + "] must be a standard Ear artifact type[" + EarModuleFactory.getStandardArtifactTypes() + "]" );
-            }
-            else if ( customMappings.containsKey( customType ) )
-            {
-                throw new EarPluginException( "Invalid artifact type mapping, type[" + customType
-                    + "] is already registered." );
-            }
-            else
-            {
-                // Add the custom mapping
-                customMappings.put( customType, mapping );
-
-                // Register the custom mapping to its standard type
-                List<String> typeMapping = typeMappings.get( mapping );
-                typeMapping.add( customType );
-            }
-        }
-    }
-
-    /**
-     * Specify whether the <tt>customType</tt> could be mapped to the <tt>standardType</tt>.
-     * 
-     * @param standardType the standard type (ejb, jar, war, ...)
-     * @param customType a user-defined type
-     * @return true if the customType could be mapped to the standard type
-     */
-    public boolean isMappedToType( final String standardType, final String customType )
-    {
-        if ( !EarModuleFactory.isStandardArtifactType( standardType ) )
-        {
-            throw new IllegalStateException( "Artifact type[" + standardType + "] is not a standard Ear artifact type["
-                + EarModuleFactory.getStandardArtifactTypes() + "]" );
-        }
-        return this.typeMappings.get( standardType ).contains( customType );
-
-    }
-
-    /**
-     * Returns the standard type for the specified <tt>type</tt>. If the specified type is already a standard type, the
-     * orignal type is returned.
-     * 
-     * @param type a type
-     * @return the standard type (ejb, jar, war, ...) for this type
-     * @throws UnknownArtifactTypeException In case of missing mappings types.
-     */
-    public String getStandardType( final String type )
-        throws UnknownArtifactTypeException
-    {
-        if ( type == null )
-        {
-            throw new IllegalStateException( "custom type could not be null." );
-        }
-        else if ( EarModuleFactory.getStandardArtifactTypes().contains( type ) )
-        {
-            return type;
-        }
-        else if ( !customMappings.containsKey( type ) )
-        {
-            throw new UnknownArtifactTypeException( "Unknown artifact type[" + type + "]" );
-        }
-        else
-        {
-            return customMappings.get( type );
-        }
-    }
-
-    private void init()
-    {
-        // Initialize the typeMappings
-        typeMappings.clear();
-
-        // Clear the customMappings
-        customMappings.clear();
-
-        // Initialize the mapping with the standard artifact types
-        for ( String type : EarModuleFactory.getStandardArtifactTypes() )
-        {
-            List<String> typeMapping = new ArrayList<String>();
-            typeMapping.add( type );
-            this.typeMappings.put( type, typeMapping );
-        }
-    }
+package org.apache.maven.plugins.ear.util;

+

+/*

+ * 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 java.util.ArrayList;

+import java.util.HashMap;

+import java.util.List;

+import java.util.Map;

+

+import org.apache.maven.plugins.ear.EarModuleFactory;

+import org.apache.maven.plugins.ear.EarPluginException;

+import org.apache.maven.plugins.ear.UnknownArtifactTypeException;

+import org.codehaus.plexus.configuration.PlexusConfiguration;

+import org.codehaus.plexus.configuration.PlexusConfigurationException;

+

+/**

+ * Allows to map custom artifact type to standard type.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: ArtifactTypeMappingService.java 1645331 2014-12-13 17:31:09Z khmarbaise $

+ */

+public class ArtifactTypeMappingService

+{

+    static final String ARTIFACT_TYPE_MAPPING_ELEMENT = "artifactTypeMapping";

+

+    static final String TYPE_ATTRIBUTE = "type";

+

+    static final String MAPPING_ATTRIBUTE = "mapping";

+

+    // A standard type to a list of customType

+    private final Map<String, List<String>> typeMappings;

+

+    // The user-defined mapping for direct access

+    private final Map<String, String> customMappings;

+

+    /**

+     * Create an instance.

+     */

+    public ArtifactTypeMappingService()

+    {

+        this.typeMappings = new HashMap<String, List<String>>();

+        this.customMappings = new HashMap<String, String>();

+        init();

+    }

+

+    /**

+     * @param plexusConfiguration {@link PlexusConfiguration}

+     * @throws EarPluginException {@link EarPluginException}

+     * @throws PlexusConfigurationException {@link PlexusConfigurationException}

+     */

+    public void configure( final PlexusConfiguration plexusConfiguration )

+        throws EarPluginException, PlexusConfigurationException

+    {

+

+        // No user defined configuration

+        if ( plexusConfiguration == null )

+        {

+            return;

+        }

+

+        // Inject users configuration

+        final PlexusConfiguration[] artifactTypeMappings =

+            plexusConfiguration.getChildren( ARTIFACT_TYPE_MAPPING_ELEMENT );

+        for ( PlexusConfiguration artifactTypeMapping : artifactTypeMappings )

+        {

+            final String customType = artifactTypeMapping.getAttribute( TYPE_ATTRIBUTE );

+            final String mapping = artifactTypeMapping.getAttribute( MAPPING_ATTRIBUTE );

+

+            if ( customType == null )

+            {

+                throw new EarPluginException( "Invalid artifact type mapping, type attribute should be set." );

+            }

+            else if ( mapping == null )

+            {

+                throw new EarPluginException( "Invalid artifact type mapping, mapping attribute should be set." );

+            }

+            else if ( !EarModuleFactory.isStandardArtifactType( mapping ) )

+            {

+                throw new EarPluginException( "Invalid artifact type mapping, mapping[" + mapping

+                    + "] must be a standard Ear artifact type[" + EarModuleFactory.getStandardArtifactTypes() + "]" );

+            }

+            else if ( customMappings.containsKey( customType ) )

+            {

+                throw new EarPluginException( "Invalid artifact type mapping, type[" + customType

+                    + "] is already registered." );

+            }

+            else

+            {

+                // Add the custom mapping

+                customMappings.put( customType, mapping );

+

+                // Register the custom mapping to its standard type

+                List<String> typeMapping = typeMappings.get( mapping );

+                typeMapping.add( customType );

+            }

+        }

+    }

+

+    /**

+     * Specify whether the <tt>customType</tt> could be mapped to the <tt>standardType</tt>.

+     * 

+     * @param standardType the standard type (ejb, jar, war, ...)

+     * @param customType a user-defined type

+     * @return true if the customType could be mapped to the standard type

+     */

+    public boolean isMappedToType( final String standardType, final String customType )

+    {

+        if ( !EarModuleFactory.isStandardArtifactType( standardType ) )

+        {

+            throw new IllegalStateException( "Artifact type[" + standardType + "] is not a standard Ear artifact type["

+                + EarModuleFactory.getStandardArtifactTypes() + "]" );

+        }

+        return this.typeMappings.get( standardType ).contains( customType );

+

+    }

+

+    /**

+     * Returns the standard type for the specified <tt>type</tt>. If the specified type is already a standard type, the

+     * orignal type is returned.

+     * 

+     * @param type a type

+     * @return the standard type (ejb, jar, war, ...) for this type

+     * @throws UnknownArtifactTypeException In case of missing mappings types.

+     */

+    public String getStandardType( final String type )

+        throws UnknownArtifactTypeException

+    {

+        if ( type == null )

+        {

+            throw new IllegalStateException( "custom type could not be null." );

+        }

+        else if ( EarModuleFactory.getStandardArtifactTypes().contains( type ) )

+        {

+            return type;

+        }

+        else if ( !customMappings.containsKey( type ) )

+        {

+            throw new UnknownArtifactTypeException( "Unknown artifact type[" + type + "]" );

+        }

+        else

+        {

+            return customMappings.get( type );

+        }

+    }

+

+    private void init()

+    {

+        // Initialize the typeMappings

+        typeMappings.clear();

+

+        // Clear the customMappings

+        customMappings.clear();

+

+        // Initialize the mapping with the standard artifact types

+        for ( String type : EarModuleFactory.getStandardArtifactTypes() )

+        {

+            List<String> typeMapping = new ArrayList<String>();

+            typeMapping.add( type );

+            this.typeMappings.put( type, typeMapping );

+        }

+    }

 }
\ No newline at end of file
diff --git a/src/main/java/org/apache/maven/plugin/ear/util/EarMavenArchiver.java b/src/main/java/org/apache/maven/plugins/ear/util/EarMavenArchiver.java
similarity index 98%
rename from src/main/java/org/apache/maven/plugin/ear/util/EarMavenArchiver.java
rename to src/main/java/org/apache/maven/plugins/ear/util/EarMavenArchiver.java
index d1f1c12..d0ac62d 100644
--- a/src/main/java/org/apache/maven/plugin/ear/util/EarMavenArchiver.java
+++ b/src/main/java/org/apache/maven/plugins/ear/util/EarMavenArchiver.java
@@ -1,146 +1,146 @@
-package org.apache.maven.plugin.ear.util;
-
-/*
- * 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 java.util.List;
-import java.util.Set;
-
-import org.apache.maven.archiver.MavenArchiveConfiguration;
-import org.apache.maven.archiver.MavenArchiver;
-import org.apache.maven.artifact.DependencyResolutionRequiredException;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugin.ear.EarModule;
-import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.archiver.jar.Manifest;
-import org.codehaus.plexus.archiver.jar.ManifestException;
-
-/**
- * A custom {@link MavenArchiver} implementation that takes care of setting the right classpath value according to the
- * actual path of bundled files.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- */
-public class EarMavenArchiver
-    extends MavenArchiver
-{
-    /**
-     * {@code Class-Path}.
-     */
-    public static final String CLASS_PATH_KEY = "Class-Path";
-
-    private final List<EarModule> earModules;
-
-    /**
-     * Creates an instance with the ear modules that will be packaged in the EAR archive.
-     * 
-     * @param earModules the intitialized list of ear modules
-     */
-    public EarMavenArchiver( List<EarModule> earModules )
-    {
-        this.earModules = earModules;
-    }
-
-    /**
-     * @param project {@link MavenProject}
-     * @param config {@link MavenArchiveConfiguration}
-     * @throws ManifestException in case of an error
-     * @throws DependencyResolutionRequiredException in case of an resolution error.
-     * @return Manifest
-     * @deprecated
-     */
-    public Manifest getManifest( MavenProject project, MavenArchiveConfiguration config )
-        throws ManifestException, DependencyResolutionRequiredException
-    {
-        return this.getManifest( null, project, config );
-    }
-
-    /** {@inheritDoc} */
-    public Manifest getManifest( MavenSession session, MavenProject project, MavenArchiveConfiguration config )
-        throws ManifestException, DependencyResolutionRequiredException
-    {
-        final Manifest manifest = super.getManifest( session, project, config );
-        if ( config.getManifest().isAddClasspath() )
-        {
-            String earManifestClassPathEntry = generateClassPathEntry( config.getManifest().getClasspathPrefix() );
-            // Class-path can be customized. Let's make sure we don't overwrite this
-            // with our custom change!
-            final String userSuppliedClassPathEntry = getUserSuppliedClassPathEntry( config );
-            if ( userSuppliedClassPathEntry != null )
-            {
-                earManifestClassPathEntry = userSuppliedClassPathEntry + " " + earManifestClassPathEntry;
-            }
-
-            // Overwrite the existing one, if any
-            final Manifest.Attribute classPathAttr = manifest.getMainSection().getAttribute( CLASS_PATH_KEY );
-            if ( classPathAttr != null )
-            {
-                classPathAttr.setValue( earManifestClassPathEntry );
-            }
-            else
-            {
-                final Manifest.Attribute attr = new Manifest.Attribute( CLASS_PATH_KEY, earManifestClassPathEntry );
-                manifest.addConfiguredAttribute( attr );
-            }
-        }
-        return manifest;
-    }
-
-    /**
-     * Generates the <tt>Class-Path</tt> entry of the manifest according to the list of ear modules.
-     * 
-     * @param classPathPrefix the classpath prefix to use
-     * @return the <tt>Class-Path</tt> entry
-     */
-    protected String generateClassPathEntry( String classPathPrefix )
-    {
-        final StringBuilder classpath = new StringBuilder();
-        for ( final EarModule earModule : earModules )
-        {
-            if ( !earModule.isExcluded() )
-            {
-                classpath.append( classPathPrefix ).append( earModule.getUri() ).append( " " );
-            }
-        }
-        return classpath.toString().trim();
-    }
-
-    /**
-     * @param config {@link MavenArchiveConfiguration}
-     * @return The class path entry.
-     */
-    protected String getUserSuppliedClassPathEntry( MavenArchiveConfiguration config )
-    {
-        if ( config.getManifestEntries() != null )
-        {
-            final Set<String> keys = config.getManifestEntries().keySet();
-            for ( String key : keys )
-            {
-                String value = config.getManifestEntries().get( key );
-                if ( "Class-Path".equals( key ) && value != null )
-                {
-                    return value;
-
-                }
-
-            }
-        }
-        return null;
-    }
-}
+package org.apache.maven.plugins.ear.util;

+

+/*

+ * 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 java.util.List;

+import java.util.Set;

+

+import org.apache.maven.archiver.MavenArchiveConfiguration;

+import org.apache.maven.archiver.MavenArchiver;

+import org.apache.maven.artifact.DependencyResolutionRequiredException;

+import org.apache.maven.execution.MavenSession;

+import org.apache.maven.plugins.ear.EarModule;

+import org.apache.maven.project.MavenProject;

+import org.codehaus.plexus.archiver.jar.Manifest;

+import org.codehaus.plexus.archiver.jar.ManifestException;

+

+/**

+ * A custom {@link MavenArchiver} implementation that takes care of setting the right classpath value according to the

+ * actual path of bundled files.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ */

+public class EarMavenArchiver

+    extends MavenArchiver

+{

+    /**

+     * {@code Class-Path}.

+     */

+    public static final String CLASS_PATH_KEY = "Class-Path";

+

+    private final List<EarModule> earModules;

+

+    /**

+     * Creates an instance with the ear modules that will be packaged in the EAR archive.

+     * 

+     * @param earModules the intitialized list of ear modules

+     */

+    public EarMavenArchiver( List<EarModule> earModules )

+    {

+        this.earModules = earModules;

+    }

+

+    /**

+     * @param project {@link MavenProject}

+     * @param config {@link MavenArchiveConfiguration}

+     * @throws ManifestException in case of an error

+     * @throws DependencyResolutionRequiredException in case of an resolution error.

+     * @return Manifest

+     * @deprecated

+     */

+    public Manifest getManifest( MavenProject project, MavenArchiveConfiguration config )

+        throws ManifestException, DependencyResolutionRequiredException

+    {

+        return this.getManifest( null, project, config );

+    }

+

+    /** {@inheritDoc} */

+    public Manifest getManifest( MavenSession session, MavenProject project, MavenArchiveConfiguration config )

+        throws ManifestException, DependencyResolutionRequiredException

+    {

+        final Manifest manifest = super.getManifest( session, project, config );

+        if ( config.getManifest().isAddClasspath() )

+        {

+            String earManifestClassPathEntry = generateClassPathEntry( config.getManifest().getClasspathPrefix() );

+            // Class-path can be customized. Let's make sure we don't overwrite this

+            // with our custom change!

+            final String userSuppliedClassPathEntry = getUserSuppliedClassPathEntry( config );

+            if ( userSuppliedClassPathEntry != null )

+            {

+                earManifestClassPathEntry = userSuppliedClassPathEntry + " " + earManifestClassPathEntry;

+            }

+

+            // Overwrite the existing one, if any

+            final Manifest.Attribute classPathAttr = manifest.getMainSection().getAttribute( CLASS_PATH_KEY );

+            if ( classPathAttr != null )

+            {

+                classPathAttr.setValue( earManifestClassPathEntry );

+            }

+            else

+            {

+                final Manifest.Attribute attr = new Manifest.Attribute( CLASS_PATH_KEY, earManifestClassPathEntry );

+                manifest.addConfiguredAttribute( attr );

+            }

+        }

+        return manifest;

+    }

+

+    /**

+     * Generates the <tt>Class-Path</tt> entry of the manifest according to the list of ear modules.

+     * 

+     * @param classPathPrefix the classpath prefix to use

+     * @return the <tt>Class-Path</tt> entry

+     */

+    protected String generateClassPathEntry( String classPathPrefix )

+    {

+        final StringBuilder classpath = new StringBuilder();

+        for ( final EarModule earModule : earModules )

+        {

+            if ( !earModule.isExcluded() )

+            {

+                classpath.append( classPathPrefix ).append( earModule.getUri() ).append( " " );

+            }

+        }

+        return classpath.toString().trim();

+    }

+

+    /**

+     * @param config {@link MavenArchiveConfiguration}

+     * @return The class path entry.

+     */

+    protected String getUserSuppliedClassPathEntry( MavenArchiveConfiguration config )

+    {

+        if ( config.getManifestEntries() != null )

+        {

+            final Set<String> keys = config.getManifestEntries().keySet();

+            for ( String key : keys )

+            {

+                String value = config.getManifestEntries().get( key );

+                if ( "Class-Path".equals( key ) && value != null )

+                {

+                    return value;

+

+                }

+

+            }

+        }

+        return null;

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/util/InvalidJavaEEVersion.java b/src/main/java/org/apache/maven/plugins/ear/util/InvalidJavaEEVersion.java
similarity index 96%
rename from src/main/java/org/apache/maven/plugin/ear/util/InvalidJavaEEVersion.java
rename to src/main/java/org/apache/maven/plugins/ear/util/InvalidJavaEEVersion.java
index a705cd8..9a6df3c 100644
--- a/src/main/java/org/apache/maven/plugin/ear/util/InvalidJavaEEVersion.java
+++ b/src/main/java/org/apache/maven/plugins/ear/util/InvalidJavaEEVersion.java
@@ -1,55 +1,55 @@
-package org.apache.maven.plugin.ear.util;
-
-/*
- * 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.plugin.MojoExecutionException;
-
-/**
- * @author Stephane Nicoll
- */
-public class InvalidJavaEEVersion
-    extends MojoExecutionException
-{
-
-    /**
-     * 
-     */
-    private static final long serialVersionUID = 3189028517550801372L;
-
-    private final String invalidVersion;
-
-    /**
-     * @param message The message for the error
-     * @param invalidVersion The invalid version.
-     */
-    public InvalidJavaEEVersion( String message, String invalidVersion )
-    {
-        super( message );
-        this.invalidVersion = invalidVersion;
-    }
-
-    /**
-     * @return The invalid version.
-     */
-    public String getInvalidVersion()
-    {
-        return invalidVersion;
-    }
-}
+package org.apache.maven.plugins.ear.util;

+

+/*

+ * 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.plugin.MojoExecutionException;

+

+/**

+ * @author Stephane Nicoll

+ */

+public class InvalidJavaEEVersion

+    extends MojoExecutionException

+{

+

+    /**

+     * 

+     */

+    private static final long serialVersionUID = 3189028517550801372L;

+

+    private final String invalidVersion;

+

+    /**

+     * @param message The message for the error

+     * @param invalidVersion The invalid version.

+     */

+    public InvalidJavaEEVersion( String message, String invalidVersion )

+    {

+        super( message );

+        this.invalidVersion = invalidVersion;

+    }

+

+    /**

+     * @return The invalid version.

+     */

+    public String getInvalidVersion()

+    {

+        return invalidVersion;

+    }

+}

diff --git a/src/main/java/org/apache/maven/plugin/ear/util/JavaEEVersion.java b/src/main/java/org/apache/maven/plugins/ear/util/JavaEEVersion.java
similarity index 98%
rename from src/main/java/org/apache/maven/plugin/ear/util/JavaEEVersion.java
rename to src/main/java/org/apache/maven/plugins/ear/util/JavaEEVersion.java
index 98ece45..cff3577 100644
--- a/src/main/java/org/apache/maven/plugin/ear/util/JavaEEVersion.java
+++ b/src/main/java/org/apache/maven/plugins/ear/util/JavaEEVersion.java
@@ -1,200 +1,200 @@
-package org.apache.maven.plugin.ear.util;
-
-/*
- * 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 java.util.HashMap;
-import java.util.Map;
-
-/**
- * Represents the supported JavaEE version.
- * 
- * @author Stephane Nicoll
- */
-public class JavaEEVersion
-    implements Comparable<JavaEEVersion>
-{
-
-    private static final String VERSION_1_3 = "1.3";
-
-    private static final String VERSION_1_4 = "1.4";
-
-    private static final String VERSION_5 = "5";
-
-    private static final String VERSION_6 = "6";
-
-    private static final String VERSION_7 = "7";
-    
-    private static final String VERSION_8 = "8";
-
-    private static final Map<String, JavaEEVersion> VERSION_MAP = new HashMap<String, JavaEEVersion>();
-
-    /**
-     * Represents the J2EE 1.3 version.
-     */
-    public static final JavaEEVersion ONE_DOT_THREE = new JavaEEVersion( Integer.valueOf( 0 ), VERSION_1_3 );
-
-    /**
-     * Represents the J2EE 1.4 version.
-     */
-    public static final JavaEEVersion ONE_DOT_FOUR = new JavaEEVersion( Integer.valueOf( 1 ), VERSION_1_4 );
-
-    /**
-     * Represents the JavaEE 5 version.
-     */
-    public static final JavaEEVersion FIVE = new JavaEEVersion( Integer.valueOf( 2 ), VERSION_5 );
-
-    /**
-     * Represents the JavaEE 6 version.
-     */
-    public static final JavaEEVersion SIX = new JavaEEVersion( Integer.valueOf( 3 ), VERSION_6 );
-
-    /**
-     * Represents the JavaEE 7 version.
-     */
-    public static final JavaEEVersion SEVEN = new JavaEEVersion( Integer.valueOf( 4 ), VERSION_7 );
-
-    /**
-     * Represents the JavaEE 8 version.
-     */
-    public static final JavaEEVersion EIGHT = new JavaEEVersion( Integer.valueOf( 5 ), VERSION_8 );
-
-    private final Integer index;
-
-    private final String version;
-
-    private JavaEEVersion( Integer index, String version )
-    {
-        this.index = index;
-        this.version = version;
-        VERSION_MAP.put( version, this );
-    }
-
-    /**
-     * @param paramVersion The version.
-     * @return {@link JavaEEVersion}
-     * @throws InvalidJavaEEVersion in case of a wrong version.
-     */
-    public static JavaEEVersion getJavaEEVersion( String paramVersion )
-        throws InvalidJavaEEVersion
-    {
-        if ( !isValid( paramVersion ) )
-        {
-            throw new InvalidJavaEEVersion( "Invalid version [" + paramVersion + "]", paramVersion );
-        }
-        return VERSION_MAP.get( paramVersion );
-    }
-
-    /**
-     * Returns the version as a string.
-     * 
-     * @return the version string
-     */
-    public String getVersion()
-    {
-        return version;
-    }
-
-    /**
-     * Specifies if this version is greater or equal to the specified version.
-     * 
-     * @param parmVersion the version to check
-     * @return true if this version is greater or equal to <tt>version</tt>
-     */
-    public boolean ge( JavaEEVersion parmVersion )
-    {
-        return this.compareTo( parmVersion ) >= 0;
-    }
-
-    /**
-     * Specifies if this version is greater than the specified version.
-     * 
-     * @param paramVersion the version to check
-     * @return true if this version is greater to <tt>version</tt>
-     */
-    public boolean gt( JavaEEVersion paramVersion )
-    {
-        return this.compareTo( paramVersion ) > 0;
-    }
-
-    /**
-     * Specifies if this version is equal to the specified version.
-     * 
-     * @param paramVersion the version to check
-     * @return true if this version is equal to <tt>version</tt>
-     */
-    public boolean eq( JavaEEVersion paramVersion )
-    {
-        return this.compareTo( paramVersion ) == 0;
-    }
-
-    /**
-     * Specifies if this version is less or equal to the specified version.
-     * 
-     * @param paramVersion the version to check
-     * @return true if this version is less or equal to <tt>version</tt>
-     */
-    public boolean le( JavaEEVersion paramVersion )
-    {
-        return this.compareTo( paramVersion ) <= 0;
-    }
-
-    /**
-     * Specifies if this version is less than the specified version.
-     * 
-     * @param paramVersion the version to check
-     * @return true if this version is less or equal to <tt>version</tt>
-     */
-    public boolean lt( JavaEEVersion paramVersion )
-    {
-        return this.compareTo( paramVersion ) < 0;
-    }
-
-    /**
-     * Checks if the specified version string is valid.
-     * 
-     * @param paramVersion the version string to check
-     * @return <tt>true</tt> if the version is valid
-     */
-    private static boolean isValid( String paramVersion )
-    {
-        if ( paramVersion == null )
-        {
-            throw new IllegalArgumentException( "version could not be null." );
-        }
-        // @formatter:off
-        return VERSION_1_3.equals( paramVersion ) 
-            || VERSION_1_4.equals( paramVersion )
-            || VERSION_5.equals( paramVersion ) 
-            || VERSION_6.equals( paramVersion ) 
-            || VERSION_7.equals( paramVersion )
-            || VERSION_8.equals( paramVersion );
-        // @formatter:on
-    }
-
-    /** {@inheritDoc} */
-    public int compareTo( JavaEEVersion otherVersion )
-    {
-        if ( otherVersion == null )
-        {
-            throw new IllegalArgumentException( "other object to compare to could not be null." );
-        }
-        return index.compareTo( otherVersion.index );
-    }
+package org.apache.maven.plugins.ear.util;

+

+/*

+ * 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 java.util.HashMap;

+import java.util.Map;

+

+/**

+ * Represents the supported JavaEE version.

+ * 

+ * @author Stephane Nicoll

+ */

+public class JavaEEVersion

+    implements Comparable<JavaEEVersion>

+{

+

+    private static final String VERSION_1_3 = "1.3";

+

+    private static final String VERSION_1_4 = "1.4";

+

+    private static final String VERSION_5 = "5";

+

+    private static final String VERSION_6 = "6";

+

+    private static final String VERSION_7 = "7";

+    

+    private static final String VERSION_8 = "8";

+

+    private static final Map<String, JavaEEVersion> VERSION_MAP = new HashMap<String, JavaEEVersion>();

+

+    /**

+     * Represents the J2EE 1.3 version.

+     */

+    public static final JavaEEVersion ONE_DOT_THREE = new JavaEEVersion( Integer.valueOf( 0 ), VERSION_1_3 );

+

+    /**

+     * Represents the J2EE 1.4 version.

+     */

+    public static final JavaEEVersion ONE_DOT_FOUR = new JavaEEVersion( Integer.valueOf( 1 ), VERSION_1_4 );

+

+    /**

+     * Represents the JavaEE 5 version.

+     */

+    public static final JavaEEVersion FIVE = new JavaEEVersion( Integer.valueOf( 2 ), VERSION_5 );

+

+    /**

+     * Represents the JavaEE 6 version.

+     */

+    public static final JavaEEVersion SIX = new JavaEEVersion( Integer.valueOf( 3 ), VERSION_6 );

+

+    /**

+     * Represents the JavaEE 7 version.

+     */

+    public static final JavaEEVersion SEVEN = new JavaEEVersion( Integer.valueOf( 4 ), VERSION_7 );

+

+    /**

+     * Represents the JavaEE 8 version.

+     */

+    public static final JavaEEVersion EIGHT = new JavaEEVersion( Integer.valueOf( 5 ), VERSION_8 );

+

+    private final Integer index;

+

+    private final String version;

+

+    private JavaEEVersion( Integer index, String version )

+    {

+        this.index = index;

+        this.version = version;

+        VERSION_MAP.put( version, this );

+    }

+

+    /**

+     * @param paramVersion The version.

+     * @return {@link JavaEEVersion}

+     * @throws InvalidJavaEEVersion in case of a wrong version.

+     */

+    public static JavaEEVersion getJavaEEVersion( String paramVersion )

+        throws InvalidJavaEEVersion

+    {

+        if ( !isValid( paramVersion ) )

+        {

+            throw new InvalidJavaEEVersion( "Invalid version [" + paramVersion + "]", paramVersion );

+        }

+        return VERSION_MAP.get( paramVersion );

+    }

+

+    /**

+     * Returns the version as a string.

+     * 

+     * @return the version string

+     */

+    public String getVersion()

+    {

+        return version;

+    }

+

+    /**

+     * Specifies if this version is greater or equal to the specified version.

+     * 

+     * @param parmVersion the version to check

+     * @return true if this version is greater or equal to <tt>version</tt>

+     */

+    public boolean ge( JavaEEVersion parmVersion )

+    {

+        return this.compareTo( parmVersion ) >= 0;

+    }

+

+    /**

+     * Specifies if this version is greater than the specified version.

+     * 

+     * @param paramVersion the version to check

+     * @return true if this version is greater to <tt>version</tt>

+     */

+    public boolean gt( JavaEEVersion paramVersion )

+    {

+        return this.compareTo( paramVersion ) > 0;

+    }

+

+    /**

+     * Specifies if this version is equal to the specified version.

+     * 

+     * @param paramVersion the version to check

+     * @return true if this version is equal to <tt>version</tt>

+     */

+    public boolean eq( JavaEEVersion paramVersion )

+    {

+        return this.compareTo( paramVersion ) == 0;

+    }

+

+    /**

+     * Specifies if this version is less or equal to the specified version.

+     * 

+     * @param paramVersion the version to check

+     * @return true if this version is less or equal to <tt>version</tt>

+     */

+    public boolean le( JavaEEVersion paramVersion )

+    {

+        return this.compareTo( paramVersion ) <= 0;

+    }

+

+    /**

+     * Specifies if this version is less than the specified version.

+     * 

+     * @param paramVersion the version to check

+     * @return true if this version is less or equal to <tt>version</tt>

+     */

+    public boolean lt( JavaEEVersion paramVersion )

+    {

+        return this.compareTo( paramVersion ) < 0;

+    }

+

+    /**

+     * Checks if the specified version string is valid.

+     * 

+     * @param paramVersion the version string to check

+     * @return <tt>true</tt> if the version is valid

+     */

+    private static boolean isValid( String paramVersion )

+    {

+        if ( paramVersion == null )

+        {

+            throw new IllegalArgumentException( "version could not be null." );

+        }

+        // @formatter:off

+        return VERSION_1_3.equals( paramVersion ) 

+            || VERSION_1_4.equals( paramVersion )

+            || VERSION_5.equals( paramVersion ) 

+            || VERSION_6.equals( paramVersion ) 

+            || VERSION_7.equals( paramVersion )

+            || VERSION_8.equals( paramVersion );

+        // @formatter:on

+    }

+

+    /** {@inheritDoc} */

+    public int compareTo( JavaEEVersion otherVersion )

+    {

+        if ( otherVersion == null )

+        {

+            throw new IllegalArgumentException( "other object to compare to could not be null." );

+        }

+        return index.compareTo( otherVersion.index );

+    }

 }
\ No newline at end of file
diff --git a/src/main/java/org/apache/maven/plugin/ear/util/ModuleIdentifierValidator.java b/src/main/java/org/apache/maven/plugins/ear/util/ModuleIdentifierValidator.java
similarity index 97%
rename from src/main/java/org/apache/maven/plugin/ear/util/ModuleIdentifierValidator.java
rename to src/main/java/org/apache/maven/plugins/ear/util/ModuleIdentifierValidator.java
index 78dc5ec..b2c7f21 100644
--- a/src/main/java/org/apache/maven/plugin/ear/util/ModuleIdentifierValidator.java
+++ b/src/main/java/org/apache/maven/plugins/ear/util/ModuleIdentifierValidator.java
@@ -1,4 +1,4 @@
-package org.apache.maven.plugin.ear.util;
+package org.apache.maven.plugins.ear.util;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -24,7 +24,7 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.maven.plugin.ear.EarModule;
+import org.apache.maven.plugins.ear.EarModule;
 
 /**
  * This class will check the list of modules if there exist a duplicate artifactId. If we have such case it's necessary
diff --git a/src/test/java/org/apache/maven/plugin/ear/AbstractEarTestBase.java b/src/test/java/org/apache/maven/plugins/ear/AbstractEarTestBase.java
similarity index 94%
rename from src/test/java/org/apache/maven/plugin/ear/AbstractEarTestBase.java
rename to src/test/java/org/apache/maven/plugins/ear/AbstractEarTestBase.java
index 6ae9066..f230de2 100644
--- a/src/test/java/org/apache/maven/plugin/ear/AbstractEarTestBase.java
+++ b/src/test/java/org/apache/maven/plugins/ear/AbstractEarTestBase.java
@@ -1,120 +1,122 @@
-package org.apache.maven.plugin.ear;
-
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.ear.stub.ArtifactTestStub;
-
-/*
- * 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.
- */
-
-/**
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- */
-public abstract class AbstractEarTestBase
-{
-
-    public static final String DEFAULT_GROUPID = "eartest";
-
-    public static final String DEFAULT_TYPE = "jar";
-
-    protected void setUri( EarModule module, String uri )
-    {
-        ( (AbstractEarModule) module ).setUri( uri );
-    }
-
-    protected Set<Artifact> createArtifacts( String[] artifactsId )
-    {
-        return createArtifacts( artifactsId, null );
-    }
-
-    protected Set<Artifact> createArtifacts( String[] artifactsId, String[] types )
-    {
-        return createArtifacts( artifactsId, types, null );
-    }
-
-    protected Set<Artifact> createArtifacts( String[] artifactsId, String[] types, String[] groupsId )
-    {
-        return createArtifacts( artifactsId, types, groupsId, null );
-    }
-
-    protected Set<Artifact> createArtifacts( String[] artifactsId, String[] types, String[] groupsId,
-                                             String[] classifiers )
-    {
-        Set<Artifact> result = new TreeSet<Artifact>();
-        if ( artifactsId == null || artifactsId.length == 0 )
-        {
-            return result;
-        }
-        for ( int i = 0; i < artifactsId.length; i++ )
-        {
-            String artifactId = artifactsId[i];
-            String type = getData( types, i, DEFAULT_TYPE );
-            String groupId = getData( groupsId, i, DEFAULT_GROUPID );
-            String classifier = getData( classifiers, i, null );
-            result.add( new ArtifactTestStub( groupId, artifactId, type, classifier ) );
-
-        }
-        return result;
-    }
-
-    protected String getData( String[] data, int i, String defaultValue )
-    {
-        if ( data == null || data[i] == null )
-        {
-            return defaultValue;
-        }
-        else
-        {
-            return data[i];
-
-        }
-    }
-
-    protected String getDefaultValue( String t, String defaultValue )
-    {
-        if ( t == null )
-        {
-            return defaultValue;
-        }
-        else
-        {
-            return t;
-        }
-    }
-
-    protected Artifact createArtifact( String artifactId, String type, String groupId, String classifier )
-    {
-        return new ArtifactTestStub( getDefaultValue( groupId, DEFAULT_GROUPID ), artifactId,
-                                     getDefaultValue( type, DEFAULT_TYPE ), classifier );
-    }
-
-    protected Artifact createArtifact( String artifactId, String type, String groupId )
-    {
-        return createArtifact( artifactId, type, groupId, null );
-
-    }
-
-    protected Artifact createArtifact( String artifactId, String type )
-    {
-        return createArtifact( artifactId, type, null );
-
-    }
-}
+package org.apache.maven.plugins.ear;

+

+import java.util.Set;

+import java.util.TreeSet;

+

+import org.apache.maven.artifact.Artifact;

+import org.apache.maven.plugins.ear.AbstractEarModule;

+import org.apache.maven.plugins.ear.EarModule;

+import org.apache.maven.plugins.ear.stub.ArtifactTestStub;

+

+/*

+ * 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.

+ */

+

+/**

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ */

+public abstract class AbstractEarTestBase

+{

+

+    public static final String DEFAULT_GROUPID = "eartest";

+

+    public static final String DEFAULT_TYPE = "jar";

+

+    protected void setUri( EarModule module, String uri )

+    {

+        ( (AbstractEarModule) module ).setUri( uri );

+    }

+

+    protected Set<Artifact> createArtifacts( String[] artifactsId )

+    {

+        return createArtifacts( artifactsId, null );

+    }

+

+    protected Set<Artifact> createArtifacts( String[] artifactsId, String[] types )

+    {

+        return createArtifacts( artifactsId, types, null );

+    }

+

+    protected Set<Artifact> createArtifacts( String[] artifactsId, String[] types, String[] groupsId )

+    {

+        return createArtifacts( artifactsId, types, groupsId, null );

+    }

+

+    protected Set<Artifact> createArtifacts( String[] artifactsId, String[] types, String[] groupsId,

+                                             String[] classifiers )

+    {

+        Set<Artifact> result = new TreeSet<Artifact>();

+        if ( artifactsId == null || artifactsId.length == 0 )

+        {

+            return result;

+        }

+        for ( int i = 0; i < artifactsId.length; i++ )

+        {

+            String artifactId = artifactsId[i];

+            String type = getData( types, i, DEFAULT_TYPE );

+            String groupId = getData( groupsId, i, DEFAULT_GROUPID );

+            String classifier = getData( classifiers, i, null );

+            result.add( new ArtifactTestStub( groupId, artifactId, type, classifier ) );

+

+        }

+        return result;

+    }

+

+    protected String getData( String[] data, int i, String defaultValue )

+    {

+        if ( data == null || data[i] == null )

+        {

+            return defaultValue;

+        }

+        else

+        {

+            return data[i];

+

+        }

+    }

+

+    protected String getDefaultValue( String t, String defaultValue )

+    {

+        if ( t == null )

+        {

+            return defaultValue;

+        }

+        else

+        {

+            return t;

+        }

+    }

+

+    protected Artifact createArtifact( String artifactId, String type, String groupId, String classifier )

+    {

+        return new ArtifactTestStub( getDefaultValue( groupId, DEFAULT_GROUPID ), artifactId,

+                                     getDefaultValue( type, DEFAULT_TYPE ), classifier );

+    }

+

+    protected Artifact createArtifact( String artifactId, String type, String groupId )

+    {

+        return createArtifact( artifactId, type, groupId, null );

+

+    }

+

+    protected Artifact createArtifact( String artifactId, String type )

+    {

+        return createArtifact( artifactId, type, null );

+

+    }

+}

diff --git a/src/test/java/org/apache/maven/plugin/ear/EarModuleTest.java b/src/test/java/org/apache/maven/plugins/ear/EarModuleTest.java
similarity index 89%
rename from src/test/java/org/apache/maven/plugin/ear/EarModuleTest.java
rename to src/test/java/org/apache/maven/plugins/ear/EarModuleTest.java
index 5574be6..7e0582d 100644
--- a/src/test/java/org/apache/maven/plugin/ear/EarModuleTest.java
+++ b/src/test/java/org/apache/maven/plugins/ear/EarModuleTest.java
@@ -1,44 +1,45 @@
-package org.apache.maven.plugin.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 static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-/**
- * Ear module test case.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public class EarModuleTest
-{
-
-    @Test
-    public void testCleanBuildDir()
-    {
-        assertEquals( "APP-INF/lib/", AbstractEarModule.cleanBundleDir( "APP-INF/lib" ) );
-        assertEquals( "APP-INF/lib/", AbstractEarModule.cleanBundleDir( "APP-INF/lib/" ) );
-        assertEquals( "APP-INF/lib/", AbstractEarModule.cleanBundleDir( "/APP-INF/lib" ) );
-        assertEquals( "APP-INF/lib/", AbstractEarModule.cleanBundleDir( "/APP-INF/lib/" ) );
-        assertEquals( "", AbstractEarModule.cleanBundleDir( "/" ) );
-    }
-}
+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 static org.junit.Assert.assertEquals;

+

+import org.apache.maven.plugins.ear.AbstractEarModule;

+import org.junit.Test;

+

+/**

+ * Ear module test case.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: EarModuleTest.java 1648192 2014-12-28 12:39:04Z khmarbaise $

+ */

+public class EarModuleTest

+{

+

+    @Test

+    public void testCleanBuildDir()

+    {

+        assertEquals( "APP-INF/lib/", AbstractEarModule.cleanBundleDir( "APP-INF/lib" ) );

+        assertEquals( "APP-INF/lib/", AbstractEarModule.cleanBundleDir( "APP-INF/lib/" ) );

+        assertEquals( "APP-INF/lib/", AbstractEarModule.cleanBundleDir( "/APP-INF/lib" ) );

+        assertEquals( "APP-INF/lib/", AbstractEarModule.cleanBundleDir( "/APP-INF/lib/" ) );

+        assertEquals( "", AbstractEarModule.cleanBundleDir( "/" ) );

+    }

+}

diff --git a/src/test/java/org/apache/maven/plugin/ear/EnvEntryTest.java b/src/test/java/org/apache/maven/plugins/ear/EnvEntryTest.java
similarity index 96%
rename from src/test/java/org/apache/maven/plugin/ear/EnvEntryTest.java
rename to src/test/java/org/apache/maven/plugins/ear/EnvEntryTest.java
index 0984f97..2ad6dfa 100644
--- a/src/test/java/org/apache/maven/plugin/ear/EnvEntryTest.java
+++ b/src/test/java/org/apache/maven/plugins/ear/EnvEntryTest.java
@@ -1,92 +1,94 @@
-package org.apache.maven.plugin.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.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-/**
- * @author Stephane Nicoll
- */
-public class EnvEntryTest
-{
-
-    public static final String DESCRIPTION = "description";
-
-    public static final String NAME = "name";
-
-    public static final String TYPE = Integer.class.getName();
-
-    public static final String VALUE = "34";
-
-    @Test
-    public void createComplete()
-    {
-        final EnvEntry envEntry = new EnvEntry( DESCRIPTION, NAME, TYPE, VALUE );
-        assertEnvEntry( envEntry, DESCRIPTION, NAME, TYPE, VALUE );
-    }
-
-    @Test
-    public void createWithoutTypeButValue()
-    {
-        final EnvEntry envEntry = new EnvEntry( null, NAME, null, VALUE );
-        assertEnvEntry( envEntry, null, NAME, null, VALUE );
-    }
-
-    @Test( expected = IllegalArgumentException.class )
-    public void createWithoutName()
-    {
-        new EnvEntry( DESCRIPTION, null, TYPE, VALUE );
-
-    }
-
-    @Test( expected = IllegalArgumentException.class )
-    public void createWithEmptyName()
-    {
-        new EnvEntry( DESCRIPTION, "", TYPE, VALUE );
-    }
-
-    @Test( expected = IllegalArgumentException.class )
-    public void createWithNullTypeAndNoValue()
-    {
-        new EnvEntry( DESCRIPTION, NAME, null, null );
-
-    }
-
-    @Test( expected = IllegalArgumentException.class )
-    public void createWithEmptyTypeAndNoValue()
-    {
-        new EnvEntry( DESCRIPTION, NAME, "", null );
-
-    }
-
-    private void assertEnvEntry( EnvEntry actual, String description, String name, String type, String value )
-    {
-        assertNotNull( "Env entry could not be null", actual );
-        assertNotNull( "ToString could not be null", actual.toString() );
-        assertEquals( "Wrong env entry description for [" + actual + "]", description, actual.getDescription() );
-        assertEquals( "Wrong env entry name for [" + actual + "]", name, actual.getName() );
-        assertEquals( "Wrong env entry type for [" + actual + "]", type, actual.getType() );
-        assertEquals( "Wrong env entry value for [" + actual + "]", value, actual.getValue() );
-
-    }
-}
+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.junit.Test;

+

+import static org.junit.Assert.assertEquals;

+import static org.junit.Assert.assertNotNull;

+

+import org.apache.maven.plugins.ear.EnvEntry;

+

+/**

+ * @author Stephane Nicoll

+ */

+public class EnvEntryTest

+{

+

+    public static final String DESCRIPTION = "description";

+

+    public static final String NAME = "name";

+

+    public static final String TYPE = Integer.class.getName();

+

+    public static final String VALUE = "34";

+

+    @Test

+    public void createComplete()

+    {

+        final EnvEntry envEntry = new EnvEntry( DESCRIPTION, NAME, TYPE, VALUE );

+        assertEnvEntry( envEntry, DESCRIPTION, NAME, TYPE, VALUE );

+    }

+

+    @Test

+    public void createWithoutTypeButValue()

+    {

+        final EnvEntry envEntry = new EnvEntry( null, NAME, null, VALUE );

+        assertEnvEntry( envEntry, null, NAME, null, VALUE );

+    }

+

+    @Test( expected = IllegalArgumentException.class )

+    public void createWithoutName()

+    {

+        new EnvEntry( DESCRIPTION, null, TYPE, VALUE );

+

+    }

+

+    @Test( expected = IllegalArgumentException.class )

+    public void createWithEmptyName()

+    {

+        new EnvEntry( DESCRIPTION, "", TYPE, VALUE );

+    }

+

+    @Test( expected = IllegalArgumentException.class )

+    public void createWithNullTypeAndNoValue()

+    {

+        new EnvEntry( DESCRIPTION, NAME, null, null );

+

+    }

+

+    @Test( expected = IllegalArgumentException.class )

+    public void createWithEmptyTypeAndNoValue()

+    {

+        new EnvEntry( DESCRIPTION, NAME, "", null );

+

+    }

+

+    private void assertEnvEntry( EnvEntry actual, String description, String name, String type, String value )

+    {

+        assertNotNull( "Env entry could not be null", actual );

+        assertNotNull( "ToString could not be null", actual.toString() );

+        assertEquals( "Wrong env entry description for [" + actual + "]", description, actual.getDescription() );

+        assertEquals( "Wrong env entry name for [" + actual + "]", name, actual.getName() );

+        assertEquals( "Wrong env entry type for [" + actual + "]", type, actual.getType() );

+        assertEquals( "Wrong env entry value for [" + actual + "]", value, actual.getValue() );

+

+    }

+}

diff --git a/src/test/java/org/apache/maven/plugin/ear/it/AbstractEarPluginIT.java b/src/test/java/org/apache/maven/plugins/ear/it/AbstractEarPluginIT.java
similarity index 98%
rename from src/test/java/org/apache/maven/plugin/ear/it/AbstractEarPluginIT.java
rename to src/test/java/org/apache/maven/plugins/ear/it/AbstractEarPluginIT.java
index 7331e0c..864507b 100644
--- a/src/test/java/org/apache/maven/plugin/ear/it/AbstractEarPluginIT.java
+++ b/src/test/java/org/apache/maven/plugins/ear/it/AbstractEarPluginIT.java
@@ -1,413 +1,413 @@
-package org.apache.maven.plugin.ear.it;
-
-/*
- * 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 java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import junit.framework.TestCase;
-
-import org.apache.maven.it.VerificationException;
-import org.apache.maven.it.Verifier;
-import org.apache.maven.it.util.ResourceExtractor;
-import org.apache.maven.plugin.ear.util.ResourceEntityResolver;
-import org.custommonkey.xmlunit.Diff;
-import org.custommonkey.xmlunit.XMLAssert;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * Base class for ear test cases.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public abstract class AbstractEarPluginIT
-    extends TestCase
-{
-
-    protected final String FINAL_NAME_PREFIX = "maven-ear-plugin-test-";
-
-    protected final String FINAL_NAME_SUFFIX = "-99.0";
-
-    /**
-     * The base directory.
-     */
-    private File basedir;
-
-    /**
-     * Test repository directory.
-     */
-    protected File localRepositoryDir = new File( getBasedir().getAbsolutePath(), "target/test-classes/m2repo" );
-
-    protected File settingsFile = new File( getBasedir().getAbsolutePath(), "target/test-classes/settings.xml" );
-
-    /**
-     * Execute the EAR plugin for the specified project.
-     * 
-     * @param projectName the name of the project
-     * @param properties extra properties to be used by the embedder
-     * @return the base directory of the project
-     * @throws Exception if an error occurred
-     */
-    @SuppressWarnings( "unchecked" )
-    protected File executeMojo( final String projectName, final Properties properties, boolean expectNoError )
-        throws Exception
-    {
-        System.out.println( "  Building: " + projectName );
-
-        File testDir = getTestDir( projectName );
-        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
-        // Let's add alternate settings.xml setting so that the latest dependencies are used
-        String localRepo = System.getProperty( "localRepositoryPath" );
-        verifier.setLocalRepo( localRepo );
-
-        verifier.getCliOptions().add( "-s \"" + settingsFile.getAbsolutePath() + "\"" );//
-        verifier.getCliOptions().add( "-X" );
-        verifier.localRepo = localRepo;
-
-        // On linux and macOSX, an exception is thrown if a build failure occurs underneath
-        try
-        {
-            verifier.executeGoal( "package" );
-        }
-        catch ( VerificationException e )
-        {
-            // @TODO needs to be handled nicely in the verifier
-            if ( expectNoError || !e.getMessage().contains( "Exit code was non-zero" ) )
-            {
-                throw e;
-            }
-        }
-
-        // If no error is expected make sure that error logs are free
-        if ( expectNoError )
-        {
-            verifier.verifyErrorFreeLog();
-        }
-        verifier.resetStreams();
-        return testDir;
-    }
-
-    /**
-     * Execute the EAR plugin for the specified project.
-     * 
-     * @param projectName the name of the project
-     * @param properties extra properties to be used by the embedder
-     * @return the base directory of the project
-     * @throws Exception if an error occurred
-     */
-    protected File executeMojo( final String projectName, final Properties properties )
-        throws Exception
-    {
-        return executeMojo( projectName, properties, true );
-    }
-
-    /**
-     * Executes the specified projects and asserts the given artifacts.
-     * 
-     * @param projectName the project to test
-     * @param expectedArtifacts the list of artifacts to be found in the EAR archive
-     * @param artifactsDirectory whether the artifact is an exploded artifactsDirectory or not
-     * @param testDeploymentDescriptors whether we should test deployment descriptors
-     * @return the base directory of the project
-     * @throws Exception
-     */
-    protected File doTestProject( final String projectName, final String[] expectedArtifacts,
-                                  final boolean[] artifactsDirectory, boolean testDeploymentDescriptors )
-        throws Exception
-    {
-        final File baseDir = executeMojo( projectName, new Properties() );
-        assertEarArchive( baseDir, projectName );
-        assertEarDirectory( baseDir, projectName );
-
-        assertArchiveContent( baseDir, projectName, expectedArtifacts, artifactsDirectory );
-
-        if ( testDeploymentDescriptors )
-        {
-            assertDeploymentDescriptors( baseDir, projectName );
-        }
-
-        return baseDir;
-
-    }
-
-    /**
-     * Executes the specified projects and asserts the given artifacts. Assert the deployment descriptors are valid
-     * 
-     * @param projectName the project to test
-     * @param expectedArtifacts the list of artifacts to be found in the EAR archive
-     * @param artifactsDirectory whether the artifact is an exploded artifactsDirectory or not
-     * @return the base directory of the project
-     * @throws Exception
-     */
-    protected File doTestProject( final String projectName, final String[] expectedArtifacts,
-                                  final boolean[] artifactsDirectory )
-        throws Exception
-    {
-        return doTestProject( projectName, expectedArtifacts, artifactsDirectory, true );
-
-    }
-
-    /**
-     * Executes the specified projects and asserts the given artifacts as artifacts (non directory)
-     * 
-     * @param projectName the project to test
-     * @param expectedArtifacts the list of artifacts to be found in the EAR archive
-     * @param testDeploymentDescriptors whether we should test deployment descriptors
-     * @return the base directory of the project
-     * @throws Exception
-     */
-    protected File doTestProject( final String projectName, final String[] expectedArtifacts,
-                                  boolean testDeploymentDescriptors )
-        throws Exception
-    {
-        return doTestProject( projectName, expectedArtifacts, new boolean[expectedArtifacts.length] );
-    }
-
-    /**
-     * Executes the specified projects and asserts the given artifacts as artifacts (non directory). Assert the
-     * deployment descriptors are valid
-     * 
-     * @param projectName the project to test
-     * @param expectedArtifacts the list of artifacts to be found in the EAR archive
-     * @return the base directory of the project
-     * @throws Exception
-     */
-    protected File doTestProject( final String projectName, final String[] expectedArtifacts )
-        throws Exception
-    {
-        return doTestProject( projectName, expectedArtifacts, true );
-    }
-
-    protected void assertEarArchive( final File baseDir, final String projectName )
-    {
-        assertTrue( "EAR archive does not exist", getEarArchive( baseDir, projectName ).exists() );
-    }
-
-    protected void assertEarDirectory( final File baseDir, final String projectName )
-    {
-        assertTrue( "EAR archive directory does not exist", getEarDirectory( baseDir, projectName ).exists() );
-    }
-
-    protected File getTargetDirectory( final File basedir )
-    {
-        return new File( basedir, "target" );
-    }
-
-    protected File getEarArchive( final File baseDir, final String projectName )
-    {
-        return new File( getTargetDirectory( baseDir ), buildFinalName( projectName ) + ".ear" );
-    }
-
-    protected File getEarDirectory( final File baseDir, final String projectName )
-    {
-        return new File( getTargetDirectory( baseDir ), buildFinalName( projectName ) );
-    }
-
-    protected String buildFinalName( final String projectName )
-    {
-        return FINAL_NAME_PREFIX + projectName + FINAL_NAME_SUFFIX;
-    }
-
-    protected void assertArchiveContent( final File baseDir, final String projectName, final String[] artifactNames,
-                                         final boolean[] artifactsDirectory )
-    {
-        // sanity check
-        assertEquals( "Wrong parameter, artifacts mismatch directory flags", artifactNames.length,
-                      artifactsDirectory.length );
-
-        File dir = getEarDirectory( baseDir, projectName );
-
-        // Let's build the expected directories sort list
-        final List<File> expectedDirectories = new ArrayList<File>();
-        for ( int i = 0; i < artifactsDirectory.length; i++ )
-        {
-            if ( artifactsDirectory[i] )
-            {
-                expectedDirectories.add( new File( dir, artifactNames[i] ) );
-            }
-        }
-
-        final List<File> actualFiles = buildArchiveContentFiles( dir, expectedDirectories );
-        assertEquals( "Artifacts mismatch " + actualFiles, artifactNames.length, actualFiles.size() );
-        for ( int i = 0; i < artifactNames.length; i++ )
-        {
-            String artifactName = artifactNames[i];
-            final boolean isDirectory = artifactsDirectory[i];
-            File expectedFile = new File( dir, artifactName );
-
-            assertEquals( "Artifact[" + artifactName + "] not in the right form (exploded/archive", isDirectory,
-                          expectedFile.isDirectory() );
-            assertTrue( "Artifact[" + artifactName + "] not found in ear archive", actualFiles.contains( expectedFile ) );
-
-        }
-    }
-
-    protected List<File> buildArchiveContentFiles( final File baseDir, final List<File> expectedDirectories )
-    {
-        final List<File> result = new ArrayList<File>();
-        addFiles( baseDir, result, expectedDirectories );
-
-        return result;
-    }
-
-    private void addFiles( final File directory, final List<File> files, final List<File> expectedDirectories )
-    {
-        File[] result = directory.listFiles( new FilenameFilter()
-        {
-            public boolean accept( File dir, String name )
-            {
-                return !name.equals( "META-INF" );
-            }
-
-        } );
-
-        /*
-         * Kinda complex. If we found a file, we always add it to the list of files. If a directory is within the
-         * expectedDirectories short list we add it but we don't add it's content. Otherwise, we don't add the directory
-         * *BUT* we browse it's content
-         */
-        for ( File file : result )
-        {
-            if ( file.isFile() )
-            {
-                files.add( file );
-            }
-            else if ( expectedDirectories.contains( file ) )
-            {
-                files.add( file );
-            }
-            else
-            {
-                addFiles( file, files, expectedDirectories );
-            }
-        }
-    }
-
-    protected File getBasedir()
-    {
-        if ( basedir != null )
-        {
-            return basedir;
-        }
-
-        final String basedirString = System.getProperty( "basedir" );
-        if ( basedirString == null )
-        {
-            basedir = new File( "" );
-        }
-        else
-        {
-            basedir = new File( basedirString );
-        }
-        return basedir;
-    }
-
-    protected File getTestDir( String projectName )
-        throws IOException
-    {
-        return ResourceExtractor.simpleExtractResources( getClass(), "/projects/" + projectName );
-    }
-
-    // Generated application.xml stuff
-
-    /**
-     * Asserts that the deployment descriptors have been generated successfully.
-     * <p/>
-     * This test assumes that deployment descriptors are located in the <tt>expected-META-INF</tt> directory of the
-     * project. Note that the <tt>MANIFEST.mf</tt> file is ignored and is not tested.
-     * 
-     * @param baseDir the directory of the tested project
-     * @param projectName the name of the project
-     */
-    protected void assertDeploymentDescriptors( final File baseDir, final String projectName )
-        throws IOException
-    {
-        final File earDirectory = getEarDirectory( baseDir, projectName );
-        final File[] actualDeploymentDescriptors = getDeploymentDescriptors( new File( earDirectory, "META-INF" ) );
-        final File[] expectedDeploymentDescriptors =
-            getDeploymentDescriptors( new File( baseDir, "expected-META-INF" ) );
-
-        if ( expectedDeploymentDescriptors == null )
-        {
-            assertNull( "No deployment descriptor was expected", actualDeploymentDescriptors );
-        }
-        else
-        {
-            assertNotNull( "Missing deployment descriptor", actualDeploymentDescriptors );
-
-            // Make sure we have the same number of files
-            assertEquals( "Number of Deployment descriptor(s) mismatch", expectedDeploymentDescriptors.length,
-                          actualDeploymentDescriptors.length );
-
-            // Sort the files so that we have the same behavior here
-            Arrays.sort( expectedDeploymentDescriptors );
-            Arrays.sort( actualDeploymentDescriptors );
-
-            for ( int i = 0; i < expectedDeploymentDescriptors.length; i++ )
-            {
-                File expectedDeploymentDescriptor = expectedDeploymentDescriptors[i];
-                File actualDeploymentDescriptor = actualDeploymentDescriptors[i];
-
-                assertEquals( "File name mismatch", expectedDeploymentDescriptor.getName(),
-                              actualDeploymentDescriptor.getName() );
-
-                try
-                {
-                    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-                    dbf.setValidating( true );
-                    DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-                    docBuilder.setEntityResolver( new ResourceEntityResolver() );
-                    docBuilder.setErrorHandler( new DefaultHandler() );
-
-                    final Diff myDiff =
-                        new Diff( docBuilder.parse( expectedDeploymentDescriptor ),
-                                  docBuilder.parse( actualDeploymentDescriptor ) );
-                    XMLAssert.assertXMLEqual( "Wrong deployment descriptor generated for["
-                        + expectedDeploymentDescriptor.getName() + "]", myDiff, true );
-                }
-                catch ( Exception e )
-                {
-                    e.printStackTrace();
-                    fail( "Could not assert deployment descriptor " + e.getMessage() );
-                }
-            }
-        }
-    }
-
-    private File[] getDeploymentDescriptors( final File ddDirectory )
-    {
-        return ddDirectory.listFiles( new FilenameFilter()
-        {
-            public boolean accept( File dir, String name )
-            {
-                return !name.equalsIgnoreCase( "manifest.mf" );
-            }
-        } );
-    }
-}
+package org.apache.maven.plugins.ear.it;

+

+/*

+ * 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 java.io.File;

+import java.io.FilenameFilter;

+import java.io.IOException;

+import java.util.ArrayList;

+import java.util.Arrays;

+import java.util.List;

+import java.util.Properties;

+

+import javax.xml.parsers.DocumentBuilder;

+import javax.xml.parsers.DocumentBuilderFactory;

+

+import junit.framework.TestCase;

+

+import org.apache.maven.it.VerificationException;

+import org.apache.maven.it.Verifier;

+import org.apache.maven.it.util.ResourceExtractor;

+import org.apache.maven.plugins.ear.util.ResourceEntityResolver;

+import org.custommonkey.xmlunit.Diff;

+import org.custommonkey.xmlunit.XMLAssert;

+import org.xml.sax.helpers.DefaultHandler;

+

+/**

+ * Base class for ear test cases.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: AbstractEarPluginIT.java 1630593 2014-10-09 20:40:31Z khmarbaise $

+ */

+public abstract class AbstractEarPluginIT

+    extends TestCase

+{

+

+    protected final String FINAL_NAME_PREFIX = "maven-ear-plugin-test-";

+

+    protected final String FINAL_NAME_SUFFIX = "-99.0";

+

+    /**

+     * The base directory.

+     */

+    private File basedir;

+

+    /**

+     * Test repository directory.

+     */

+    protected File localRepositoryDir = new File( getBasedir().getAbsolutePath(), "target/test-classes/m2repo" );

+

+    protected File settingsFile = new File( getBasedir().getAbsolutePath(), "target/test-classes/settings.xml" );

+

+    /**

+     * Execute the EAR plugin for the specified project.

+     * 

+     * @param projectName the name of the project

+     * @param properties extra properties to be used by the embedder

+     * @return the base directory of the project

+     * @throws Exception if an error occurred

+     */

+    @SuppressWarnings( "unchecked" )

+    protected File executeMojo( final String projectName, final Properties properties, boolean expectNoError )

+        throws Exception

+    {

+        System.out.println( "  Building: " + projectName );

+

+        File testDir = getTestDir( projectName );

+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );

+        // Let's add alternate settings.xml setting so that the latest dependencies are used

+        String localRepo = System.getProperty( "localRepositoryPath" );

+        verifier.setLocalRepo( localRepo );

+

+        verifier.getCliOptions().add( "-s \"" + settingsFile.getAbsolutePath() + "\"" );//

+        verifier.getCliOptions().add( "-X" );

+        verifier.localRepo = localRepo;

+

+        // On linux and macOSX, an exception is thrown if a build failure occurs underneath

+        try

+        {

+            verifier.executeGoal( "package" );

+        }

+        catch ( VerificationException e )

+        {

+            // @TODO needs to be handled nicely in the verifier

+            if ( expectNoError || !e.getMessage().contains( "Exit code was non-zero" ) )

+            {

+                throw e;

+            }

+        }

+

+        // If no error is expected make sure that error logs are free

+        if ( expectNoError )

+        {

+            verifier.verifyErrorFreeLog();

+        }

+        verifier.resetStreams();

+        return testDir;

+    }

+

+    /**

+     * Execute the EAR plugin for the specified project.

+     * 

+     * @param projectName the name of the project

+     * @param properties extra properties to be used by the embedder

+     * @return the base directory of the project

+     * @throws Exception if an error occurred

+     */

+    protected File executeMojo( final String projectName, final Properties properties )

+        throws Exception

+    {

+        return executeMojo( projectName, properties, true );

+    }

+

+    /**

+     * Executes the specified projects and asserts the given artifacts.

+     * 

+     * @param projectName the project to test

+     * @param expectedArtifacts the list of artifacts to be found in the EAR archive

+     * @param artifactsDirectory whether the artifact is an exploded artifactsDirectory or not

+     * @param testDeploymentDescriptors whether we should test deployment descriptors

+     * @return the base directory of the project

+     * @throws Exception

+     */

+    protected File doTestProject( final String projectName, final String[] expectedArtifacts,

+                                  final boolean[] artifactsDirectory, boolean testDeploymentDescriptors )

+        throws Exception

+    {

+        final File baseDir = executeMojo( projectName, new Properties() );

+        assertEarArchive( baseDir, projectName );

+        assertEarDirectory( baseDir, projectName );

+

+        assertArchiveContent( baseDir, projectName, expectedArtifacts, artifactsDirectory );

+

+        if ( testDeploymentDescriptors )

+        {

+            assertDeploymentDescriptors( baseDir, projectName );

+        }

+

+        return baseDir;

+

+    }

+

+    /**

+     * Executes the specified projects and asserts the given artifacts. Assert the deployment descriptors are valid

+     * 

+     * @param projectName the project to test

+     * @param expectedArtifacts the list of artifacts to be found in the EAR archive

+     * @param artifactsDirectory whether the artifact is an exploded artifactsDirectory or not

+     * @return the base directory of the project

+     * @throws Exception

+     */

+    protected File doTestProject( final String projectName, final String[] expectedArtifacts,

+                                  final boolean[] artifactsDirectory )

+        throws Exception

+    {

+        return doTestProject( projectName, expectedArtifacts, artifactsDirectory, true );

+

+    }

+

+    /**

+     * Executes the specified projects and asserts the given artifacts as artifacts (non directory)

+     * 

+     * @param projectName the project to test

+     * @param expectedArtifacts the list of artifacts to be found in the EAR archive

+     * @param testDeploymentDescriptors whether we should test deployment descriptors

+     * @return the base directory of the project

+     * @throws Exception

+     */

+    protected File doTestProject( final String projectName, final String[] expectedArtifacts,

+                                  boolean testDeploymentDescriptors )

+        throws Exception

+    {

+        return doTestProject( projectName, expectedArtifacts, new boolean[expectedArtifacts.length] );

+    }

+

+    /**

+     * Executes the specified projects and asserts the given artifacts as artifacts (non directory). Assert the

+     * deployment descriptors are valid

+     * 

+     * @param projectName the project to test

+     * @param expectedArtifacts the list of artifacts to be found in the EAR archive

+     * @return the base directory of the project

+     * @throws Exception

+     */

+    protected File doTestProject( final String projectName, final String[] expectedArtifacts )

+        throws Exception

+    {

+        return doTestProject( projectName, expectedArtifacts, true );

+    }

+

+    protected void assertEarArchive( final File baseDir, final String projectName )

+    {

+        assertTrue( "EAR archive does not exist", getEarArchive( baseDir, projectName ).exists() );

+    }

+

+    protected void assertEarDirectory( final File baseDir, final String projectName )

+    {

+        assertTrue( "EAR archive directory does not exist", getEarDirectory( baseDir, projectName ).exists() );

+    }

+

+    protected File getTargetDirectory( final File basedir )

+    {

+        return new File( basedir, "target" );

+    }

+

+    protected File getEarArchive( final File baseDir, final String projectName )

+    {

+        return new File( getTargetDirectory( baseDir ), buildFinalName( projectName ) + ".ear" );

+    }

+

+    protected File getEarDirectory( final File baseDir, final String projectName )

+    {

+        return new File( getTargetDirectory( baseDir ), buildFinalName( projectName ) );

+    }

+

+    protected String buildFinalName( final String projectName )

+    {

+        return FINAL_NAME_PREFIX + projectName + FINAL_NAME_SUFFIX;

+    }

+

+    protected void assertArchiveContent( final File baseDir, final String projectName, final String[] artifactNames,

+                                         final boolean[] artifactsDirectory )

+    {

+        // sanity check

+        assertEquals( "Wrong parameter, artifacts mismatch directory flags", artifactNames.length,

+                      artifactsDirectory.length );

+

+        File dir = getEarDirectory( baseDir, projectName );

+

+        // Let's build the expected directories sort list

+        final List<File> expectedDirectories = new ArrayList<File>();

+        for ( int i = 0; i < artifactsDirectory.length; i++ )

+        {

+            if ( artifactsDirectory[i] )

+            {

+                expectedDirectories.add( new File( dir, artifactNames[i] ) );

+            }

+        }

+

+        final List<File> actualFiles = buildArchiveContentFiles( dir, expectedDirectories );

+        assertEquals( "Artifacts mismatch " + actualFiles, artifactNames.length, actualFiles.size() );

+        for ( int i = 0; i < artifactNames.length; i++ )

+        {

+            String artifactName = artifactNames[i];

+            final boolean isDirectory = artifactsDirectory[i];

+            File expectedFile = new File( dir, artifactName );

+

+            assertEquals( "Artifact[" + artifactName + "] not in the right form (exploded/archive", isDirectory,

+                          expectedFile.isDirectory() );

+            assertTrue( "Artifact[" + artifactName + "] not found in ear archive", actualFiles.contains( expectedFile ) );

+

+        }

+    }

+

+    protected List<File> buildArchiveContentFiles( final File baseDir, final List<File> expectedDirectories )

+    {

+        final List<File> result = new ArrayList<File>();

+        addFiles( baseDir, result, expectedDirectories );

+

+        return result;

+    }

+

+    private void addFiles( final File directory, final List<File> files, final List<File> expectedDirectories )

+    {

+        File[] result = directory.listFiles( new FilenameFilter()

+        {

+            public boolean accept( File dir, String name )

+            {

+                return !name.equals( "META-INF" );

+            }

+

+        } );

+

+        /*

+         * Kinda complex. If we found a file, we always add it to the list of files. If a directory is within the

+         * expectedDirectories short list we add it but we don't add it's content. Otherwise, we don't add the directory

+         * *BUT* we browse it's content

+         */

+        for ( File file : result )

+        {

+            if ( file.isFile() )

+            {

+                files.add( file );

+            }

+            else if ( expectedDirectories.contains( file ) )

+            {

+                files.add( file );

+            }

+            else

+            {

+                addFiles( file, files, expectedDirectories );

+            }

+        }

+    }

+

+    protected File getBasedir()

+    {

+        if ( basedir != null )

+        {

+            return basedir;

+        }

+

+        final String basedirString = System.getProperty( "basedir" );

+        if ( basedirString == null )

+        {

+            basedir = new File( "" );

+        }

+        else

+        {

+            basedir = new File( basedirString );

+        }

+        return basedir;

+    }

+

+    protected File getTestDir( String projectName )

+        throws IOException

+    {

+        return ResourceExtractor.simpleExtractResources( getClass(), "/projects/" + projectName );

+    }

+

+    // Generated application.xml stuff

+

+    /**

+     * Asserts that the deployment descriptors have been generated successfully.

+     * <p/>

+     * This test assumes that deployment descriptors are located in the <tt>expected-META-INF</tt> directory of the

+     * project. Note that the <tt>MANIFEST.mf</tt> file is ignored and is not tested.

+     * 

+     * @param baseDir the directory of the tested project

+     * @param projectName the name of the project

+     */

+    protected void assertDeploymentDescriptors( final File baseDir, final String projectName )

+        throws IOException

+    {

+        final File earDirectory = getEarDirectory( baseDir, projectName );

+        final File[] actualDeploymentDescriptors = getDeploymentDescriptors( new File( earDirectory, "META-INF" ) );

+        final File[] expectedDeploymentDescriptors =

+            getDeploymentDescriptors( new File( baseDir, "expected-META-INF" ) );

+

+        if ( expectedDeploymentDescriptors == null )

+        {

+            assertNull( "No deployment descriptor was expected", actualDeploymentDescriptors );

+        }

+        else

+        {

+            assertNotNull( "Missing deployment descriptor", actualDeploymentDescriptors );

+

+            // Make sure we have the same number of files

+            assertEquals( "Number of Deployment descriptor(s) mismatch", expectedDeploymentDescriptors.length,

+                          actualDeploymentDescriptors.length );

+

+            // Sort the files so that we have the same behavior here

+            Arrays.sort( expectedDeploymentDescriptors );

+            Arrays.sort( actualDeploymentDescriptors );

+

+            for ( int i = 0; i < expectedDeploymentDescriptors.length; i++ )

+            {

+                File expectedDeploymentDescriptor = expectedDeploymentDescriptors[i];

+                File actualDeploymentDescriptor = actualDeploymentDescriptors[i];

+

+                assertEquals( "File name mismatch", expectedDeploymentDescriptor.getName(),

+                              actualDeploymentDescriptor.getName() );

+

+                try

+                {

+                    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

+                    dbf.setValidating( true );

+                    DocumentBuilder docBuilder = dbf.newDocumentBuilder();

+                    docBuilder.setEntityResolver( new ResourceEntityResolver() );

+                    docBuilder.setErrorHandler( new DefaultHandler() );

+

+                    final Diff myDiff =

+                        new Diff( docBuilder.parse( expectedDeploymentDescriptor ),

+                                  docBuilder.parse( actualDeploymentDescriptor ) );

+                    XMLAssert.assertXMLEqual( "Wrong deployment descriptor generated for["

+                        + expectedDeploymentDescriptor.getName() + "]", myDiff, true );

+                }

+                catch ( Exception e )

+                {

+                    e.printStackTrace();

+                    fail( "Could not assert deployment descriptor " + e.getMessage() );

+                }

+            }

+        }

+    }

+

+    private File[] getDeploymentDescriptors( final File ddDirectory )

+    {

+        return ddDirectory.listFiles( new FilenameFilter()

+        {

+            public boolean accept( File dir, String name )

+            {

+                return !name.equalsIgnoreCase( "manifest.mf" );

+            }

+        } );

+    }

+}

diff --git a/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java b/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java
similarity index 99%
rename from src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java
rename to src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java
index c940994..419c168 100644
--- a/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java
+++ b/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java
@@ -1,887 +1,887 @@
-package org.apache.maven.plugin.ear.it;
-
-/*
- * 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 java.io.File;
-import java.io.FileInputStream;
-import java.util.Properties;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
-
-import org.apache.maven.it.util.IOUtil;
-import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.ReaderFactory;
-
-/**
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- * @noinspection JavaDoc
- */
-public class EarMojoIT
-    extends AbstractEarPluginIT
-{
-
-    /**
-     * Builds an EAR with a single EJB and no configuration.
-     */
-    public void testProject001()
-        throws Exception
-    {
-        doTestProject( "project-001", new String[] { "ejb-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a customized artifact location and a customized artifact name.
-     */
-    public void testProject002()
-        throws Exception
-    {
-        doTestProject( "project-002", new String[] { "APP-INF/lib/ejb-sample-one-1.0.jar", "ejb-sample-two.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a default bundle directory for <tt>java</tt> modules.
-     */
-    public void testProject003()
-        throws Exception
-    {
-        doTestProject( "project-003", new String[] { "ejb-sample-one-1.0.jar", "APP-INF/lib/jar-sample-one-1.0.jar",
-            "APP-INF/lib/jar-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a default bundle directory for _java_ modules and a custom location overriding the default.
-     */
-    public void testProject004()
-        throws Exception
-    {
-        doTestProject( "project-004", new String[] { "ejb-sample-one-1.0.jar", "jar-sample-one-1.0.jar",
-            "APP-INF/lib/jar-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a custom URI.
-     */
-    public void testProject005()
-        throws Exception
-    {
-        doTestProject( "project-005", new String[] { "ejb-sample-one-1.0.jar", "libs/another-name.jar" } );
-    }
-
-    /**
-     * Builds an EAR with an excluded module.
-     */
-    public void testProject006()
-        throws Exception
-    {
-        doTestProject( "project-006", new String[] { "ejb-sample-one-1.0.jar", "jar-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a classified artifact and no extra configuration.
-     */
-    public void testProject007()
-        throws Exception
-    {
-        doTestProject( "project-007", new String[] { "ejb-sample-one-1.0-classified.jar" } );
-    }
-
-    /**
-     * Builds an EAR with deployment descriptor configuration for J2EE 1.3.
-     */
-    public void testProject008()
-        throws Exception
-    {
-        doTestProject( "project-008", new String[] { "ejb-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with deployment descriptor configuration for J2EE 1.4.
-     */
-    public void testProject009()
-        throws Exception
-    {
-        doTestProject( "project-009", new String[] { "ejb-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with deployment descriptor configuration for Java EE 5.
-     */
-    public void testProject010()
-        throws Exception
-    {
-        doTestProject( "project-010", new String[] { "ejb-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR and make sure that deployment descriptor default settings are applied.
-     */
-    public void testProject011()
-        throws Exception
-    {
-        doTestProject( "project-011", new String[] { "ejb-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR and make sure that EAR resources are bundled within the EAR.
-     */
-    public void testProject012()
-        throws Exception
-    {
-        doTestProject( "project-012", new String[] { "README.txt", "LICENSE.txt", "ejb-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR and make sure that EAR resources in a customized resources directory are bundled within the EAR.
-     */
-    public void testProject013()
-        throws Exception
-    {
-        doTestProject( "project-013", new String[] { "README.txt", "LICENSE.txt", "ejb-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR and make sure that EAR resources are bundled within the EAR using includes and excludes.
-     */
-    public void testProject014()
-        throws Exception
-    {
-        doTestProject( "project-014", new String[] { "LICENSE.txt", "ejb-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR and make sure that default manifest is taken into account.
-     */
-    public void testProject015()
-        throws Exception
-    {
-        final File baseDir = doTestProject( "project-015", new String[] { "ejb-sample-one-1.0.jar" } );
-        final File expectedManifest = new File( baseDir, "src/main/application/META-INF/MANIFEST.MF" );
-        final File actualManifest = new File( getEarDirectory( baseDir, "project-015" ), "META-INF/MANIFEST.MF" );
-        assertTrue( "Manifest was not copied", actualManifest.exists() );
-        assertTrue( FileUtils.contentEquals( expectedManifest, actualManifest ) );
-    }
-
-    /**
-     * Builds an EAR and make sure that custom manifest is taken into account.
-     */
-    public void testProject016()
-        throws Exception
-    {
-        final File baseDir = doTestProject( "project-016", new String[] { "ejb-sample-one-1.0.jar" } );
-
-        final File targetFolder = new File( baseDir, "target" );
-        final File createdEarFile = new File( targetFolder, "maven-ear-plugin-test-project-016-99.0.ear" );
-
-        final File sourceManifestFile = new File( baseDir, "src/main/ear/MANIFEST.MF" );
-
-        JarFile jarFile = new JarFile( createdEarFile );
-        Manifest manifestFromCreatedEARFile = jarFile.getManifest();
-        jarFile.close();
-
-        Manifest sourceManifest = new Manifest( new FileInputStream( sourceManifestFile ) );
-
-        assertTrue( "There are differences in the manifest.", sourceManifest.equals( manifestFromCreatedEARFile ) );
-    }
-
-    /**
-     * Builds an EAR and make sure that custom application.xml is taken into account.
-     */
-    public void testProject017()
-        throws Exception
-    {
-        doTestProject( "project-017", new String[] { "ejb-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a custom final name.
-     */
-    public void testProject018()
-        throws Exception
-    {
-        final File baseDir = executeMojo( "project-018", new Properties() );
-        final File expectedFile = new File( baseDir, "target/my-custom-file.ear" );
-        assertTrue( "EAR archive not found", expectedFile.exists() );
-    }
-
-    /**
-     * Builds an EAR with unpacked archives using the unpackTypes.
-     */
-    public void testProject019()
-        throws Exception
-    {
-        doTestProject( "project-019", new String[] { "ejb-sample-one-1.0.jar", "sar-sample-one-1.0.sar",
-            "jar-sample-one-1.0.jar" }, new boolean[] { false, true, true } );
-    }
-
-    /**
-     * Builds an EAR with unpacked archives using the unpack module attribute.
-     */
-    public void testProject020()
-        throws Exception
-    {
-        doTestProject( "project-020", new String[] { "ejb-sample-one-1.0.jar", "sar-sample-one-1.0.sar",
-            "jar-sample-one-1.0.jar" }, new boolean[] { true, false, false } );
-    }
-
-    /**
-     * Builds an EAR with unpacked archives using both unpackTypes and the unpack module attribute.
-     */
-    public void testProject021()
-        throws Exception
-    {
-        doTestProject( "project-021", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar",
-            "sar-sample-one-1.0.sar", "jar-sample-one-1.0.jar", "jar-sample-two-1.0.jar" }, new boolean[] { false,
-            true, false, false, true } );
-    }
-
-    /**
-     * Builds an EAR with a classifier.
-     */
-    public void testProject022()
-        throws Exception
-    {
-        final File baseDir = executeMojo( "project-022", new Properties() );
-        final File expectedFile = new File( baseDir, "target/maven-ear-plugin-test-project-022-99.0-myclassifier.ear" );
-        assertTrue( "EAR archive not found", expectedFile.exists() );
-    }
-
-    /**
-     * Builds an EAR and make sure that a single classified dependency is detected without specifying the classifier.
-     */
-    public void testProject023()
-        throws Exception
-    {
-        doTestProject( "project-023", new String[] { "ejb-sample-one-1.0-classified.jar", "ejb-sample-two-1.0.jar" },
-                       new boolean[] { true, false } );
-    }
-
-    /**
-     * Builds an EAR and make sure that a single classified dependency is detected when specifying the classifier.
-     */
-    public void testProject024()
-        throws Exception
-    {
-        doTestProject( "project-024", new String[] { "ejb-sample-one-1.0-classified.jar", "ejb-sample-two-1.0.jar" },
-                       new boolean[] { true, false } );
-    }
-
-    /**
-     * Builds an EAR and make sure that a classified dependency with mutiple candidates is detected when specifying the
-     * classifier.
-     */
-    public void testProject025()
-        throws Exception
-    {
-        doTestProject( "project-025", new String[] { "ejb-sample-one-1.0-classified.jar", "ejb-sample-one-1.0.jar" },
-                       new boolean[] { true, false } );
-    }
-
-    /**
-     * Builds an EAR and make sure that the build fails if a unclassifed module configuration with mutiple candidates is
-     * specified.
-     */
-    public void testProject026()
-        throws Exception
-    {
-        final File baseDir = executeMojo( "project-026", new Properties(), false );
-        // Stupido, checks that the ear archive is not there
-        assertFalse( "Execution should have failed", getEarArchive( baseDir, "project-026" ).exists() );
-    }
-
-    /**
-     * Builds an EAR and make sure that provided dependencies are not included in the EAR.
-     */
-    public void testProject027()
-        throws Exception
-    {
-        doTestProject( "project-027", new String[] { "ejb-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR and make sure that test dependencies are not included in the EAR.
-     */
-    public void testProject028()
-        throws Exception
-    {
-        doTestProject( "project-028", new String[] { "ejb-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR and make sure that system dependencies are not included in the EAR.
-     */
-    public void testProject029()
-        throws Exception
-    {
-        doTestProject( "project-029", new String[] { "ejb-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR and make sure that ejb-client dependencies are detected and not added by default in the generated
-     * application.xml.
-     */
-    public void testProject030()
-        throws Exception
-    {
-        doTestProject( "project-030", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0-client.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a Jboss 4 configuration specifying the security domain and the unauthenticated-principal to
-     * use.
-     */
-    public void testProject031()
-        throws Exception
-    {
-        doTestProject( "project-031", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a Jboss 3.2 configuration specifying the jmx-name to use.
-     */
-    public void testProject032()
-        throws Exception
-    {
-        doTestProject( "project-032", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a Jboss 4 configuration and Jboss specific modules.
-     */
-    public void testProject033()
-        throws Exception
-    {
-        doTestProject( "project-033", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar",
-            "sar-sample-one-1.0.sar", "har-sample-one-1.0.har" } );
-    }
-
-    /**
-     * Builds an EAR with custom security settings.
-     */
-    public void testProject034()
-        throws Exception
-    {
-        doTestProject( "project-034", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a full filename mapping and make sure that custom locations are not overridden.
-     */
-    public void testProject035()
-        throws Exception
-    {
-        doTestProject( "project-035", new String[] { "foo/eartest-ejb-sample-one-1.0.jar",
-            "eartest-ejb-sample-two-1.0.jar", "libs/eartest-jar-sample-one-1.0.jar",
-            "libs/eartest-jar-sample-two-1.0.jar", "sar-sample-one.sar" } );
-    }
-
-    /**
-     * Builds an EAR with a full filename mapping and make sure that groupIds with dots are replaced by dashes in
-     * filenames.
-     */
-    public void testProject036()
-        throws Exception
-    {
-        doTestProject( "project-036", new String[] { "foo/eartest-ejb-sample-one-1.0.jar",
-            "eartest-ejb-sample-two-1.0.jar", "com-foo-bar-ejb-sample-one-1.0.jar",
-            "com-foo-bar-ejb-sample-two-1.0.jar", "libs/eartest-jar-sample-one-1.0.jar",
-            "libs/eartest-jar-sample-two-1.0.jar", "sar-sample-one.sar" } );
-    }
-
-    /**
-     * Builds an EAR and make sure that ejb-client dependencies are detected and added in the generated application.xml
-     * if includeInApplicationXml is set.
-     */
-    public void testProject037()
-        throws Exception
-    {
-        doTestProject( "project-037", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0-client.jar" } );
-    }
-
-    /**
-     * Builds an EAR and make sure that a non-classified dependency with mutiple candidates is detected when specifying
-     * the mainArtifactId as classifier.
-     */
-    public void testProject038()
-        throws Exception
-    {
-        doTestProject( "project-038", new String[] { "ejb-sample-one-1.0-classified.jar", "ejb-sample-one-1.0.jar" },
-                       new boolean[] { false, true } );
-    }
-
-    /**
-     * Builds an EAR with a Jboss 4 configuration specifying specifying the loader repository to use.
-     */
-    public void testProject039()
-        throws Exception
-    {
-        doTestProject( "project-039", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with deployment descriptor configuration for Java EE 5 and an alternative deployment descriptor.
-     */
-    public void testProject040()
-        throws Exception
-    {
-        doTestProject( "project-040", new String[] { "ejb-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a Jboss 4.2 configuration specifying the module order to use.
-     */
-    public void testProject041()
-        throws Exception
-    {
-        doTestProject( "project-041", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a Jboss 4.2 configuration specifying a datasource to add.
-     */
-    public void testProject042()
-        throws Exception
-    {
-        doTestProject( "project-042", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a custom descriptor location (generatedDescriptorLocation setting).
-     */
-    public void testProject043()
-        throws Exception
-    {
-        final File baseDir = doTestProject( "project-043", new String[] { "ejb-sample-one-1.0.jar" } );
-        final File expectedApplicationXml = new File( baseDir, "target/custom-descriptor-dir/application.xml" );
-        assertTrue( "Application.xml file not found", expectedApplicationXml.exists() );
-        assertFalse( "Application.xml file should not be empty", expectedApplicationXml.length() == 0 );
-    }
-
-    /**
-     * Builds an EAR with a custom library-directory.
-     */
-    public void testProject044()
-        throws Exception
-    {
-        doTestProject( "project-044", new String[] { "ejb-sample-one-1.0.jar", "myLibs/jar-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR and filter the content of the sources directory.
-     */
-    public void testProject045()
-        throws Exception
-    {
-        final File baseDir = doTestProject( "project-045", new String[] { "README.txt", "ejb-sample-one-1.0.jar" } );
-        final File actualReadme = new File( getEarDirectory( baseDir, "project-045" ), "README.txt" );
-        final String content = IOUtil.toString( ReaderFactory.newReader( actualReadme, "UTF-8" ) );
-        assertTrue( "application name and version was not filtered properly", content.contains( "my-app 99.0" ) );
-        assertTrue( "Escaping did not work properly", content.contains( "will not be filtered ${application.name}." ) );
-    }
-
-    /**
-     * Builds an EAR and filter the content of the sources directory using a custom filter file.
-     */
-    public void testProject046()
-        throws Exception
-    {
-        final File baseDir = doTestProject( "project-046", new String[] { "README.txt", "ejb-sample-one-1.0.jar" } );
-        final File actualReadme = new File( getEarDirectory( baseDir, "project-046" ), "README.txt" );
-        final String content = IOUtil.toString( ReaderFactory.newReader( actualReadme, "UTF-8" ) );
-        assertTrue( "application name and version was not filtered properly", content.contains( "my-app 99.0" ) );
-        assertTrue( "application build was not filtered properly", content.contains( "(Build 2)" ) );
-        assertTrue( "Unknown property should not have been filtered",
-                    content.contains( "will not be filtered ${application.unknown}." ) );
-    }
-
-    /**
-     * Builds an EAR and filter the content with a list of extensions.
-     */
-    public void testProject047()
-        throws Exception
-    {
-        final File baseDir = doTestProject( "project-047", new String[] { "README.txt", "ejb-sample-one-1.0.jar" } );
-        final File actualReadme = new File( getEarDirectory( baseDir, "project-047" ), "README.txt" );
-        final String content = IOUtil.toString( ReaderFactory.newReader( actualReadme, "UTF-8" ) );
-        assertTrue( "application name and version should not have been filtered", !content.contains( "my-app 99.0" ) );
-        assertTrue( "original properties not found", content.contains( "${application.name} ${project.version}" ) );
-    }
-
-    /**
-     * Builds an EAR with a Jboss 5 configuration containing library directory.
-     */
-    public void testProject048()
-        throws Exception
-    {
-        doTestProject( "project-048", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a Jboss 4.2 configuration containing a library directory.
-     */
-    public void testProject049()
-        throws Exception
-    {
-        doTestProject( "project-049", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a Jboss 5 configuration containing a loader repository configuration definition.
-     */
-    public void testProject050()
-        throws Exception
-    {
-        doTestProject( "project-050", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a Jboss 5 configuration containing a loader repository class definition.
-     */
-    public void testProject051()
-        throws Exception
-    {
-        doTestProject( "project-051", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a Jboss 5 configuration containing a configuration parser class definition.
-     */
-    public void testProject052()
-        throws Exception
-    {
-        doTestProject( "project-052", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a Jboss 5 configuration containing only the loader repo configuration
-     */
-    public void testProject053()
-        throws Exception
-    {
-        doTestProject( "project-053", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with deployment descriptor configuration for Java EE 5 and no application.xml
-     */
-    public void testProject054()
-        throws Exception
-    {
-        doTestProject( "project-054", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with jar dependencies added in application.xml.
-     */
-    public void testProject055()
-        throws Exception
-    {
-        doTestProject( "project-055", new String[] { "jar-sample-one-1.0.jar", "jar-sample-two-1.0.jar",
-            "jar-sample-three-with-deps-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with deployment descriptor configuration for J2EE 1.4 and an alternative deployment descriptor.
-     */
-    public void testProject056()
-        throws Exception
-    {
-        doTestProject( "project-056", new String[] { "ejb-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a complete JBoss 4.2 configuration and validate it matches the DTD (MEAR-104).
-     */
-    public void testProject057()
-        throws Exception
-    {
-        doTestProject( "project-057", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with deployment descriptor configuration for Java EE 6.
-     */
-    public void testProject058()
-        throws Exception
-    {
-        doTestProject( "project-058", new String[] { "ejb-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with no display name entry at all.
-     */
-    public void testProject059()
-        throws Exception
-    {
-        doTestProject( "project-059", new String[] { "ejb-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with ejb-client packaged for J2EE 1.3 (MEAR-85)
-     * 
-     * @throws Exception
-     */
-    public void testProject060()
-        throws Exception
-    {
-        doTestProject( "project-060", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0-client.jar" } );
-    }
-
-    /**
-     * Builds an EAR with ejb-client packaged for J2EE 1.4 (MEAR-85)
-     * 
-     * @throws Exception
-     */
-    public void testProject061()
-        throws Exception
-    {
-        doTestProject( "project-061", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0-client.jar" } );
-    }
-
-    /**
-     * Builds an EAR with ejb-client packaged for JavaEE 5 (MEAR-85)
-     * 
-     * @throws Exception
-     */
-    public void testProject062()
-        throws Exception
-    {
-        doTestProject( "project-062", new String[] { "ejb-sample-one-1.0.jar", "lib/ejb-sample-two-1.0-client.jar" } );
-    }
-
-    /**
-     * Builds an EAR with ejb-client packaged for JavaEE 6 (MEAR-85)
-     * 
-     * @throws Exception
-     */
-    public void testProject063()
-        throws Exception
-    {
-        doTestProject( "project-063", new String[] { "lib/ejb-sample-two-1.0-client.jar" } );
-    }
-
-    /**
-     * Builds an EAR with ejb-client packaged for JavaEE 5 and still put it in the root (MEAR-85)
-     * 
-     * @throws Exception
-     */
-    public void testProject064()
-        throws Exception
-    {
-        doTestProject( "project-064", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0-client.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a custom moduleId.
-     */
-    public void testProject065()
-        throws Exception
-    {
-        doTestProject( "project-065", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with generateModuleId enabled.
-     */
-    public void testProject066()
-        throws Exception
-    {
-        doTestProject( "project-066", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with generateModuleId enabled and a custom module.
-     */
-    public void testProject067()
-        throws Exception
-    {
-        doTestProject( "project-067", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with the no-version file name mapping.
-     */
-    public void testProject068()
-        throws Exception
-    {
-        doTestProject( "project-068", new String[] { "ejb-sample-one.jar", "ejb-sample-two.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a custom library-directory and JavaEE 6.
-     */
-    public void testProject069()
-        throws Exception
-    {
-        doTestProject( "project-069", new String[] { "ejb-sample-one-1.0.jar", "myLibs/jar-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with application-name and initialize-in-order tags.
-     */
-    public void testProject070()
-        throws Exception
-    {
-        doTestProject( "project-070", new String[] { "ejb-sample-one-1.0.jar", "jar-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with application-name and initialize-in-order tags for unsupported version.
-     */
-    public void testProject071()
-        throws Exception
-    {
-        doTestProject( "project-071", new String[] { "ejb-sample-one-1.0.jar", "jar-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with an application client module (app-client).
-     */
-    public void testProject072()
-        throws Exception
-    {
-        doTestProject( "project-072", new String[] { "ejb-sample-one-1.0.jar", "app-client-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with an application client module (app-client) and a default bundle directory for _java_ modules.
-     */
-    public void testProject073()
-        throws Exception
-    {
-        doTestProject( "project-073", new String[] { "ejb-sample-one-1.0.jar", "app-client-sample-one-1.0.jar",
-            "APP-INF/lib/jar-sample-one-1.0.jar", "APP-INF/lib/jar-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with custom env entries settings and J2EE 1.3. Not supported by the specification so this should be
-     * ignored.
-     */
-    public void testProject074()
-        throws Exception
-    {
-        doTestProject( "project-074", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with custom env entries settings and J2EE 1.4. Not supported by the specification so this should be
-     * ignored.
-     */
-    public void testProject075()
-        throws Exception
-    {
-        doTestProject( "project-075", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with custom env entries settings and JavaEE 5. Not supported by the specification so this should be
-     * ignored.
-     */
-    public void testProject076()
-        throws Exception
-    {
-        doTestProject( "project-076", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with custom env entries settings and JavaEE 6.
-     */
-    public void testProject077()
-        throws Exception
-    {
-        doTestProject( "project-077", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with the no version for ejb file name mapping.
-     */
-    public void testProject078()
-        throws Exception
-    {
-        doTestProject( "project-078", new String[] { "ejb-sample-one.jar", "war-sample-one-1.0.war",
-            "jar-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with the 'default' library directory mode. Uses the value of the defaultLibBundleDir.
-     */
-    public void testProject079()
-        throws Exception
-    {
-        doTestProject( "project-079", new String[] { "ejb-sample-one-1.0.jar", "myLibs/jar-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with the 'empty' library directory mode. Generate an empty library-directory element.
-     */
-    public void testProject080()
-        throws Exception
-    {
-        doTestProject( "project-080", new String[] { "ejb-sample-one-1.0.jar", "myLibs/jar-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with the 'none' library directory mode. Does not generate an library-directory element.
-     */
-    public void testProject081()
-        throws Exception
-    {
-        doTestProject( "project-081", new String[] { "ejb-sample-one-1.0.jar", "myLibs/jar-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with deployment descriptor configuration for JavaEE 7.
-     */
-    public void testProject082()
-        throws Exception
-    {
-        doTestProject( "project-082", new String[] { "ejb-sample-one-1.0.jar" } );
-    }
-
-    /**
-     * Builds an EAR with a library directory and custom env entries. The library-directory element must come first
-     * (MEAR-158).
-     */
-    public void testProject083()
-        throws Exception
-    {
-        doTestProject( "project-083", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-    /**
-     * Support of an application id (MEAR-174).
-     */
-    public void testProject084()
-        throws Exception
-    {
-        doTestProject( "project-084", new String[] { "ejb-sample-one-1.0.jar" } );
-    }
-    
-    /**
-     * Builds an EAR with custom ejbRef entries settings and JavaEE 6.
-     */
-    public void testProject085()
-        throws Exception
-    {
-        doTestProject( "project-085", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );
-    }
-
-
-}
+package org.apache.maven.plugins.ear.it;

+

+/*

+ * 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 java.io.File;

+import java.io.FileInputStream;

+import java.util.Properties;

+import java.util.jar.JarFile;

+import java.util.jar.Manifest;

+

+import org.apache.maven.it.util.IOUtil;

+import org.codehaus.plexus.util.FileUtils;

+import org.codehaus.plexus.util.ReaderFactory;

+

+/**

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: EarMojoIT.java 1648055 2014-12-27 14:59:45Z khmarbaise $

+ * @noinspection JavaDoc

+ */

+public class EarMojoIT

+    extends AbstractEarPluginIT

+{

+

+    /**

+     * Builds an EAR with a single EJB and no configuration.

+     */

+    public void testProject001()

+        throws Exception

+    {

+        doTestProject( "project-001", new String[] { "ejb-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a customized artifact location and a customized artifact name.

+     */

+    public void testProject002()

+        throws Exception

+    {

+        doTestProject( "project-002", new String[] { "APP-INF/lib/ejb-sample-one-1.0.jar", "ejb-sample-two.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a default bundle directory for <tt>java</tt> modules.

+     */

+    public void testProject003()

+        throws Exception

+    {

+        doTestProject( "project-003", new String[] { "ejb-sample-one-1.0.jar", "APP-INF/lib/jar-sample-one-1.0.jar",

+            "APP-INF/lib/jar-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a default bundle directory for _java_ modules and a custom location overriding the default.

+     */

+    public void testProject004()

+        throws Exception

+    {

+        doTestProject( "project-004", new String[] { "ejb-sample-one-1.0.jar", "jar-sample-one-1.0.jar",

+            "APP-INF/lib/jar-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a custom URI.

+     */

+    public void testProject005()

+        throws Exception

+    {

+        doTestProject( "project-005", new String[] { "ejb-sample-one-1.0.jar", "libs/another-name.jar" } );

+    }

+

+    /**

+     * Builds an EAR with an excluded module.

+     */

+    public void testProject006()

+        throws Exception

+    {

+        doTestProject( "project-006", new String[] { "ejb-sample-one-1.0.jar", "jar-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a classified artifact and no extra configuration.

+     */

+    public void testProject007()

+        throws Exception

+    {

+        doTestProject( "project-007", new String[] { "ejb-sample-one-1.0-classified.jar" } );

+    }

+

+    /**

+     * Builds an EAR with deployment descriptor configuration for J2EE 1.3.

+     */

+    public void testProject008()

+        throws Exception

+    {

+        doTestProject( "project-008", new String[] { "ejb-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with deployment descriptor configuration for J2EE 1.4.

+     */

+    public void testProject009()

+        throws Exception

+    {

+        doTestProject( "project-009", new String[] { "ejb-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with deployment descriptor configuration for Java EE 5.

+     */

+    public void testProject010()

+        throws Exception

+    {

+        doTestProject( "project-010", new String[] { "ejb-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR and make sure that deployment descriptor default settings are applied.

+     */

+    public void testProject011()

+        throws Exception

+    {

+        doTestProject( "project-011", new String[] { "ejb-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR and make sure that EAR resources are bundled within the EAR.

+     */

+    public void testProject012()

+        throws Exception

+    {

+        doTestProject( "project-012", new String[] { "README.txt", "LICENSE.txt", "ejb-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR and make sure that EAR resources in a customized resources directory are bundled within the EAR.

+     */

+    public void testProject013()

+        throws Exception

+    {

+        doTestProject( "project-013", new String[] { "README.txt", "LICENSE.txt", "ejb-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR and make sure that EAR resources are bundled within the EAR using includes and excludes.

+     */

+    public void testProject014()

+        throws Exception

+    {

+        doTestProject( "project-014", new String[] { "LICENSE.txt", "ejb-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR and make sure that default manifest is taken into account.

+     */

+    public void testProject015()

+        throws Exception

+    {

+        final File baseDir = doTestProject( "project-015", new String[] { "ejb-sample-one-1.0.jar" } );

+        final File expectedManifest = new File( baseDir, "src/main/application/META-INF/MANIFEST.MF" );

+        final File actualManifest = new File( getEarDirectory( baseDir, "project-015" ), "META-INF/MANIFEST.MF" );

+        assertTrue( "Manifest was not copied", actualManifest.exists() );

+        assertTrue( FileUtils.contentEquals( expectedManifest, actualManifest ) );

+    }

+

+    /**

+     * Builds an EAR and make sure that custom manifest is taken into account.

+     */

+    public void testProject016()

+        throws Exception

+    {

+        final File baseDir = doTestProject( "project-016", new String[] { "ejb-sample-one-1.0.jar" } );

+

+        final File targetFolder = new File( baseDir, "target" );

+        final File createdEarFile = new File( targetFolder, "maven-ear-plugin-test-project-016-99.0.ear" );

+

+        final File sourceManifestFile = new File( baseDir, "src/main/ear/MANIFEST.MF" );

+

+        JarFile jarFile = new JarFile( createdEarFile );

+        Manifest manifestFromCreatedEARFile = jarFile.getManifest();

+        jarFile.close();

+

+        Manifest sourceManifest = new Manifest( new FileInputStream( sourceManifestFile ) );

+

+        assertTrue( "There are differences in the manifest.", sourceManifest.equals( manifestFromCreatedEARFile ) );

+    }

+

+    /**

+     * Builds an EAR and make sure that custom application.xml is taken into account.

+     */

+    public void testProject017()

+        throws Exception

+    {

+        doTestProject( "project-017", new String[] { "ejb-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a custom final name.

+     */

+    public void testProject018()

+        throws Exception

+    {

+        final File baseDir = executeMojo( "project-018", new Properties() );

+        final File expectedFile = new File( baseDir, "target/my-custom-file.ear" );

+        assertTrue( "EAR archive not found", expectedFile.exists() );

+    }

+

+    /**

+     * Builds an EAR with unpacked archives using the unpackTypes.

+     */

+    public void testProject019()

+        throws Exception

+    {

+        doTestProject( "project-019", new String[] { "ejb-sample-one-1.0.jar", "sar-sample-one-1.0.sar",

+            "jar-sample-one-1.0.jar" }, new boolean[] { false, true, true } );

+    }

+

+    /**

+     * Builds an EAR with unpacked archives using the unpack module attribute.

+     */

+    public void testProject020()

+        throws Exception

+    {

+        doTestProject( "project-020", new String[] { "ejb-sample-one-1.0.jar", "sar-sample-one-1.0.sar",

+            "jar-sample-one-1.0.jar" }, new boolean[] { true, false, false } );

+    }

+

+    /**

+     * Builds an EAR with unpacked archives using both unpackTypes and the unpack module attribute.

+     */

+    public void testProject021()

+        throws Exception

+    {

+        doTestProject( "project-021", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar",

+            "sar-sample-one-1.0.sar", "jar-sample-one-1.0.jar", "jar-sample-two-1.0.jar" }, new boolean[] { false,

+            true, false, false, true } );

+    }

+

+    /**

+     * Builds an EAR with a classifier.

+     */

+    public void testProject022()

+        throws Exception

+    {

+        final File baseDir = executeMojo( "project-022", new Properties() );

+        final File expectedFile = new File( baseDir, "target/maven-ear-plugin-test-project-022-99.0-myclassifier.ear" );

+        assertTrue( "EAR archive not found", expectedFile.exists() );

+    }

+

+    /**

+     * Builds an EAR and make sure that a single classified dependency is detected without specifying the classifier.

+     */

+    public void testProject023()

+        throws Exception

+    {

+        doTestProject( "project-023", new String[] { "ejb-sample-one-1.0-classified.jar", "ejb-sample-two-1.0.jar" },

+                       new boolean[] { true, false } );

+    }

+

+    /**

+     * Builds an EAR and make sure that a single classified dependency is detected when specifying the classifier.

+     */

+    public void testProject024()

+        throws Exception

+    {

+        doTestProject( "project-024", new String[] { "ejb-sample-one-1.0-classified.jar", "ejb-sample-two-1.0.jar" },

+                       new boolean[] { true, false } );

+    }

+

+    /**

+     * Builds an EAR and make sure that a classified dependency with mutiple candidates is detected when specifying the

+     * classifier.

+     */

+    public void testProject025()

+        throws Exception

+    {

+        doTestProject( "project-025", new String[] { "ejb-sample-one-1.0-classified.jar", "ejb-sample-one-1.0.jar" },

+                       new boolean[] { true, false } );

+    }

+

+    /**

+     * Builds an EAR and make sure that the build fails if a unclassifed module configuration with mutiple candidates is

+     * specified.

+     */

+    public void testProject026()

+        throws Exception

+    {

+        final File baseDir = executeMojo( "project-026", new Properties(), false );

+        // Stupido, checks that the ear archive is not there

+        assertFalse( "Execution should have failed", getEarArchive( baseDir, "project-026" ).exists() );

+    }

+

+    /**

+     * Builds an EAR and make sure that provided dependencies are not included in the EAR.

+     */

+    public void testProject027()

+        throws Exception

+    {

+        doTestProject( "project-027", new String[] { "ejb-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR and make sure that test dependencies are not included in the EAR.

+     */

+    public void testProject028()

+        throws Exception

+    {

+        doTestProject( "project-028", new String[] { "ejb-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR and make sure that system dependencies are not included in the EAR.

+     */

+    public void testProject029()

+        throws Exception

+    {

+        doTestProject( "project-029", new String[] { "ejb-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR and make sure that ejb-client dependencies are detected and not added by default in the generated

+     * application.xml.

+     */

+    public void testProject030()

+        throws Exception

+    {

+        doTestProject( "project-030", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0-client.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a Jboss 4 configuration specifying the security domain and the unauthenticated-principal to

+     * use.

+     */

+    public void testProject031()

+        throws Exception

+    {

+        doTestProject( "project-031", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a Jboss 3.2 configuration specifying the jmx-name to use.

+     */

+    public void testProject032()

+        throws Exception

+    {

+        doTestProject( "project-032", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a Jboss 4 configuration and Jboss specific modules.

+     */

+    public void testProject033()

+        throws Exception

+    {

+        doTestProject( "project-033", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar",

+            "sar-sample-one-1.0.sar", "har-sample-one-1.0.har" } );

+    }

+

+    /**

+     * Builds an EAR with custom security settings.

+     */

+    public void testProject034()

+        throws Exception

+    {

+        doTestProject( "project-034", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a full filename mapping and make sure that custom locations are not overridden.

+     */

+    public void testProject035()

+        throws Exception

+    {

+        doTestProject( "project-035", new String[] { "foo/eartest-ejb-sample-one-1.0.jar",

+            "eartest-ejb-sample-two-1.0.jar", "libs/eartest-jar-sample-one-1.0.jar",

+            "libs/eartest-jar-sample-two-1.0.jar", "sar-sample-one.sar" } );

+    }

+

+    /**

+     * Builds an EAR with a full filename mapping and make sure that groupIds with dots are replaced by dashes in

+     * filenames.

+     */

+    public void testProject036()

+        throws Exception

+    {

+        doTestProject( "project-036", new String[] { "foo/eartest-ejb-sample-one-1.0.jar",

+            "eartest-ejb-sample-two-1.0.jar", "com-foo-bar-ejb-sample-one-1.0.jar",

+            "com-foo-bar-ejb-sample-two-1.0.jar", "libs/eartest-jar-sample-one-1.0.jar",

+            "libs/eartest-jar-sample-two-1.0.jar", "sar-sample-one.sar" } );

+    }

+

+    /**

+     * Builds an EAR and make sure that ejb-client dependencies are detected and added in the generated application.xml

+     * if includeInApplicationXml is set.

+     */

+    public void testProject037()

+        throws Exception

+    {

+        doTestProject( "project-037", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0-client.jar" } );

+    }

+

+    /**

+     * Builds an EAR and make sure that a non-classified dependency with mutiple candidates is detected when specifying

+     * the mainArtifactId as classifier.

+     */

+    public void testProject038()

+        throws Exception

+    {

+        doTestProject( "project-038", new String[] { "ejb-sample-one-1.0-classified.jar", "ejb-sample-one-1.0.jar" },

+                       new boolean[] { false, true } );

+    }

+

+    /**

+     * Builds an EAR with a Jboss 4 configuration specifying specifying the loader repository to use.

+     */

+    public void testProject039()

+        throws Exception

+    {

+        doTestProject( "project-039", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with deployment descriptor configuration for Java EE 5 and an alternative deployment descriptor.

+     */

+    public void testProject040()

+        throws Exception

+    {

+        doTestProject( "project-040", new String[] { "ejb-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a Jboss 4.2 configuration specifying the module order to use.

+     */

+    public void testProject041()

+        throws Exception

+    {

+        doTestProject( "project-041", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a Jboss 4.2 configuration specifying a datasource to add.

+     */

+    public void testProject042()

+        throws Exception

+    {

+        doTestProject( "project-042", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a custom descriptor location (generatedDescriptorLocation setting).

+     */

+    public void testProject043()

+        throws Exception

+    {

+        final File baseDir = doTestProject( "project-043", new String[] { "ejb-sample-one-1.0.jar" } );

+        final File expectedApplicationXml = new File( baseDir, "target/custom-descriptor-dir/application.xml" );

+        assertTrue( "Application.xml file not found", expectedApplicationXml.exists() );

+        assertFalse( "Application.xml file should not be empty", expectedApplicationXml.length() == 0 );

+    }

+

+    /**

+     * Builds an EAR with a custom library-directory.

+     */

+    public void testProject044()

+        throws Exception

+    {

+        doTestProject( "project-044", new String[] { "ejb-sample-one-1.0.jar", "myLibs/jar-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR and filter the content of the sources directory.

+     */

+    public void testProject045()

+        throws Exception

+    {

+        final File baseDir = doTestProject( "project-045", new String[] { "README.txt", "ejb-sample-one-1.0.jar" } );

+        final File actualReadme = new File( getEarDirectory( baseDir, "project-045" ), "README.txt" );

+        final String content = IOUtil.toString( ReaderFactory.newReader( actualReadme, "UTF-8" ) );

+        assertTrue( "application name and version was not filtered properly", content.contains( "my-app 99.0" ) );

+        assertTrue( "Escaping did not work properly", content.contains( "will not be filtered ${application.name}." ) );

+    }

+

+    /**

+     * Builds an EAR and filter the content of the sources directory using a custom filter file.

+     */

+    public void testProject046()

+        throws Exception

+    {

+        final File baseDir = doTestProject( "project-046", new String[] { "README.txt", "ejb-sample-one-1.0.jar" } );

+        final File actualReadme = new File( getEarDirectory( baseDir, "project-046" ), "README.txt" );

+        final String content = IOUtil.toString( ReaderFactory.newReader( actualReadme, "UTF-8" ) );

+        assertTrue( "application name and version was not filtered properly", content.contains( "my-app 99.0" ) );

+        assertTrue( "application build was not filtered properly", content.contains( "(Build 2)" ) );

+        assertTrue( "Unknown property should not have been filtered",

+                    content.contains( "will not be filtered ${application.unknown}." ) );

+    }

+

+    /**

+     * Builds an EAR and filter the content with a list of extensions.

+     */

+    public void testProject047()

+        throws Exception

+    {

+        final File baseDir = doTestProject( "project-047", new String[] { "README.txt", "ejb-sample-one-1.0.jar" } );

+        final File actualReadme = new File( getEarDirectory( baseDir, "project-047" ), "README.txt" );

+        final String content = IOUtil.toString( ReaderFactory.newReader( actualReadme, "UTF-8" ) );

+        assertTrue( "application name and version should not have been filtered", !content.contains( "my-app 99.0" ) );

+        assertTrue( "original properties not found", content.contains( "${application.name} ${project.version}" ) );

+    }

+

+    /**

+     * Builds an EAR with a Jboss 5 configuration containing library directory.

+     */

+    public void testProject048()

+        throws Exception

+    {

+        doTestProject( "project-048", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a Jboss 4.2 configuration containing a library directory.

+     */

+    public void testProject049()

+        throws Exception

+    {

+        doTestProject( "project-049", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a Jboss 5 configuration containing a loader repository configuration definition.

+     */

+    public void testProject050()

+        throws Exception

+    {

+        doTestProject( "project-050", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a Jboss 5 configuration containing a loader repository class definition.

+     */

+    public void testProject051()

+        throws Exception

+    {

+        doTestProject( "project-051", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a Jboss 5 configuration containing a configuration parser class definition.

+     */

+    public void testProject052()

+        throws Exception

+    {

+        doTestProject( "project-052", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a Jboss 5 configuration containing only the loader repo configuration

+     */

+    public void testProject053()

+        throws Exception

+    {

+        doTestProject( "project-053", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with deployment descriptor configuration for Java EE 5 and no application.xml

+     */

+    public void testProject054()

+        throws Exception

+    {

+        doTestProject( "project-054", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with jar dependencies added in application.xml.

+     */

+    public void testProject055()

+        throws Exception

+    {

+        doTestProject( "project-055", new String[] { "jar-sample-one-1.0.jar", "jar-sample-two-1.0.jar",

+            "jar-sample-three-with-deps-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with deployment descriptor configuration for J2EE 1.4 and an alternative deployment descriptor.

+     */

+    public void testProject056()

+        throws Exception

+    {

+        doTestProject( "project-056", new String[] { "ejb-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a complete JBoss 4.2 configuration and validate it matches the DTD (MEAR-104).

+     */

+    public void testProject057()

+        throws Exception

+    {

+        doTestProject( "project-057", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with deployment descriptor configuration for Java EE 6.

+     */

+    public void testProject058()

+        throws Exception

+    {

+        doTestProject( "project-058", new String[] { "ejb-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with no display name entry at all.

+     */

+    public void testProject059()

+        throws Exception

+    {

+        doTestProject( "project-059", new String[] { "ejb-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with ejb-client packaged for J2EE 1.3 (MEAR-85)

+     * 

+     * @throws Exception

+     */

+    public void testProject060()

+        throws Exception

+    {

+        doTestProject( "project-060", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0-client.jar" } );

+    }

+

+    /**

+     * Builds an EAR with ejb-client packaged for J2EE 1.4 (MEAR-85)

+     * 

+     * @throws Exception

+     */

+    public void testProject061()

+        throws Exception

+    {

+        doTestProject( "project-061", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0-client.jar" } );

+    }

+

+    /**

+     * Builds an EAR with ejb-client packaged for JavaEE 5 (MEAR-85)

+     * 

+     * @throws Exception

+     */

+    public void testProject062()

+        throws Exception

+    {

+        doTestProject( "project-062", new String[] { "ejb-sample-one-1.0.jar", "lib/ejb-sample-two-1.0-client.jar" } );

+    }

+

+    /**

+     * Builds an EAR with ejb-client packaged for JavaEE 6 (MEAR-85)

+     * 

+     * @throws Exception

+     */

+    public void testProject063()

+        throws Exception

+    {

+        doTestProject( "project-063", new String[] { "lib/ejb-sample-two-1.0-client.jar" } );

+    }

+

+    /**

+     * Builds an EAR with ejb-client packaged for JavaEE 5 and still put it in the root (MEAR-85)

+     * 

+     * @throws Exception

+     */

+    public void testProject064()

+        throws Exception

+    {

+        doTestProject( "project-064", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0-client.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a custom moduleId.

+     */

+    public void testProject065()

+        throws Exception

+    {

+        doTestProject( "project-065", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with generateModuleId enabled.

+     */

+    public void testProject066()

+        throws Exception

+    {

+        doTestProject( "project-066", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with generateModuleId enabled and a custom module.

+     */

+    public void testProject067()

+        throws Exception

+    {

+        doTestProject( "project-067", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with the no-version file name mapping.

+     */

+    public void testProject068()

+        throws Exception

+    {

+        doTestProject( "project-068", new String[] { "ejb-sample-one.jar", "ejb-sample-two.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a custom library-directory and JavaEE 6.

+     */

+    public void testProject069()

+        throws Exception

+    {

+        doTestProject( "project-069", new String[] { "ejb-sample-one-1.0.jar", "myLibs/jar-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with application-name and initialize-in-order tags.

+     */

+    public void testProject070()

+        throws Exception

+    {

+        doTestProject( "project-070", new String[] { "ejb-sample-one-1.0.jar", "jar-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with application-name and initialize-in-order tags for unsupported version.

+     */

+    public void testProject071()

+        throws Exception

+    {

+        doTestProject( "project-071", new String[] { "ejb-sample-one-1.0.jar", "jar-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with an application client module (app-client).

+     */

+    public void testProject072()

+        throws Exception

+    {

+        doTestProject( "project-072", new String[] { "ejb-sample-one-1.0.jar", "app-client-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with an application client module (app-client) and a default bundle directory for _java_ modules.

+     */

+    public void testProject073()

+        throws Exception

+    {

+        doTestProject( "project-073", new String[] { "ejb-sample-one-1.0.jar", "app-client-sample-one-1.0.jar",

+            "APP-INF/lib/jar-sample-one-1.0.jar", "APP-INF/lib/jar-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with custom env entries settings and J2EE 1.3. Not supported by the specification so this should be

+     * ignored.

+     */

+    public void testProject074()

+        throws Exception

+    {

+        doTestProject( "project-074", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with custom env entries settings and J2EE 1.4. Not supported by the specification so this should be

+     * ignored.

+     */

+    public void testProject075()

+        throws Exception

+    {

+        doTestProject( "project-075", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with custom env entries settings and JavaEE 5. Not supported by the specification so this should be

+     * ignored.

+     */

+    public void testProject076()

+        throws Exception

+    {

+        doTestProject( "project-076", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with custom env entries settings and JavaEE 6.

+     */

+    public void testProject077()

+        throws Exception

+    {

+        doTestProject( "project-077", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with the no version for ejb file name mapping.

+     */

+    public void testProject078()

+        throws Exception

+    {

+        doTestProject( "project-078", new String[] { "ejb-sample-one.jar", "war-sample-one-1.0.war",

+            "jar-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with the 'default' library directory mode. Uses the value of the defaultLibBundleDir.

+     */

+    public void testProject079()

+        throws Exception

+    {

+        doTestProject( "project-079", new String[] { "ejb-sample-one-1.0.jar", "myLibs/jar-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with the 'empty' library directory mode. Generate an empty library-directory element.

+     */

+    public void testProject080()

+        throws Exception

+    {

+        doTestProject( "project-080", new String[] { "ejb-sample-one-1.0.jar", "myLibs/jar-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with the 'none' library directory mode. Does not generate an library-directory element.

+     */

+    public void testProject081()

+        throws Exception

+    {

+        doTestProject( "project-081", new String[] { "ejb-sample-one-1.0.jar", "myLibs/jar-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with deployment descriptor configuration for JavaEE 7.

+     */

+    public void testProject082()

+        throws Exception

+    {

+        doTestProject( "project-082", new String[] { "ejb-sample-one-1.0.jar" } );

+    }

+

+    /**

+     * Builds an EAR with a library directory and custom env entries. The library-directory element must come first

+     * (MEAR-158).

+     */

+    public void testProject083()

+        throws Exception

+    {

+        doTestProject( "project-083", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+    /**

+     * Support of an application id (MEAR-174).

+     */

+    public void testProject084()

+        throws Exception

+    {

+        doTestProject( "project-084", new String[] { "ejb-sample-one-1.0.jar" } );

+    }

+    

+    /**

+     * Builds an EAR with custom ejbRef entries settings and JavaEE 6.

+     */

+    public void testProject085()

+        throws Exception

+    {

+        doTestProject( "project-085", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

+

+

+}

diff --git a/src/test/java/org/apache/maven/plugin/ear/output/AbstractFileNameMappingTestBase.java b/src/test/java/org/apache/maven/plugins/ear/output/AbstractFileNameMappingTestBase.java
similarity index 91%
rename from src/test/java/org/apache/maven/plugin/ear/output/AbstractFileNameMappingTestBase.java
rename to src/test/java/org/apache/maven/plugins/ear/output/AbstractFileNameMappingTestBase.java
index fee7a6f..f245905 100644
--- a/src/test/java/org/apache/maven/plugin/ear/output/AbstractFileNameMappingTestBase.java
+++ b/src/test/java/org/apache/maven/plugins/ear/output/AbstractFileNameMappingTestBase.java
@@ -1,53 +1,53 @@
-package org.apache.maven.plugin.ear.output;
-
-/*
- * 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.ear.AbstractEarTestBase;
-import org.apache.maven.plugin.ear.stub.ArtifactTestStub;
-
-/**
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- */
-public abstract class AbstractFileNameMappingTestBase
-    extends AbstractEarTestBase
-{
-
-    protected Artifact createArtifactWithGroupId( String groupId, String artifactId, String version, String type,
-                                                  String classifier )
-    {
-        return new ArtifactTestStub( groupId, artifactId, type, classifier, version );
-    }
-
-    protected Artifact createArtifactWithGroupId( String groupId, String artifactId, String version, String type )
-    {
-        return createArtifactWithGroupId( groupId, artifactId, version, type, null );
-    }
-
-    protected Artifact createArtifact( String artifactId, String version, String type, String classifier )
-    {
-        return new ArtifactTestStub( DEFAULT_GROUPID, artifactId, type, classifier, version );
-    }
-
-    protected Artifact createArtifact( String artifactId, String version, String type )
-    {
-        return createArtifact( artifactId, version, type, null );
-    }
-}
+package org.apache.maven.plugins.ear.output;

+

+/*

+ * 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.plugins.ear.AbstractEarTestBase;

+import org.apache.maven.plugins.ear.stub.ArtifactTestStub;

+

+/**

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ */

+public abstract class AbstractFileNameMappingTestBase

+    extends AbstractEarTestBase

+{

+

+    protected Artifact createArtifactWithGroupId( String groupId, String artifactId, String version, String type,

+                                                  String classifier )

+    {

+        return new ArtifactTestStub( groupId, artifactId, type, classifier, version );

+    }

+

+    protected Artifact createArtifactWithGroupId( String groupId, String artifactId, String version, String type )

+    {

+        return createArtifactWithGroupId( groupId, artifactId, version, type, null );

+    }

+

+    protected Artifact createArtifact( String artifactId, String version, String type, String classifier )

+    {

+        return new ArtifactTestStub( DEFAULT_GROUPID, artifactId, type, classifier, version );

+    }

+

+    protected Artifact createArtifact( String artifactId, String version, String type )

+    {

+        return createArtifact( artifactId, version, type, null );

+    }

+}

diff --git a/src/test/java/org/apache/maven/plugin/ear/output/FileNameMappingFactoryTest.java b/src/test/java/org/apache/maven/plugins/ear/output/FileNameMappingFactoryTest.java
similarity index 86%
rename from src/test/java/org/apache/maven/plugin/ear/output/FileNameMappingFactoryTest.java
rename to src/test/java/org/apache/maven/plugins/ear/output/FileNameMappingFactoryTest.java
index 560e36e..6dacf3f 100644
--- a/src/test/java/org/apache/maven/plugin/ear/output/FileNameMappingFactoryTest.java
+++ b/src/test/java/org/apache/maven/plugins/ear/output/FileNameMappingFactoryTest.java
@@ -1,98 +1,105 @@
-package org.apache.maven.plugin.ear.output;
-
-/*
- * 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 junit.framework.TestCase;
-
-/**
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public class FileNameMappingFactoryTest
-    extends TestCase
-{
-
-    public void testDefaultFileNameMapping()
-    {
-        final FileNameMapping actual = FileNameMappingFactory.getDefaultFileNameMapping();
-        assertNotNull( actual );
-        assertEquals( StandardFileNameMapping.class, actual.getClass() );
-    }
-
-    public void testGetFileNameMappingByName()
-    {
-        final FileNameMapping actual =
-            FileNameMappingFactory.getFileNameMapping( FileNameMappingFactory.STANDARD_FILE_NAME_MAPPING );
-        assertNotNull( actual );
-        assertEquals( StandardFileNameMapping.class, actual.getClass() );
-    }
-
-    public void testGetFileNameMappingByName2()
-    {
-        final FileNameMapping actual =
-            FileNameMappingFactory.getFileNameMapping( FileNameMappingFactory.FULL_FILE_NAME_MAPPING );
-        assertNotNull( actual );
-        assertEquals( FullFileNameMapping.class, actual.getClass() );
-    }
-
-    public void testGetFileNameMappingByName3()
-    {
-        final FileNameMapping actual =
-            FileNameMappingFactory.getFileNameMapping( FileNameMappingFactory.NO_VERSION_FILE_NAME_MAPPING );
-        assertNotNull( actual );
-        assertEquals( NoVersionFileNameMapping.class, actual.getClass() );
-    }
-
-    public void testGetFileNameMappingByName4()
-    {
-        final FileNameMapping actual =
-            FileNameMappingFactory.getFileNameMapping( FileNameMappingFactory.NO_VERSION_FOR_EJB_FILE_NAME_MAPPING );
-        assertNotNull( actual );
-        assertEquals( NoVersionForEjbFileNameMapping.class, actual.getClass() );
-    }
-
-    public void testGetFileNameMappingByClass()
-    {
-        final FileNameMapping actual =
-            FileNameMappingFactory.getFileNameMapping( StandardFileNameMapping.class.getName() );
-        assertNotNull( actual );
-        assertEquals( StandardFileNameMapping.class, actual.getClass() );
-    }
-
-    public void testGetFileNameMappingByClass2()
-    {
-        final FileNameMapping actual = FileNameMappingFactory.getFileNameMapping( FullFileNameMapping.class.getName() );
-        assertNotNull( actual );
-        assertEquals( FullFileNameMapping.class, actual.getClass() );
-    }
-
-    public void testGetFileNameMappingByUnknownClass()
-    {
-        try
-        {
-            FileNameMappingFactory.getFileNameMapping( "com.foo.bar" );
-            fail( "Should have failed" );
-        }
-        catch ( IllegalStateException e )
-        {
-            // OK
-        }
-    }
-}
+package org.apache.maven.plugins.ear.output;

+

+import org.apache.maven.plugins.ear.output.FileNameMapping;

+import org.apache.maven.plugins.ear.output.FileNameMappingFactory;

+import org.apache.maven.plugins.ear.output.FullFileNameMapping;

+import org.apache.maven.plugins.ear.output.NoVersionFileNameMapping;

+import org.apache.maven.plugins.ear.output.NoVersionForEjbFileNameMapping;

+import org.apache.maven.plugins.ear.output.StandardFileNameMapping;

+

+/*

+ * 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 junit.framework.TestCase;

+

+/**

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: FileNameMappingFactoryTest.java 1368659 2012-08-02 19:28:23Z snicoll $

+ */

+public class FileNameMappingFactoryTest

+    extends TestCase

+{

+

+    public void testDefaultFileNameMapping()

+    {

+        final FileNameMapping actual = FileNameMappingFactory.getDefaultFileNameMapping();

+        assertNotNull( actual );

+        assertEquals( StandardFileNameMapping.class, actual.getClass() );

+    }

+

+    public void testGetFileNameMappingByName()

+    {

+        final FileNameMapping actual =

+            FileNameMappingFactory.getFileNameMapping( FileNameMappingFactory.STANDARD_FILE_NAME_MAPPING );

+        assertNotNull( actual );

+        assertEquals( StandardFileNameMapping.class, actual.getClass() );

+    }

+

+    public void testGetFileNameMappingByName2()

+    {

+        final FileNameMapping actual =

+            FileNameMappingFactory.getFileNameMapping( FileNameMappingFactory.FULL_FILE_NAME_MAPPING );

+        assertNotNull( actual );

+        assertEquals( FullFileNameMapping.class, actual.getClass() );

+    }

+

+    public void testGetFileNameMappingByName3()

+    {

+        final FileNameMapping actual =

+            FileNameMappingFactory.getFileNameMapping( FileNameMappingFactory.NO_VERSION_FILE_NAME_MAPPING );

+        assertNotNull( actual );

+        assertEquals( NoVersionFileNameMapping.class, actual.getClass() );

+    }

+

+    public void testGetFileNameMappingByName4()

+    {

+        final FileNameMapping actual =

+            FileNameMappingFactory.getFileNameMapping( FileNameMappingFactory.NO_VERSION_FOR_EJB_FILE_NAME_MAPPING );

+        assertNotNull( actual );

+        assertEquals( NoVersionForEjbFileNameMapping.class, actual.getClass() );

+    }

+

+    public void testGetFileNameMappingByClass()

+    {

+        final FileNameMapping actual =

+            FileNameMappingFactory.getFileNameMapping( StandardFileNameMapping.class.getName() );

+        assertNotNull( actual );

+        assertEquals( StandardFileNameMapping.class, actual.getClass() );

+    }

+

+    public void testGetFileNameMappingByClass2()

+    {

+        final FileNameMapping actual = FileNameMappingFactory.getFileNameMapping( FullFileNameMapping.class.getName() );

+        assertNotNull( actual );

+        assertEquals( FullFileNameMapping.class, actual.getClass() );

+    }

+

+    public void testGetFileNameMappingByUnknownClass()

+    {

+        try

+        {

+            FileNameMappingFactory.getFileNameMapping( "com.foo.bar" );

+            fail( "Should have failed" );

+        }

+        catch ( IllegalStateException e )

+        {

+            // OK

+        }

+    }

+}

diff --git a/src/test/java/org/apache/maven/plugin/ear/output/FullFileNameMappingTest.java b/src/test/java/org/apache/maven/plugins/ear/output/FullFileNameMappingTest.java
similarity index 93%
rename from src/test/java/org/apache/maven/plugin/ear/output/FullFileNameMappingTest.java
rename to src/test/java/org/apache/maven/plugins/ear/output/FullFileNameMappingTest.java
index ece2b97..ea11d58 100644
--- a/src/test/java/org/apache/maven/plugin/ear/output/FullFileNameMappingTest.java
+++ b/src/test/java/org/apache/maven/plugins/ear/output/FullFileNameMappingTest.java
@@ -1,49 +1,50 @@
-package org.apache.maven.plugin.ear.output;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-/*
- * 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.
- */
-
-/**
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- */
-public class FullFileNameMappingTest
-    extends AbstractFileNameMappingTestBase
-{
-
-    private final FullFileNameMapping instance = new FullFileNameMapping();
-
-    @Test
-    public void testSimpleArtifact()
-    {
-        assertEquals( "org-apache-foo-1.0-SNAPSHOT.jar",
-                      instance.mapFileName( createArtifactWithGroupId( "org.apache", "foo", "1.0-SNAPSHOT", "jar" ) ) );
-    }
-
-    @Test
-    public void testArtifactWithClassifier()
-    {
-        assertEquals( "org-apache-foo-1.0-SNAPSHOT-sources.jar",
-                      instance.mapFileName( createArtifactWithGroupId( "org.apache", "foo", "1.0-SNAPSHOT", "jar",
-                                                                       "sources" ) ) );
-    }
-}
+package org.apache.maven.plugins.ear.output;

+

+import static org.junit.Assert.assertEquals;

+

+import org.apache.maven.plugins.ear.output.FullFileNameMapping;

+import org.junit.Test;

+

+/*

+ * 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.

+ */

+

+/**

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ */

+public class FullFileNameMappingTest

+    extends AbstractFileNameMappingTestBase

+{

+

+    private final FullFileNameMapping instance = new FullFileNameMapping();

+

+    @Test

+    public void testSimpleArtifact()

+    {

+        assertEquals( "org-apache-foo-1.0-SNAPSHOT.jar",

+                      instance.mapFileName( createArtifactWithGroupId( "org.apache", "foo", "1.0-SNAPSHOT", "jar" ) ) );

+    }

+

+    @Test

+    public void testArtifactWithClassifier()

+    {

+        assertEquals( "org-apache-foo-1.0-SNAPSHOT-sources.jar",

+                      instance.mapFileName( createArtifactWithGroupId( "org.apache", "foo", "1.0-SNAPSHOT", "jar",

+                                                                       "sources" ) ) );

+    }

+}

diff --git a/src/test/java/org/apache/maven/plugin/ear/output/NoVersionFileNameMappingTest.java b/src/test/java/org/apache/maven/plugins/ear/output/NoVersionFileNameMappingTest.java
similarity index 92%
rename from src/test/java/org/apache/maven/plugin/ear/output/NoVersionFileNameMappingTest.java
rename to src/test/java/org/apache/maven/plugins/ear/output/NoVersionFileNameMappingTest.java
index 4e1c644..902d49a 100644
--- a/src/test/java/org/apache/maven/plugin/ear/output/NoVersionFileNameMappingTest.java
+++ b/src/test/java/org/apache/maven/plugins/ear/output/NoVersionFileNameMappingTest.java
@@ -1,47 +1,48 @@
-package org.apache.maven.plugin.ear.output;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-/*
- * 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.
- */
-
-/**
- * @author Stephane Nicoll
- */
-public class NoVersionFileNameMappingTest
-    extends AbstractFileNameMappingTestBase
-{
-    private final NoVersionFileNameMapping instance = new NoVersionFileNameMapping();
-
-    @Test
-    public void testSimpleArtifact()
-    {
-        assertEquals( "foo.jar", instance.mapFileName( createArtifact( "foo", "1.0-SNAPSHOT", "jar" ) ) );
-    }
-
-    @Test
-    public void testArtifactWithClassifier()
-    {
-        assertEquals( "foo-sources.jar",
-                      instance.mapFileName( createArtifact( "foo", "1.0-SNAPSHOT", "jar", "sources" ) ) );
-    }
-
-}
+package org.apache.maven.plugins.ear.output;

+

+import static org.junit.Assert.assertEquals;

+

+import org.apache.maven.plugins.ear.output.NoVersionFileNameMapping;

+import org.junit.Test;

+

+/*

+ * 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.

+ */

+

+/**

+ * @author Stephane Nicoll

+ */

+public class NoVersionFileNameMappingTest

+    extends AbstractFileNameMappingTestBase

+{

+    private final NoVersionFileNameMapping instance = new NoVersionFileNameMapping();

+

+    @Test

+    public void testSimpleArtifact()

+    {

+        assertEquals( "foo.jar", instance.mapFileName( createArtifact( "foo", "1.0-SNAPSHOT", "jar" ) ) );

+    }

+

+    @Test

+    public void testArtifactWithClassifier()

+    {

+        assertEquals( "foo-sources.jar",

+                      instance.mapFileName( createArtifact( "foo", "1.0-SNAPSHOT", "jar", "sources" ) ) );

+    }

+

+}

diff --git a/src/test/java/org/apache/maven/plugin/ear/output/NoVersionForEjbFileNameMappingTest.java b/src/test/java/org/apache/maven/plugins/ear/output/NoVersionForEjbFileNameMappingTest.java
similarity index 92%
rename from src/test/java/org/apache/maven/plugin/ear/output/NoVersionForEjbFileNameMappingTest.java
rename to src/test/java/org/apache/maven/plugins/ear/output/NoVersionForEjbFileNameMappingTest.java
index 50c5bc8..57222cf 100644
--- a/src/test/java/org/apache/maven/plugin/ear/output/NoVersionForEjbFileNameMappingTest.java
+++ b/src/test/java/org/apache/maven/plugins/ear/output/NoVersionForEjbFileNameMappingTest.java
@@ -1,45 +1,46 @@
-package org.apache.maven.plugin.ear.output;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-/*
- * 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.
- */
-
-/**
- * @author Philippe Marschall
- */
-public class NoVersionForEjbFileNameMappingTest
-    extends AbstractFileNameMappingTestBase
-{
-    private final NoVersionForEjbFileNameMapping instance = new NoVersionForEjbFileNameMapping();
-
-    @Test
-    public void testJarArtifact()
-    {
-        assertEquals( "foo-1.0-SNAPSHOT.jar", instance.mapFileName( createArtifact( "foo", "1.0-SNAPSHOT", "jar" ) ) );
-    }
-
-    @Test
-    public void testEjbArtifact()
-    {
-        assertEquals( "foo.jar", instance.mapFileName( createArtifact( "foo", "1.0-SNAPSHOT", "ejb" ) ) );
-    }
-}
+package org.apache.maven.plugins.ear.output;

+

+import static org.junit.Assert.assertEquals;

+

+import org.apache.maven.plugins.ear.output.NoVersionForEjbFileNameMapping;

+import org.junit.Test;

+

+/*

+ * 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.

+ */

+

+/**

+ * @author Philippe Marschall

+ */

+public class NoVersionForEjbFileNameMappingTest

+    extends AbstractFileNameMappingTestBase

+{

+    private final NoVersionForEjbFileNameMapping instance = new NoVersionForEjbFileNameMapping();

+

+    @Test

+    public void testJarArtifact()

+    {

+        assertEquals( "foo-1.0-SNAPSHOT.jar", instance.mapFileName( createArtifact( "foo", "1.0-SNAPSHOT", "jar" ) ) );

+    }

+

+    @Test

+    public void testEjbArtifact()

+    {

+        assertEquals( "foo.jar", instance.mapFileName( createArtifact( "foo", "1.0-SNAPSHOT", "ejb" ) ) );

+    }

+}

diff --git a/src/test/java/org/apache/maven/plugin/ear/output/StandardFileNameMappingTest.java b/src/test/java/org/apache/maven/plugins/ear/output/StandardFileNameMappingTest.java
similarity index 92%
rename from src/test/java/org/apache/maven/plugin/ear/output/StandardFileNameMappingTest.java
rename to src/test/java/org/apache/maven/plugins/ear/output/StandardFileNameMappingTest.java
index c661c84..160d09e 100644
--- a/src/test/java/org/apache/maven/plugin/ear/output/StandardFileNameMappingTest.java
+++ b/src/test/java/org/apache/maven/plugins/ear/output/StandardFileNameMappingTest.java
@@ -1,48 +1,49 @@
-package org.apache.maven.plugin.ear.output;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-/*
- * 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.
- */
-
-/**
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- */
-public class StandardFileNameMappingTest
-    extends AbstractFileNameMappingTestBase
-{
-
-    private final StandardFileNameMapping instance = new StandardFileNameMapping();
-
-    @Test
-    public void testSimpleArtifact()
-    {
-        assertEquals( "foo-1.0-SNAPSHOT.jar", instance.mapFileName( createArtifact( "foo", "1.0-SNAPSHOT", "jar" ) ) );
-    }
-
-    @Test
-    public void testArtifactWithClassifier()
-    {
-        assertEquals( "foo-1.0-SNAPSHOT-sources.jar",
-                      instance.mapFileName( createArtifact( "foo", "1.0-SNAPSHOT", "jar", "sources" ) ) );
-    }
-
-}
+package org.apache.maven.plugins.ear.output;

+

+import static org.junit.Assert.assertEquals;

+

+import org.apache.maven.plugins.ear.output.StandardFileNameMapping;

+import org.junit.Test;

+

+/*

+ * 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.

+ */

+

+/**

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ */

+public class StandardFileNameMappingTest

+    extends AbstractFileNameMappingTestBase

+{

+

+    private final StandardFileNameMapping instance = new StandardFileNameMapping();

+

+    @Test

+    public void testSimpleArtifact()

+    {

+        assertEquals( "foo-1.0-SNAPSHOT.jar", instance.mapFileName( createArtifact( "foo", "1.0-SNAPSHOT", "jar" ) ) );

+    }

+

+    @Test

+    public void testArtifactWithClassifier()

+    {

+        assertEquals( "foo-1.0-SNAPSHOT-sources.jar",

+                      instance.mapFileName( createArtifact( "foo", "1.0-SNAPSHOT", "jar", "sources" ) ) );

+    }

+

+}

diff --git a/src/test/java/org/apache/maven/plugin/ear/output/TestAbstractFileNameMapping.java b/src/test/java/org/apache/maven/plugins/ear/output/TestAbstractFileNameMapping.java
similarity index 95%
rename from src/test/java/org/apache/maven/plugin/ear/output/TestAbstractFileNameMapping.java
rename to src/test/java/org/apache/maven/plugins/ear/output/TestAbstractFileNameMapping.java
index 3e67661..b8292c1 100644
--- a/src/test/java/org/apache/maven/plugin/ear/output/TestAbstractFileNameMapping.java
+++ b/src/test/java/org/apache/maven/plugins/ear/output/TestAbstractFileNameMapping.java
@@ -1,4 +1,4 @@
-package org.apache.maven.plugin.ear.output;

+package org.apache.maven.plugins.ear.output;

 

 /*

  * Licensed to the Apache Software Foundation (ASF) under one

@@ -24,6 +24,7 @@
 

 import org.apache.maven.artifact.Artifact;

 import org.apache.maven.artifact.handler.ArtifactHandler;

+import org.apache.maven.plugins.ear.output.AbstractFileNameMapping;

 import org.junit.Test;

 

 public class TestAbstractFileNameMapping

diff --git a/src/test/java/org/apache/maven/plugin/ear/stub/ArtifactHandlerTestStub.java b/src/test/java/org/apache/maven/plugins/ear/stub/ArtifactHandlerTestStub.java
similarity index 97%
rename from src/test/java/org/apache/maven/plugin/ear/stub/ArtifactHandlerTestStub.java
rename to src/test/java/org/apache/maven/plugins/ear/stub/ArtifactHandlerTestStub.java
index 52f404c..d71c994 100644
--- a/src/test/java/org/apache/maven/plugin/ear/stub/ArtifactHandlerTestStub.java
+++ b/src/test/java/org/apache/maven/plugins/ear/stub/ArtifactHandlerTestStub.java
@@ -1,72 +1,72 @@
-package org.apache.maven.plugin.ear.stub;
-
-/*
- * 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.handler.ArtifactHandler;
-
-/**
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- */
-public class ArtifactHandlerTestStub
-    implements ArtifactHandler
-{
-
-    private final String extension;
-
-    public ArtifactHandlerTestStub( String extension )
-    {
-        this.extension = extension;
-    }
-
-    public String getExtension()
-    {
-        return extension;
-    }
-
-    public String getDirectory()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public String getClassifier()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public String getPackaging()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public boolean isIncludesDependencies()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public String getLanguage()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public boolean isAddedToClasspath()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-}
+package org.apache.maven.plugins.ear.stub;

+

+/*

+ * 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.handler.ArtifactHandler;

+

+/**

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ */

+public class ArtifactHandlerTestStub

+    implements ArtifactHandler

+{

+

+    private final String extension;

+

+    public ArtifactHandlerTestStub( String extension )

+    {

+        this.extension = extension;

+    }

+

+    public String getExtension()

+    {

+        return extension;

+    }

+

+    public String getDirectory()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public String getClassifier()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public String getPackaging()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public boolean isIncludesDependencies()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public String getLanguage()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public boolean isAddedToClasspath()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+}

diff --git a/src/test/java/org/apache/maven/plugin/ear/stub/ArtifactTestStub.java b/src/test/java/org/apache/maven/plugins/ear/stub/ArtifactTestStub.java
similarity index 98%
rename from src/test/java/org/apache/maven/plugin/ear/stub/ArtifactTestStub.java
rename to src/test/java/org/apache/maven/plugins/ear/stub/ArtifactTestStub.java
index fa46834..9517b67 100644
--- a/src/test/java/org/apache/maven/plugin/ear/stub/ArtifactTestStub.java
+++ b/src/test/java/org/apache/maven/plugins/ear/stub/ArtifactTestStub.java
@@ -1,358 +1,358 @@
-package org.apache.maven.plugin.ear.stub;
-
-/*
- * 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.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-import org.apache.maven.artifact.versioning.ArtifactVersion;
-import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
-import org.apache.maven.artifact.versioning.VersionRange;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * A fake {@link Artifact} test stub.
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public class ArtifactTestStub
-    implements Artifact
-
-{
-    public static final String DEFAULT_VERSION = "1.0";
-
-    private final String groupId;
-
-    private final String artifactId;
-
-    private final String type;
-
-    private final String classifier;
-
-    private String version;
-
-    public ArtifactTestStub( String groupId, String artifactId, String type, String classifier, String version )
-    {
-        this.groupId = groupId;
-        this.artifactId = artifactId;
-        this.type = type;
-        this.classifier = classifier;
-        this.version = version;
-    }
-
-    public ArtifactTestStub( String groupId, String artifactId, String type, String classifier )
-    {
-        this( groupId, artifactId, type, classifier, DEFAULT_VERSION );
-    }
-
-    public String getGroupId()
-    {
-        return groupId;
-    }
-
-    public String getArtifactId()
-    {
-        return artifactId;
-    }
-
-    public String getVersion()
-    {
-        return version;
-    }
-
-    public void setVersion( String version )
-    {
-        this.version = version;
-    }
-
-    public String getScope()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public String getType()
-    {
-        return type;
-    }
-
-    public String getClassifier()
-    {
-        return classifier;
-    }
-
-    public boolean hasClassifier()
-    {
-        return classifier != null;
-    }
-
-    public File getFile()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public void setFile( File file )
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public String getBaseVersion()
-    {
-        return version;
-    }
-
-    public void setBaseVersion( String string )
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public String getId()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public String getDependencyConflictId()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public void addMetadata( ArtifactMetadata artifactMetadata )
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public Collection<ArtifactMetadata> getMetadataList()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public void setRepository( ArtifactRepository artifactRepository )
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public ArtifactRepository getRepository()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public void updateVersion( String string, ArtifactRepository artifactRepository )
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public String getDownloadUrl()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public void setDownloadUrl( String string )
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public ArtifactFilter getDependencyFilter()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public void setDependencyFilter( ArtifactFilter artifactFilter )
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public ArtifactHandler getArtifactHandler()
-    {
-        return new ArtifactHandlerTestStub( "jar" );
-    }
-
-    public List<String> getDependencyTrail()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public void setDependencyTrail( List<String> list )
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public void setScope( String string )
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public VersionRange getVersionRange()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public void setVersionRange( VersionRange versionRange )
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public void selectVersion( String string )
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public void setGroupId( String string )
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public void setArtifactId( String string )
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public boolean isSnapshot()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public void setResolved( boolean b )
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public boolean isResolved()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public void setResolvedVersion( String string )
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public void setArtifactHandler( ArtifactHandler artifactHandler )
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public boolean isRelease()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public void setRelease( boolean b )
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public List<ArtifactVersion> getAvailableVersions()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public void setAvailableVersions( List<ArtifactVersion> list )
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public boolean isOptional()
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public void setOptional( boolean b )
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public ArtifactVersion getSelectedVersion()
-        throws OverConstrainedVersionException
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public boolean isSelectedVersionKnown()
-        throws OverConstrainedVersionException
-    {
-        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );
-    }
-
-    public boolean equals( Object o )
-    {
-        if ( this == o )
-        {
-            return true;
-        }
-        if ( o == null || getClass() != o.getClass() )
-        {
-            return false;
-        }
-
-        ArtifactTestStub that = (ArtifactTestStub) o;
-
-        if ( artifactId != null ? !artifactId.equals( that.artifactId ) : that.artifactId != null )
-        {
-            return false;
-        }
-        if ( classifier != null ? !classifier.equals( that.classifier ) : that.classifier != null )
-        {
-            return false;
-        }
-        if ( groupId != null ? !groupId.equals( that.groupId ) : that.groupId != null )
-        {
-            return false;
-        }
-        if ( type != null ? !type.equals( that.type ) : that.type != null )
-        {
-            return false;
-        }
-
-        return true;
-    }
-
-    public int hashCode()
-    {
-        int result;
-        result = ( groupId != null ? groupId.hashCode() : 0 );
-        result = 31 * result + ( artifactId != null ? artifactId.hashCode() : 0 );
-        result = 31 * result + ( type != null ? type.hashCode() : 0 );
-        result = 31 * result + ( classifier != null ? classifier.hashCode() : 0 );
-        return result;
-    }
-
-    public int compareTo( Artifact o )
-    {
-        if ( this.equals( o ) )
-        {
-            return 0;
-        }
-        else
-        {
-            return 1;
-        }
-    }
-
-    public ArtifactMetadata getMetadata( Class<?> metadataClass )
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-}
+package org.apache.maven.plugins.ear.stub;

+

+/*

+ * 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.artifact.handler.ArtifactHandler;

+import org.apache.maven.artifact.metadata.ArtifactMetadata;

+import org.apache.maven.artifact.repository.ArtifactRepository;

+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;

+import org.apache.maven.artifact.versioning.ArtifactVersion;

+import org.apache.maven.artifact.versioning.OverConstrainedVersionException;

+import org.apache.maven.artifact.versioning.VersionRange;

+

+import java.io.File;

+import java.util.Collection;

+import java.util.List;

+

+/**

+ * A fake {@link Artifact} test stub.

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: ArtifactTestStub.java 1755538 2016-08-08 20:32:12Z rfscholte $

+ */

+public class ArtifactTestStub

+    implements Artifact

+

+{

+    public static final String DEFAULT_VERSION = "1.0";

+

+    private final String groupId;

+

+    private final String artifactId;

+

+    private final String type;

+

+    private final String classifier;

+

+    private String version;

+

+    public ArtifactTestStub( String groupId, String artifactId, String type, String classifier, String version )

+    {

+        this.groupId = groupId;

+        this.artifactId = artifactId;

+        this.type = type;

+        this.classifier = classifier;

+        this.version = version;

+    }

+

+    public ArtifactTestStub( String groupId, String artifactId, String type, String classifier )

+    {

+        this( groupId, artifactId, type, classifier, DEFAULT_VERSION );

+    }

+

+    public String getGroupId()

+    {

+        return groupId;

+    }

+

+    public String getArtifactId()

+    {

+        return artifactId;

+    }

+

+    public String getVersion()

+    {

+        return version;

+    }

+

+    public void setVersion( String version )

+    {

+        this.version = version;

+    }

+

+    public String getScope()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public String getType()

+    {

+        return type;

+    }

+

+    public String getClassifier()

+    {

+        return classifier;

+    }

+

+    public boolean hasClassifier()

+    {

+        return classifier != null;

+    }

+

+    public File getFile()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public void setFile( File file )

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public String getBaseVersion()

+    {

+        return version;

+    }

+

+    public void setBaseVersion( String string )

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public String getId()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public String getDependencyConflictId()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public void addMetadata( ArtifactMetadata artifactMetadata )

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public Collection<ArtifactMetadata> getMetadataList()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public void setRepository( ArtifactRepository artifactRepository )

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public ArtifactRepository getRepository()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public void updateVersion( String string, ArtifactRepository artifactRepository )

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public String getDownloadUrl()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public void setDownloadUrl( String string )

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public ArtifactFilter getDependencyFilter()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public void setDependencyFilter( ArtifactFilter artifactFilter )

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public ArtifactHandler getArtifactHandler()

+    {

+        return new ArtifactHandlerTestStub( "jar" );

+    }

+

+    public List<String> getDependencyTrail()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public void setDependencyTrail( List<String> list )

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public void setScope( String string )

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public VersionRange getVersionRange()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public void setVersionRange( VersionRange versionRange )

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public void selectVersion( String string )

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public void setGroupId( String string )

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public void setArtifactId( String string )

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public boolean isSnapshot()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public void setResolved( boolean b )

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public boolean isResolved()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public void setResolvedVersion( String string )

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public void setArtifactHandler( ArtifactHandler artifactHandler )

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public boolean isRelease()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public void setRelease( boolean b )

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public List<ArtifactVersion> getAvailableVersions()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public void setAvailableVersions( List<ArtifactVersion> list )

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public boolean isOptional()

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public void setOptional( boolean b )

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public ArtifactVersion getSelectedVersion()

+        throws OverConstrainedVersionException

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public boolean isSelectedVersionKnown()

+        throws OverConstrainedVersionException

+    {

+        throw new UnsupportedOperationException( "not implemented ; fake artifact stub" );

+    }

+

+    public boolean equals( Object o )

+    {

+        if ( this == o )

+        {

+            return true;

+        }

+        if ( o == null || getClass() != o.getClass() )

+        {

+            return false;

+        }

+

+        ArtifactTestStub that = (ArtifactTestStub) o;

+

+        if ( artifactId != null ? !artifactId.equals( that.artifactId ) : that.artifactId != null )

+        {

+            return false;

+        }

+        if ( classifier != null ? !classifier.equals( that.classifier ) : that.classifier != null )

+        {

+            return false;

+        }

+        if ( groupId != null ? !groupId.equals( that.groupId ) : that.groupId != null )

+        {

+            return false;

+        }

+        if ( type != null ? !type.equals( that.type ) : that.type != null )

+        {

+            return false;

+        }

+

+        return true;

+    }

+

+    public int hashCode()

+    {

+        int result;

+        result = ( groupId != null ? groupId.hashCode() : 0 );

+        result = 31 * result + ( artifactId != null ? artifactId.hashCode() : 0 );

+        result = 31 * result + ( type != null ? type.hashCode() : 0 );

+        result = 31 * result + ( classifier != null ? classifier.hashCode() : 0 );

+        return result;

+    }

+

+    public int compareTo( Artifact o )

+    {

+        if ( this.equals( o ) )

+        {

+            return 0;

+        }

+        else

+        {

+            return 1;

+        }

+    }

+

+    public ArtifactMetadata getMetadata( Class<?> metadataClass )

+    {

+        // TODO Auto-generated method stub

+        return null;

+    }

+}

diff --git a/src/test/java/org/apache/maven/plugin/ear/util/ArtifactRepositoryTest.java b/src/test/java/org/apache/maven/plugins/ear/util/ArtifactRepositoryTest.java
similarity index 92%
rename from src/test/java/org/apache/maven/plugin/ear/util/ArtifactRepositoryTest.java
rename to src/test/java/org/apache/maven/plugins/ear/util/ArtifactRepositoryTest.java
index 8b15d4d..ad8f295 100644
--- a/src/test/java/org/apache/maven/plugin/ear/util/ArtifactRepositoryTest.java
+++ b/src/test/java/org/apache/maven/plugins/ear/util/ArtifactRepositoryTest.java
@@ -1,107 +1,109 @@
-package org.apache.maven.plugin.ear.util;
-
-/*
- * 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 static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import org.apache.maven.plugin.ear.AbstractEarTestBase;
-import org.apache.maven.plugin.ear.EarPluginException;
-import org.codehaus.plexus.configuration.PlexusConfigurationException;
-import org.junit.Test;
-
-/**
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public class ArtifactRepositoryTest
-    extends AbstractEarTestBase
-{
-
-    public static final String MAIN_ARTIFACT_ID = "none";
-
-    @Test
-    public void testEmptyRepository()
-    {
-        ArtifactTypeMappingService artifactTypeMappingService = new ArtifactTypeMappingService();
-        ArtifactRepository repo =
-            new ArtifactRepository( createArtifacts( null ), MAIN_ARTIFACT_ID, artifactTypeMappingService );
-        assertNull( repo.getUniqueArtifact( "ear", "ar", "jar" ) );
-        assertNull( repo.getUniqueArtifact( "ear", "ar", "jar", null ) );
-        assertNull( repo.getUniqueArtifact( "ear", "ar", "jar", "class" ) );
-    }
-
-    @Test
-    public void testRepositoryWithOneUnclassifiedArtifact()
-    {
-        ArtifactTypeMappingService artifactTypeMappingService = new ArtifactTypeMappingService();
-        ArtifactRepository repo =
-            new ArtifactRepository( createArtifacts( new String[] { "myartifact" } ), MAIN_ARTIFACT_ID,
-                                    artifactTypeMappingService );
-        assertNotNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar" ) );
-        assertNotNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", null ) );
-    }
-
-    @Test
-    public void testRepositoryWithOneClassifiedArtifact()
-    {
-        ArtifactTypeMappingService artifactTypeMappingService = new ArtifactTypeMappingService();
-        ArtifactRepository repo =
-            new ArtifactRepository( createArtifacts( new String[] { "myartifact" }, null, null,
-                                                     new String[] { "classified" } ), MAIN_ARTIFACT_ID,
-                                    artifactTypeMappingService );
-        assertNotNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar" ) );
-        assertNotNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", "classified" ) );
-        assertNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", "wrong" ) );
-    }
-
-    @Test
-    public void testRepositoryWithMultipleClassifiedArtifacts()
-    {
-        ArtifactTypeMappingService artifactTypeMappingService = new ArtifactTypeMappingService();
-        ArtifactRepository repo =
-            new ArtifactRepository( createArtifacts( new String[] { "myartifact", "myartifact", "myartifact" }, null,
-                                                     null, new String[] { "class1", "class2", "class3" } ),
-                                    MAIN_ARTIFACT_ID, artifactTypeMappingService );
-
-        assertNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar" ) );
-        assertNotNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", "class1" ) );
-        assertNotNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", "class2" ) );
-        assertNotNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", "class3" ) );
-        assertNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", "wrong" ) );
-    }
-
-    @Test
-    public void testRepositoryWithMultipleClassifiedArtifactsAndMainArtifact()
-        throws PlexusConfigurationException, EarPluginException
-    {
-        ArtifactTypeMappingService artifactTypeMappingService = new ArtifactTypeMappingService();
-        ArtifactRepository repo =
-            new ArtifactRepository( createArtifacts( new String[] { "myartifact", "myartifact", "myartifact" }, null,
-                                                     null, new String[] { "class1", "class2", null } ),
-                                    MAIN_ARTIFACT_ID, artifactTypeMappingService );
-
-        assertNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar" ) );
-        assertNotNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", "class1" ) );
-        assertNotNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", "class2" ) );
-        assertNotNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", MAIN_ARTIFACT_ID ) );
-        assertNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", "wrong" ) );
-    }
-}
+package org.apache.maven.plugins.ear.util;

+

+/*

+ * 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 static org.junit.Assert.assertNotNull;

+import static org.junit.Assert.assertNull;

+

+import org.apache.maven.plugins.ear.AbstractEarTestBase;

+import org.apache.maven.plugins.ear.EarPluginException;

+import org.apache.maven.plugins.ear.util.ArtifactRepository;

+import org.apache.maven.plugins.ear.util.ArtifactTypeMappingService;

+import org.codehaus.plexus.configuration.PlexusConfigurationException;

+import org.junit.Test;

+

+/**

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: ArtifactRepositoryTest.java 1648192 2014-12-28 12:39:04Z khmarbaise $

+ */

+public class ArtifactRepositoryTest

+    extends AbstractEarTestBase

+{

+

+    public static final String MAIN_ARTIFACT_ID = "none";

+

+    @Test

+    public void testEmptyRepository()

+    {

+        ArtifactTypeMappingService artifactTypeMappingService = new ArtifactTypeMappingService();

+        ArtifactRepository repo =

+            new ArtifactRepository( createArtifacts( null ), MAIN_ARTIFACT_ID, artifactTypeMappingService );

+        assertNull( repo.getUniqueArtifact( "ear", "ar", "jar" ) );

+        assertNull( repo.getUniqueArtifact( "ear", "ar", "jar", null ) );

+        assertNull( repo.getUniqueArtifact( "ear", "ar", "jar", "class" ) );

+    }

+

+    @Test

+    public void testRepositoryWithOneUnclassifiedArtifact()

+    {

+        ArtifactTypeMappingService artifactTypeMappingService = new ArtifactTypeMappingService();

+        ArtifactRepository repo =

+            new ArtifactRepository( createArtifacts( new String[] { "myartifact" } ), MAIN_ARTIFACT_ID,

+                                    artifactTypeMappingService );

+        assertNotNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar" ) );

+        assertNotNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", null ) );

+    }

+

+    @Test

+    public void testRepositoryWithOneClassifiedArtifact()

+    {

+        ArtifactTypeMappingService artifactTypeMappingService = new ArtifactTypeMappingService();

+        ArtifactRepository repo =

+            new ArtifactRepository( createArtifacts( new String[] { "myartifact" }, null, null,

+                                                     new String[] { "classified" } ), MAIN_ARTIFACT_ID,

+                                    artifactTypeMappingService );

+        assertNotNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar" ) );

+        assertNotNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", "classified" ) );

+        assertNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", "wrong" ) );

+    }

+

+    @Test

+    public void testRepositoryWithMultipleClassifiedArtifacts()

+    {

+        ArtifactTypeMappingService artifactTypeMappingService = new ArtifactTypeMappingService();

+        ArtifactRepository repo =

+            new ArtifactRepository( createArtifacts( new String[] { "myartifact", "myartifact", "myartifact" }, null,

+                                                     null, new String[] { "class1", "class2", "class3" } ),

+                                    MAIN_ARTIFACT_ID, artifactTypeMappingService );

+

+        assertNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar" ) );

+        assertNotNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", "class1" ) );

+        assertNotNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", "class2" ) );

+        assertNotNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", "class3" ) );

+        assertNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", "wrong" ) );

+    }

+

+    @Test

+    public void testRepositoryWithMultipleClassifiedArtifactsAndMainArtifact()

+        throws PlexusConfigurationException, EarPluginException

+    {

+        ArtifactTypeMappingService artifactTypeMappingService = new ArtifactTypeMappingService();

+        ArtifactRepository repo =

+            new ArtifactRepository( createArtifacts( new String[] { "myartifact", "myartifact", "myartifact" }, null,

+                                                     null, new String[] { "class1", "class2", null } ),

+                                    MAIN_ARTIFACT_ID, artifactTypeMappingService );

+

+        assertNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar" ) );

+        assertNotNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", "class1" ) );

+        assertNotNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", "class2" ) );

+        assertNotNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", MAIN_ARTIFACT_ID ) );

+        assertNull( repo.getUniqueArtifact( DEFAULT_GROUPID, "myartifact", "jar", "wrong" ) );

+    }

+}

diff --git a/src/test/java/org/apache/maven/plugin/ear/util/ArtifactTypeMappingServiceTest.java b/src/test/java/org/apache/maven/plugins/ear/util/ArtifactTypeMappingServiceTest.java
similarity index 95%
rename from src/test/java/org/apache/maven/plugin/ear/util/ArtifactTypeMappingServiceTest.java
rename to src/test/java/org/apache/maven/plugins/ear/util/ArtifactTypeMappingServiceTest.java
index 4f6f337..ee8a885 100644
--- a/src/test/java/org/apache/maven/plugin/ear/util/ArtifactTypeMappingServiceTest.java
+++ b/src/test/java/org/apache/maven/plugins/ear/util/ArtifactTypeMappingServiceTest.java
@@ -1,248 +1,250 @@
-package org.apache.maven.plugin.ear.util;
-
-/*
- * 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 junit.framework.TestCase;
-import org.apache.maven.plugin.ear.EarModuleFactory;
-import org.apache.maven.plugin.ear.EarPluginException;
-import org.apache.maven.plugin.ear.UnknownArtifactTypeException;
-import org.codehaus.plexus.configuration.PlexusConfigurationException;
-import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
-
-/**
- * Tests for the {@link ArtifactTypeMappingService}
- * 
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id$
- */
-public class ArtifactTypeMappingServiceTest
-    extends TestCase
-{
-
-    public void testDefaultConfiguration()
-    {
-        ArtifactTypeMappingService service = getDefaultService();
-        for ( String type : EarModuleFactory.getStandardArtifactTypes() )
-        {
-            assertTrue( "Standard type could not be found", service.isMappedToType( type, type ) );
-        }
-    }
-
-    public void testIsMappedToTypeForUnknownType()
-    {
-        ArtifactTypeMappingService service = getDefaultService();
-        assertFalse( service.isMappedToType( "rar", "MyKoolCustomType" ) );
-    }
-
-    public void testIsMappedToTypeForKnownType()
-    {
-        ArtifactTypeMappingService service = getServiceWithRarMappingToMyRar();
-        assertTrue( service.isMappedToType( "rar", "MyRar" ) );
-    }
-
-    public void testGetStandardTypeForUknonwnType()
-    {
-        try
-        {
-            ArtifactTypeMappingService service = getDefaultService();
-            service.getStandardType( "MyKoolCustomType" );
-            fail( "Should have failed to retrieve a unknwon custom type" );
-        }
-        catch ( UnknownArtifactTypeException e )
-        {
-            // That's good
-        }
-    }
-
-    public void testGetStandardTypeForKnownType()
-    {
-        try
-        {
-            ArtifactTypeMappingService service = getServiceWithRarMappingToMyRar();
-            assertEquals( "rar", service.getStandardType( "MyRar" ) );
-        }
-        catch ( UnknownArtifactTypeException e )
-        {
-            fail( "Should not have failed to retrieve a knwon custom type " + e.getMessage() );
-        }
-    }
-
-    public void testConfigWithSameCustomType()
-    {
-        try
-        {
-            XmlPlexusConfiguration rootConfig = new XmlPlexusConfiguration( "dummy" );
-            XmlPlexusConfiguration childConfig =
-                new XmlPlexusConfiguration( ArtifactTypeMappingService.ARTIFACT_TYPE_MAPPING_ELEMENT );
-            childConfig.setAttribute( "type", "generic" );
-            childConfig.setAttribute( "mapping", "rar" );
-            XmlPlexusConfiguration childConfig2 =
-                new XmlPlexusConfiguration( ArtifactTypeMappingService.ARTIFACT_TYPE_MAPPING_ELEMENT );
-            childConfig.setAttribute( "type", "generic" );
-            childConfig.setAttribute( "mapping", "ejb" );
-
-            rootConfig.addChild( childConfig );
-            rootConfig.addChild( childConfig2 );
-            ArtifactTypeMappingService service = new ArtifactTypeMappingService();
-            service.configure( rootConfig );
-            fail( "Should have failed" );
-        }
-        catch ( EarPluginException e )
-        {
-            // OK
-        }
-        catch ( PlexusConfigurationException e )
-        {
-            e.printStackTrace();
-            fail( "Unexpected " + e.getMessage() );
-        }
-    }
-
-    public void testConfigWithUnknownStandardType()
-    {
-        try
-        {
-            XmlPlexusConfiguration rootConfig = new XmlPlexusConfiguration( "dummy" );
-            XmlPlexusConfiguration childConfig =
-                new XmlPlexusConfiguration( ArtifactTypeMappingService.ARTIFACT_TYPE_MAPPING_ELEMENT );
-            childConfig.setAttribute( "type", "generic" );
-            childConfig.setAttribute( "mapping", "notAStandardType" );
-
-            rootConfig.addChild( childConfig );
-            ArtifactTypeMappingService service = new ArtifactTypeMappingService();
-            service.configure( rootConfig );
-            fail( "Should have failed" );
-        }
-        catch ( EarPluginException e )
-        {
-            // OK
-        }
-        catch ( PlexusConfigurationException e )
-        {
-            e.printStackTrace();
-            fail( "Unexpected " + e.getMessage() );
-        }
-    }
-
-    public void testConfigWithNoType()
-    {
-        try
-        {
-            XmlPlexusConfiguration rootConfig = new XmlPlexusConfiguration( "dummy" );
-            XmlPlexusConfiguration childConfig =
-                new XmlPlexusConfiguration( ArtifactTypeMappingService.ARTIFACT_TYPE_MAPPING_ELEMENT );
-            childConfig.setAttribute( "mapping", "ejb" );
-
-            rootConfig.addChild( childConfig );
-            ArtifactTypeMappingService service = new ArtifactTypeMappingService();
-            service.configure( rootConfig );
-            fail( "Should have failed" );
-        }
-        catch ( EarPluginException e )
-        {
-            // OK
-        }
-        catch ( PlexusConfigurationException e )
-        {
-            e.printStackTrace();
-            fail( "Unexpected " + e.getMessage() );
-        }
-    }
-
-    public void testConfigWithNoMapping()
-    {
-        try
-        {
-            XmlPlexusConfiguration rootConfig = new XmlPlexusConfiguration( "dummy" );
-            XmlPlexusConfiguration childConfig =
-                new XmlPlexusConfiguration( ArtifactTypeMappingService.ARTIFACT_TYPE_MAPPING_ELEMENT );
-            childConfig.setAttribute( "type", "generic" );
-
-            rootConfig.addChild( childConfig );
-            ArtifactTypeMappingService service = new ArtifactTypeMappingService();
-            service.configure( rootConfig );
-            fail( "Should have failed" );
-        }
-        catch ( EarPluginException e )
-        {
-            // OK
-        }
-        catch ( PlexusConfigurationException e )
-        {
-            e.printStackTrace();
-            fail( "Unexpected " + e.getMessage() );
-        }
-    }
-
-    // Utilities
-
-    protected ArtifactTypeMappingService getServiceWithRarMappingToMyRar()
-    {
-        try
-        {
-            XmlPlexusConfiguration rootConfig = new XmlPlexusConfiguration( "artifact-type-mappings" );
-            XmlPlexusConfiguration childConfig =
-                new XmlPlexusConfiguration( ArtifactTypeMappingService.ARTIFACT_TYPE_MAPPING_ELEMENT );
-            childConfig.setAttribute( "type", "MyRar" );
-            childConfig.setAttribute( "mapping", "rar" );
-            rootConfig.addChild( childConfig );
-            ArtifactTypeMappingService service = new ArtifactTypeMappingService();
-            service.configure( rootConfig );
-
-            return service;
-        }
-        catch ( EarPluginException e )
-        {
-            e.printStackTrace();
-            fail( e.getMessage() );
-        }
-        catch ( PlexusConfigurationException e )
-        {
-            e.printStackTrace();
-            fail( e.getMessage() );
-        }
-        // Won't occur
-        return null;
-
-    }
-
-    protected ArtifactTypeMappingService getDefaultService()
-    {
-        try
-        {
-            ArtifactTypeMappingService service = new ArtifactTypeMappingService();
-            service.configure( new XmlPlexusConfiguration( "dummy" ) );
-
-            return service;
-        }
-        catch ( EarPluginException e )
-        {
-            e.printStackTrace();
-            fail( e.getMessage() );
-        }
-        catch ( PlexusConfigurationException e )
-        {
-            e.printStackTrace();
-            fail( e.getMessage() );
-        }
-        // Won't occur
-        return null;
-    }
-}
+package org.apache.maven.plugins.ear.util;

+

+/*

+ * 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 junit.framework.TestCase;

+

+import org.apache.maven.plugins.ear.EarModuleFactory;

+import org.apache.maven.plugins.ear.EarPluginException;

+import org.apache.maven.plugins.ear.UnknownArtifactTypeException;

+import org.apache.maven.plugins.ear.util.ArtifactTypeMappingService;

+import org.codehaus.plexus.configuration.PlexusConfigurationException;

+import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;

+

+/**

+ * Tests for the {@link ArtifactTypeMappingService}

+ * 

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ * @version $Id: ArtifactTypeMappingServiceTest.java 1542508 2013-11-16 13:21:35Z rfscholte $

+ */

+public class ArtifactTypeMappingServiceTest

+    extends TestCase

+{

+

+    public void testDefaultConfiguration()

+    {

+        ArtifactTypeMappingService service = getDefaultService();

+        for ( String type : EarModuleFactory.getStandardArtifactTypes() )

+        {

+            assertTrue( "Standard type could not be found", service.isMappedToType( type, type ) );

+        }

+    }

+

+    public void testIsMappedToTypeForUnknownType()

+    {

+        ArtifactTypeMappingService service = getDefaultService();

+        assertFalse( service.isMappedToType( "rar", "MyKoolCustomType" ) );

+    }

+

+    public void testIsMappedToTypeForKnownType()

+    {

+        ArtifactTypeMappingService service = getServiceWithRarMappingToMyRar();

+        assertTrue( service.isMappedToType( "rar", "MyRar" ) );

+    }

+

+    public void testGetStandardTypeForUknonwnType()

+    {

+        try

+        {

+            ArtifactTypeMappingService service = getDefaultService();

+            service.getStandardType( "MyKoolCustomType" );

+            fail( "Should have failed to retrieve a unknwon custom type" );

+        }

+        catch ( UnknownArtifactTypeException e )

+        {

+            // That's good

+        }

+    }

+

+    public void testGetStandardTypeForKnownType()

+    {

+        try

+        {

+            ArtifactTypeMappingService service = getServiceWithRarMappingToMyRar();

+            assertEquals( "rar", service.getStandardType( "MyRar" ) );

+        }

+        catch ( UnknownArtifactTypeException e )

+        {

+            fail( "Should not have failed to retrieve a knwon custom type " + e.getMessage() );

+        }

+    }

+

+    public void testConfigWithSameCustomType()

+    {

+        try

+        {

+            XmlPlexusConfiguration rootConfig = new XmlPlexusConfiguration( "dummy" );

+            XmlPlexusConfiguration childConfig =

+                new XmlPlexusConfiguration( ArtifactTypeMappingService.ARTIFACT_TYPE_MAPPING_ELEMENT );

+            childConfig.setAttribute( "type", "generic" );

+            childConfig.setAttribute( "mapping", "rar" );

+            XmlPlexusConfiguration childConfig2 =

+                new XmlPlexusConfiguration( ArtifactTypeMappingService.ARTIFACT_TYPE_MAPPING_ELEMENT );

+            childConfig.setAttribute( "type", "generic" );

+            childConfig.setAttribute( "mapping", "ejb" );

+

+            rootConfig.addChild( childConfig );

+            rootConfig.addChild( childConfig2 );

+            ArtifactTypeMappingService service = new ArtifactTypeMappingService();

+            service.configure( rootConfig );

+            fail( "Should have failed" );

+        }

+        catch ( EarPluginException e )

+        {

+            // OK

+        }

+        catch ( PlexusConfigurationException e )

+        {

+            e.printStackTrace();

+            fail( "Unexpected " + e.getMessage() );

+        }

+    }

+

+    public void testConfigWithUnknownStandardType()

+    {

+        try

+        {

+            XmlPlexusConfiguration rootConfig = new XmlPlexusConfiguration( "dummy" );

+            XmlPlexusConfiguration childConfig =

+                new XmlPlexusConfiguration( ArtifactTypeMappingService.ARTIFACT_TYPE_MAPPING_ELEMENT );

+            childConfig.setAttribute( "type", "generic" );

+            childConfig.setAttribute( "mapping", "notAStandardType" );

+

+            rootConfig.addChild( childConfig );

+            ArtifactTypeMappingService service = new ArtifactTypeMappingService();

+            service.configure( rootConfig );

+            fail( "Should have failed" );

+        }

+        catch ( EarPluginException e )

+        {

+            // OK

+        }

+        catch ( PlexusConfigurationException e )

+        {

+            e.printStackTrace();

+            fail( "Unexpected " + e.getMessage() );

+        }

+    }

+

+    public void testConfigWithNoType()

+    {

+        try

+        {

+            XmlPlexusConfiguration rootConfig = new XmlPlexusConfiguration( "dummy" );

+            XmlPlexusConfiguration childConfig =

+                new XmlPlexusConfiguration( ArtifactTypeMappingService.ARTIFACT_TYPE_MAPPING_ELEMENT );

+            childConfig.setAttribute( "mapping", "ejb" );

+

+            rootConfig.addChild( childConfig );

+            ArtifactTypeMappingService service = new ArtifactTypeMappingService();

+            service.configure( rootConfig );

+            fail( "Should have failed" );

+        }

+        catch ( EarPluginException e )

+        {

+            // OK

+        }

+        catch ( PlexusConfigurationException e )

+        {

+            e.printStackTrace();

+            fail( "Unexpected " + e.getMessage() );

+        }

+    }

+

+    public void testConfigWithNoMapping()

+    {

+        try

+        {

+            XmlPlexusConfiguration rootConfig = new XmlPlexusConfiguration( "dummy" );

+            XmlPlexusConfiguration childConfig =

+                new XmlPlexusConfiguration( ArtifactTypeMappingService.ARTIFACT_TYPE_MAPPING_ELEMENT );

+            childConfig.setAttribute( "type", "generic" );

+

+            rootConfig.addChild( childConfig );

+            ArtifactTypeMappingService service = new ArtifactTypeMappingService();

+            service.configure( rootConfig );

+            fail( "Should have failed" );

+        }

+        catch ( EarPluginException e )

+        {

+            // OK

+        }

+        catch ( PlexusConfigurationException e )

+        {

+            e.printStackTrace();

+            fail( "Unexpected " + e.getMessage() );

+        }

+    }

+

+    // Utilities

+

+    protected ArtifactTypeMappingService getServiceWithRarMappingToMyRar()

+    {

+        try

+        {

+            XmlPlexusConfiguration rootConfig = new XmlPlexusConfiguration( "artifact-type-mappings" );

+            XmlPlexusConfiguration childConfig =

+                new XmlPlexusConfiguration( ArtifactTypeMappingService.ARTIFACT_TYPE_MAPPING_ELEMENT );

+            childConfig.setAttribute( "type", "MyRar" );

+            childConfig.setAttribute( "mapping", "rar" );

+            rootConfig.addChild( childConfig );

+            ArtifactTypeMappingService service = new ArtifactTypeMappingService();

+            service.configure( rootConfig );

+

+            return service;

+        }

+        catch ( EarPluginException e )

+        {

+            e.printStackTrace();

+            fail( e.getMessage() );

+        }

+        catch ( PlexusConfigurationException e )

+        {

+            e.printStackTrace();

+            fail( e.getMessage() );

+        }

+        // Won't occur

+        return null;

+

+    }

+

+    protected ArtifactTypeMappingService getDefaultService()

+    {

+        try

+        {

+            ArtifactTypeMappingService service = new ArtifactTypeMappingService();

+            service.configure( new XmlPlexusConfiguration( "dummy" ) );

+

+            return service;

+        }

+        catch ( EarPluginException e )

+        {

+            e.printStackTrace();

+            fail( e.getMessage() );

+        }

+        catch ( PlexusConfigurationException e )

+        {

+            e.printStackTrace();

+            fail( e.getMessage() );

+        }

+        // Won't occur

+        return null;

+    }

+}

diff --git a/src/test/java/org/apache/maven/plugin/ear/util/EarMavenArchiverTest.java b/src/test/java/org/apache/maven/plugins/ear/util/EarMavenArchiverTest.java
similarity index 90%
rename from src/test/java/org/apache/maven/plugin/ear/util/EarMavenArchiverTest.java
rename to src/test/java/org/apache/maven/plugins/ear/util/EarMavenArchiverTest.java
index 709b6e6..95793c5 100644
--- a/src/test/java/org/apache/maven/plugin/ear/util/EarMavenArchiverTest.java
+++ b/src/test/java/org/apache/maven/plugins/ear/util/EarMavenArchiverTest.java
@@ -1,82 +1,83 @@
-package org.apache.maven.plugin.ear.util;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.maven.plugin.ear.AbstractEarTestBase;
-import org.apache.maven.plugin.ear.EarModule;
-import org.apache.maven.plugin.ear.EjbModule;
-import org.junit.Test;
-
-/*
- * 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.
- */
-
-/**
- * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- */
-public class EarMavenArchiverTest
-    extends AbstractEarTestBase
-{
-
-    @Test
-    public void testSimpleEjbModule()
-    {
-        final List<EarModule> modules = new ArrayList<EarModule>();
-        final EarModule module = new EjbModule( createArtifact( "foo", "ejb" ) );
-        setUri( module, "foo-1.0.jar" );
-        modules.add( module );
-
-        final EarMavenArchiver archiver = new EarMavenArchiver( modules );
-        assertEquals( "foo-1.0.jar", archiver.generateClassPathEntry( "" ) );
-
-    }
-
-    @Test
-    public void testSimpleJarModuleWithCustomBundleDir()
-    {
-        final List<EarModule> modules = new ArrayList<EarModule>();
-        final EarModule module = new EjbModule( createArtifact( "foo", "jar" ) );
-        setUri( module, "libs/foo-1.0.jar" );
-        modules.add( module );
-
-        final EarMavenArchiver archiver = new EarMavenArchiver( modules );
-        assertEquals( "libs/foo-1.0.jar", archiver.generateClassPathEntry( "" ) );
-
-    }
-
-    @Test
-    public void testTwoModules()
-    {
-        final List<EarModule> modules = new ArrayList<EarModule>();
-        final EarModule module = new EjbModule( createArtifact( "foo", "ejb" ) );
-        setUri( module, "foo-1.0.jar" );
-        modules.add( module );
-
-        final EarModule module2 = new EjbModule( createArtifact( "bar", "war" ) );
-        setUri( module2, "bar-2.0.1.war" );
-        modules.add( module2 );
-
-        final EarMavenArchiver archiver = new EarMavenArchiver( modules );
-        assertEquals( "foo-1.0.jar bar-2.0.1.war", archiver.generateClassPathEntry( "" ) );
-
-    }
-
+package org.apache.maven.plugins.ear.util;

+

+import static org.junit.Assert.assertEquals;

+

+import java.util.ArrayList;

+import java.util.List;

+

+import org.apache.maven.plugins.ear.AbstractEarTestBase;

+import org.apache.maven.plugins.ear.EarModule;

+import org.apache.maven.plugins.ear.EjbModule;

+import org.apache.maven.plugins.ear.util.EarMavenArchiver;

+import org.junit.Test;

+

+/*

+ * 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.

+ */

+

+/**

+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>

+ */

+public class EarMavenArchiverTest

+    extends AbstractEarTestBase

+{

+

+    @Test

+    public void testSimpleEjbModule()

+    {

+        final List<EarModule> modules = new ArrayList<EarModule>();

+        final EarModule module = new EjbModule( createArtifact( "foo", "ejb" ) );

+        setUri( module, "foo-1.0.jar" );

+        modules.add( module );

+

+        final EarMavenArchiver archiver = new EarMavenArchiver( modules );

+        assertEquals( "foo-1.0.jar", archiver.generateClassPathEntry( "" ) );

+

+    }

+

+    @Test

+    public void testSimpleJarModuleWithCustomBundleDir()

+    {

+        final List<EarModule> modules = new ArrayList<EarModule>();

+        final EarModule module = new EjbModule( createArtifact( "foo", "jar" ) );

+        setUri( module, "libs/foo-1.0.jar" );

+        modules.add( module );

+

+        final EarMavenArchiver archiver = new EarMavenArchiver( modules );

+        assertEquals( "libs/foo-1.0.jar", archiver.generateClassPathEntry( "" ) );

+

+    }

+

+    @Test

+    public void testTwoModules()

+    {

+        final List<EarModule> modules = new ArrayList<EarModule>();

+        final EarModule module = new EjbModule( createArtifact( "foo", "ejb" ) );

+        setUri( module, "foo-1.0.jar" );

+        modules.add( module );

+

+        final EarModule module2 = new EjbModule( createArtifact( "bar", "war" ) );

+        setUri( module2, "bar-2.0.1.war" );

+        modules.add( module2 );

+

+        final EarMavenArchiver archiver = new EarMavenArchiver( modules );

+        assertEquals( "foo-1.0.jar bar-2.0.1.war", archiver.generateClassPathEntry( "" ) );

+

+    }

+

 }
\ No newline at end of file
diff --git a/src/test/java/org/apache/maven/plugin/ear/util/JavaEEVersionTest.java b/src/test/java/org/apache/maven/plugins/ear/util/JavaEEVersionTest.java
similarity index 95%
rename from src/test/java/org/apache/maven/plugin/ear/util/JavaEEVersionTest.java
rename to src/test/java/org/apache/maven/plugins/ear/util/JavaEEVersionTest.java
index e03867a..f94bb8b 100644
--- a/src/test/java/org/apache/maven/plugin/ear/util/JavaEEVersionTest.java
+++ b/src/test/java/org/apache/maven/plugins/ear/util/JavaEEVersionTest.java
@@ -1,149 +1,152 @@
-package org.apache.maven.plugin.ear.util;
-
-/*
- * 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 junit.framework.TestCase;
-
-/**
- * @author Stephane Nicoll
- */
-public class JavaEEVersionTest
-    extends TestCase
-{
-
-    public void testGtSameVersion()
-    {
-        assertFalse( JavaEEVersion.FIVE.gt( JavaEEVersion.FIVE ) );
-    }
-
-    public void testGtNextVersion()
-    {
-        assertFalse( JavaEEVersion.FIVE.gt( JavaEEVersion.SIX ) );
-    }
-
-    public void testGtPreviousVersion()
-    {
-        assertTrue( JavaEEVersion.FIVE.gt( JavaEEVersion.ONE_DOT_FOUR ) );
-    }
-
-    public void testGeSameVersion()
-    {
-        assertTrue( JavaEEVersion.FIVE.ge( JavaEEVersion.FIVE ) );
-    }
-
-    public void testGePreviousVersion()
-    {
-        assertTrue( JavaEEVersion.FIVE.ge( JavaEEVersion.ONE_DOT_FOUR ) );
-    }
-
-    public void testGeNextVersion()
-    {
-        assertFalse( JavaEEVersion.FIVE.ge( JavaEEVersion.SIX ) );
-    }
-
-    public void testLtSameVersion()
-    {
-        assertFalse( JavaEEVersion.FIVE.lt( JavaEEVersion.FIVE ) );
-    }
-
-    public void testLtPreviousVersion()
-    {
-        assertFalse( JavaEEVersion.FIVE.lt( JavaEEVersion.ONE_DOT_FOUR ) );
-    }
-
-    public void testLtNextVersion()
-    {
-        assertTrue( JavaEEVersion.FIVE.lt( JavaEEVersion.SIX ) );
-    }
-
-    public void testLeSameVersion()
-    {
-        assertTrue( JavaEEVersion.FIVE.le( JavaEEVersion.FIVE ) );
-    }
-
-    public void testLePreviousVersion()
-    {
-        assertFalse( JavaEEVersion.FIVE.le( JavaEEVersion.ONE_DOT_FOUR ) );
-    }
-
-    public void testLeNextVersion()
-    {
-        assertTrue( JavaEEVersion.FIVE.le( JavaEEVersion.SIX ) );
-    }
-
-    public void testEqSameVersion()
-    {
-        assertTrue( JavaEEVersion.FIVE.eq( JavaEEVersion.FIVE ) );
-    }
-
-    public void testEqAnotherVersion()
-    {
-        assertFalse( JavaEEVersion.FIVE.eq( JavaEEVersion.ONE_DOT_THREE ) );
-    }
-
-    public void testGetVersion()
-    {
-        assertEquals( "5", JavaEEVersion.FIVE.getVersion() );
-    }
-
-    public void testGetJavaEEVersionValid()
-    {
-        try
-        {
-            assertEquals( JavaEEVersion.SIX, JavaEEVersion.getJavaEEVersion( "6" ) );
-        }
-        catch ( InvalidJavaEEVersion invalidJavaEEVersion )
-        {
-            fail( "No exception should have been thrown but got [" + invalidJavaEEVersion.getMessage() + "]" );
-        }
-    }
-
-    public void testGetJavaEEVersionInvalid()
-    {
-        try
-        {
-            JavaEEVersion.getJavaEEVersion( "2.4" );
-            fail( "Should have failed to get an invalid version." );
-        }
-        catch ( InvalidJavaEEVersion e )
-        {
-            // OK
-        }
-    }
-
-    public void testGetJavaEEVersionNull()
-    {
-        try
-        {
-            JavaEEVersion.getJavaEEVersion( null );
-            fail( "Should have failed to get a 'null' version." );
-        }
-        catch ( InvalidJavaEEVersion e )
-        {
-            fail( "Should have failed with an illegal argument exception instead." );
-        }
-        catch ( IllegalArgumentException e )
-        {
-            // OK
-        }
-
-    }
-
-}
+package org.apache.maven.plugins.ear.util;

+

+import org.apache.maven.plugins.ear.util.InvalidJavaEEVersion;

+import org.apache.maven.plugins.ear.util.JavaEEVersion;

+

+/*

+ * 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 junit.framework.TestCase;

+

+/**

+ * @author Stephane Nicoll

+ */

+public class JavaEEVersionTest

+    extends TestCase

+{

+

+    public void testGtSameVersion()

+    {

+        assertFalse( JavaEEVersion.FIVE.gt( JavaEEVersion.FIVE ) );

+    }

+

+    public void testGtNextVersion()

+    {

+        assertFalse( JavaEEVersion.FIVE.gt( JavaEEVersion.SIX ) );

+    }

+

+    public void testGtPreviousVersion()

+    {

+        assertTrue( JavaEEVersion.FIVE.gt( JavaEEVersion.ONE_DOT_FOUR ) );

+    }

+

+    public void testGeSameVersion()

+    {

+        assertTrue( JavaEEVersion.FIVE.ge( JavaEEVersion.FIVE ) );

+    }

+

+    public void testGePreviousVersion()

+    {

+        assertTrue( JavaEEVersion.FIVE.ge( JavaEEVersion.ONE_DOT_FOUR ) );

+    }

+

+    public void testGeNextVersion()

+    {

+        assertFalse( JavaEEVersion.FIVE.ge( JavaEEVersion.SIX ) );

+    }

+

+    public void testLtSameVersion()

+    {

+        assertFalse( JavaEEVersion.FIVE.lt( JavaEEVersion.FIVE ) );

+    }

+

+    public void testLtPreviousVersion()

+    {

+        assertFalse( JavaEEVersion.FIVE.lt( JavaEEVersion.ONE_DOT_FOUR ) );

+    }

+

+    public void testLtNextVersion()

+    {

+        assertTrue( JavaEEVersion.FIVE.lt( JavaEEVersion.SIX ) );

+    }

+

+    public void testLeSameVersion()

+    {

+        assertTrue( JavaEEVersion.FIVE.le( JavaEEVersion.FIVE ) );

+    }

+

+    public void testLePreviousVersion()

+    {

+        assertFalse( JavaEEVersion.FIVE.le( JavaEEVersion.ONE_DOT_FOUR ) );

+    }

+

+    public void testLeNextVersion()

+    {

+        assertTrue( JavaEEVersion.FIVE.le( JavaEEVersion.SIX ) );

+    }

+

+    public void testEqSameVersion()

+    {

+        assertTrue( JavaEEVersion.FIVE.eq( JavaEEVersion.FIVE ) );

+    }

+

+    public void testEqAnotherVersion()

+    {

+        assertFalse( JavaEEVersion.FIVE.eq( JavaEEVersion.ONE_DOT_THREE ) );

+    }

+

+    public void testGetVersion()

+    {

+        assertEquals( "5", JavaEEVersion.FIVE.getVersion() );

+    }

+

+    public void testGetJavaEEVersionValid()

+    {

+        try

+        {

+            assertEquals( JavaEEVersion.SIX, JavaEEVersion.getJavaEEVersion( "6" ) );

+        }

+        catch ( InvalidJavaEEVersion invalidJavaEEVersion )

+        {

+            fail( "No exception should have been thrown but got [" + invalidJavaEEVersion.getMessage() + "]" );

+        }

+    }

+

+    public void testGetJavaEEVersionInvalid()

+    {

+        try

+        {

+            JavaEEVersion.getJavaEEVersion( "2.4" );

+            fail( "Should have failed to get an invalid version." );

+        }

+        catch ( InvalidJavaEEVersion e )

+        {

+            // OK

+        }

+    }

+

+    public void testGetJavaEEVersionNull()

+    {

+        try

+        {

+            JavaEEVersion.getJavaEEVersion( null );

+            fail( "Should have failed to get a 'null' version." );

+        }

+        catch ( InvalidJavaEEVersion e )

+        {

+            fail( "Should have failed with an illegal argument exception instead." );

+        }

+        catch ( IllegalArgumentException e )

+        {

+            // OK

+        }

+

+    }

+

+}

diff --git a/src/test/java/org/apache/maven/plugin/ear/util/ModuleIdentifierValidatorTest.java b/src/test/java/org/apache/maven/plugins/ear/util/ModuleIdentifierValidatorTest.java
similarity index 98%
rename from src/test/java/org/apache/maven/plugin/ear/util/ModuleIdentifierValidatorTest.java
rename to src/test/java/org/apache/maven/plugins/ear/util/ModuleIdentifierValidatorTest.java
index f932125..62de40c 100644
--- a/src/test/java/org/apache/maven/plugin/ear/util/ModuleIdentifierValidatorTest.java
+++ b/src/test/java/org/apache/maven/plugins/ear/util/ModuleIdentifierValidatorTest.java
@@ -1,4 +1,4 @@
-package org.apache.maven.plugin.ear.util;
+package org.apache.maven.plugins.ear.util;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -30,7 +30,8 @@
 import java.util.Map;
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.ear.EarModule;
+import org.apache.maven.plugins.ear.EarModule;
+import org.apache.maven.plugins.ear.util.ModuleIdentifierValidator;
 import org.junit.Before;
 import org.junit.Test;
 
diff --git a/src/test/java/org/apache/maven/plugin/ear/util/ResourceEntityResolver.java b/src/test/java/org/apache/maven/plugins/ear/util/ResourceEntityResolver.java
similarity index 96%
rename from src/test/java/org/apache/maven/plugin/ear/util/ResourceEntityResolver.java
rename to src/test/java/org/apache/maven/plugins/ear/util/ResourceEntityResolver.java
index 16dfee4..d5fcee3 100644
--- a/src/test/java/org/apache/maven/plugin/ear/util/ResourceEntityResolver.java
+++ b/src/test/java/org/apache/maven/plugins/ear/util/ResourceEntityResolver.java
@@ -1,37 +1,37 @@
-package org.apache.maven.plugin.ear.util;
-
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.InputStream;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-
-public class ResourceEntityResolver
-    implements EntityResolver
-{
-    public InputSource resolveEntity( String publicId, String systemId )
-    {
-        String dtd = "/dtd" + systemId.substring( systemId.lastIndexOf( '/' ) );
-        InputStream in = ResourceEntityResolver.class.getResourceAsStream( dtd );
-        if ( in == null )
-        {
-            throw new RuntimeException( "unable to load DTD " + dtd + " for " + systemId );
-        }
-        else
-        {
-            return new InputSource( in );
-        }
-    }
-}
+package org.apache.maven.plugins.ear.util;

+

+/*

+ * Licensed under the Apache License, Version 2.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ *

+ *     http://www.apache.org/licenses/LICENSE-2.0

+ *

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ */

+

+import java.io.InputStream;

+import org.xml.sax.EntityResolver;

+import org.xml.sax.InputSource;

+

+public class ResourceEntityResolver

+    implements EntityResolver

+{

+    public InputSource resolveEntity( String publicId, String systemId )

+    {

+        String dtd = "/dtd" + systemId.substring( systemId.lastIndexOf( '/' ) );

+        InputStream in = ResourceEntityResolver.class.getResourceAsStream( dtd );

+        if ( in == null )

+        {

+            throw new RuntimeException( "unable to load DTD " + dtd + " for " + systemId );

+        }

+        else

+        {

+            return new InputSource( in );

+        }

+    }

+}