Author: khmarbaise
Date: Sat Jun 14 20:48:38 2014
New Revision: 1602622

URL: http://svn.apache.org/r1602622
Log:
[MEAR-189]
 - In case of the fileNameMapping is changed from
   default to no-version or full the deletion of the
   artifacts could not work. So introduced a simple method
   which gives back the original name which solves the problem.
 - Added two approriate integration tests to prove the correctness.

Added:
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/ear-module/
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/ear-module/pom.xml
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/pom.xml
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/verify.bsh
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/war-module/
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/war-module/pom.xml
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/war-module/src/
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/war-module/src/main/
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/war-module/src/main/webapp/
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/war-module/src/main/webapp/WEB-INF/
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/war-module/src/main/webapp/WEB-INF/web.xml
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/ear-module/
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/ear-module/pom.xml
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/pom.xml
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/verify.bsh
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/war-module/
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/war-module/pom.xml
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/war-module/src/
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/war-module/src/main/
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/war-module/src/main/webapp/
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/war-module/src/main/webapp/WEB-INF/
    
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/war-module/src/main/webapp/WEB-INF/web.xml
Modified:
    
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractEarModule.java
    
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java

Added: 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/ear-module/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/ear-module/pom.xml?rev=1602622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/ear-module/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/ear-module/pom.xml
 Sat Jun 14 20:48:38 2014
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.ear.skinnywars</groupId>
+  <artifactId>ear-module</artifactId>
+  <version>1.0</version>
+  <packaging>ear</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.5</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.its.ear.skinnywars</groupId>
+      <artifactId>war-module</artifactId>
+      <version>1.0</version>
+      <type>war</type>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>@project.groupId@</groupId>
+        <artifactId>@project.artifactId@</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <skinnyWars>true</skinnyWars>
+          <defaultJavaBundleDir>lib/</defaultJavaBundleDir>
+          <fileNameMapping>full</fileNameMapping>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/pom.xml?rev=1602622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/pom.xml
 Sat Jun 14 20:48:38 2014
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.ear.skinnywars</groupId>
+  <artifactId>pom</artifactId>
+  <version>1.0</version>
+  <packaging>pom</packaging>
+
+  <description>Test MEAR-189</description>
+
+  <modules>
+      <module>ear-module</module>
+      <module>war-module</module>
+  </modules>
+</project>

Added: 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/verify.bsh
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/verify.bsh?rev=1602622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/verify.bsh
 (added)
+++ 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/verify.bsh
 Sat Jun 14 20:48:38 2014
@@ -0,0 +1,94 @@
+/*
+ * 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.*;
+import java.util.*;
+import java.util.jar.*;
+import java.util.regex.*;
+
+File jarFile = new File( basedir, 
"ear-module/target/ear-module-1.0/org-apache-maven-its-ear-skinnywars-war-module-1.0.war"
 );
+System.out.println( "Checking for existence of " + jarFile );
+if ( !jarFile.isFile() )
+{
+    throw new IllegalStateException( "Missing file: " + jarFile );
+}
+
+JarFile jar = new JarFile( jarFile );
+
+String[] includedEntries = {
+    "WEB-INF/web.xml",
+    "META-INF/MANIFEST.MF"
+};
+for ( String included : includedEntries )
+{
+    System.out.println( "Checking for included archive entry " + included );
+    if ( jar.getEntry( included ) == null )
+    {
+        throw new IllegalStateException( "Missing archive entry: " + included 
);
+    }
+}
+
+Manifest manifest = jar.getManifest();
+String manifestClassPath = manifest.getMainAttributes().getValue("Class-Path");
+if ( !manifestClassPath.equals("lib/commons-lang-commons-lang-2.5.jar") )
+{
+    throw new IllegalStateException( "Missing entry in war MANIFEST.MF: 
lib/commons-lang-commons-lang-2.5.jar");
+}
+
+String[] excludedEntries = {
+    "WEB-INF/lib/commons-lang-commons-lang-2.5.jar"
+};
+for ( String excluded : excludedEntries )
+{
+    System.out.println( "Checking for excluded artifact " + excluded );
+    if ( jar.getEntry( excluded ) != null )
+    {
+        throw new IllegalStateException( "Archive entry should be excluded: " 
+ excluded );
+    }
+}
+
+jar.close();
+
+
+File jarFile = new File( basedir, "war-module/target/war-module-1.0.war" );
+System.out.println( "Checking for existence of " + jarFile );
+if ( !jarFile.isFile() )
+{
+    throw new IllegalStateException( "Missing file: " + jarFile );
+}
+
+JarFile jar = new JarFile( jarFile );
+
+String[] includedEntries = {
+    "WEB-INF/web.xml",
+    "META-INF/MANIFEST.MF",
+    "WEB-INF/lib/commons-lang-2.5.jar"
+};
+for ( String included : includedEntries )
+{
+    System.out.println( "Checking for included archive entry " + included );
+    if ( jar.getEntry( included ) == null )
+    {
+        throw new IllegalStateException( "Missing archive entry: " + included 
);
+    }
+}
+
+jar.close();
+
+return true;

Added: 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/war-module/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/war-module/pom.xml?rev=1602622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/war-module/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/war-module/pom.xml
 Sat Jun 14 20:48:38 2014
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.ear.skinnywars</groupId>
+  <artifactId>war-module</artifactId>
+  <version>1.0</version>
+  <packaging>war</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.5</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-war-plugin</artifactId>
+        <version>2.1.1</version>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/war-module/src/main/webapp/WEB-INF/web.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/war-module/src/main/webapp/WEB-INF/web.xml?rev=1602622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/war-module/src/main/webapp/WEB-INF/web.xml
 (added)
+++ 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-full/war-module/src/main/webapp/WEB-INF/web.xml
 Sat Jun 14 20:48:38 2014
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd";>
+
+<web-app >
+</web-app>

Added: 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/ear-module/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/ear-module/pom.xml?rev=1602622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/ear-module/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/ear-module/pom.xml
 Sat Jun 14 20:48:38 2014
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.ear.skinnywars</groupId>
+  <artifactId>ear-module</artifactId>
+  <version>1.0</version>
+  <packaging>ear</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.5</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.its.ear.skinnywars</groupId>
+      <artifactId>war-module</artifactId>
+      <version>1.0</version>
+      <type>war</type>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>@project.groupId@</groupId>
+        <artifactId>@project.artifactId@</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <skinnyWars>true</skinnyWars>
+          <defaultJavaBundleDir>lib/</defaultJavaBundleDir>
+          <fileNameMapping>no-version</fileNameMapping>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/pom.xml?rev=1602622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/pom.xml
 Sat Jun 14 20:48:38 2014
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.ear.skinnywars</groupId>
+  <artifactId>pom</artifactId>
+  <version>1.0</version>
+  <packaging>pom</packaging>
+
+  <description>Test MEAR-189</description>
+
+  <modules>
+      <module>ear-module</module>
+      <module>war-module</module>
+  </modules>
+</project>

Added: 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/verify.bsh
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/verify.bsh?rev=1602622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/verify.bsh
 (added)
+++ 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/verify.bsh
 Sat Jun 14 20:48:38 2014
@@ -0,0 +1,94 @@
+/*
+ * 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.*;
+import java.util.*;
+import java.util.jar.*;
+import java.util.regex.*;
+
+File jarFile = new File( basedir, 
"ear-module/target/ear-module-1.0/war-module.war" );
+System.out.println( "Checking for existence of " + jarFile );
+if ( !jarFile.isFile() )
+{
+    throw new IllegalStateException( "Missing file: " + jarFile );
+}
+
+JarFile jar = new JarFile( jarFile );
+
+String[] includedEntries = {
+    "WEB-INF/web.xml",
+    "META-INF/MANIFEST.MF"
+};
+for ( String included : includedEntries )
+{
+    System.out.println( "Checking for included archive entry " + included );
+    if ( jar.getEntry( included ) == null )
+    {
+        throw new IllegalStateException( "Missing archive entry: " + included 
);
+    }
+}
+
+Manifest manifest = jar.getManifest();
+String manifestClassPath = manifest.getMainAttributes().getValue("Class-Path");
+if ( !manifestClassPath.equals("lib/commons-lang.jar") )
+{
+    throw new IllegalStateException( "Missing entry in war MANIFEST.MF: 
lib/commons-lang.jar");
+}
+
+String[] excludedEntries = {
+    "WEB-INF/lib/commons-lang-2.5.jar"
+};
+for ( String excluded : excludedEntries )
+{
+    System.out.println( "Checking for excluded artifact " + excluded );
+    if ( jar.getEntry( excluded ) != null )
+    {
+        throw new IllegalStateException( "Archive entry should be excluded: " 
+ excluded );
+    }
+}
+
+jar.close();
+
+
+File jarFile = new File( basedir, "war-module/target/war-module-1.0.war" );
+System.out.println( "Checking for existence of " + jarFile );
+if ( !jarFile.isFile() )
+{
+    throw new IllegalStateException( "Missing file: " + jarFile );
+}
+
+JarFile jar = new JarFile( jarFile );
+
+String[] includedEntries = {
+    "WEB-INF/web.xml",
+    "META-INF/MANIFEST.MF",
+    "WEB-INF/lib/commons-lang-2.5.jar"
+};
+for ( String included : includedEntries )
+{
+    System.out.println( "Checking for included archive entry " + included );
+    if ( jar.getEntry( included ) == null )
+    {
+        throw new IllegalStateException( "Missing archive entry: " + included 
);
+    }
+}
+
+jar.close();
+
+return true;

Added: 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/war-module/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/war-module/pom.xml?rev=1602622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/war-module/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/war-module/pom.xml
 Sat Jun 14 20:48:38 2014
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.ear.skinnywars</groupId>
+  <artifactId>war-module</artifactId>
+  <version>1.0</version>
+  <packaging>war</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.5</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-war-plugin</artifactId>
+        <version>2.1.1</version>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/war-module/src/main/webapp/WEB-INF/web.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/war-module/src/main/webapp/WEB-INF/web.xml?rev=1602622&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/war-module/src/main/webapp/WEB-INF/web.xml
 (added)
+++ 
maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars-filenamemapping-no-version/war-module/src/main/webapp/WEB-INF/web.xml
 Sat Jun 14 20:48:38 2014
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd";>
+
+<web-app >
+</web-app>

Modified: 
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractEarModule.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractEarModule.java?rev=1602622&r1=1602621&r2=1602622&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractEarModule.java
 (original)
+++ 
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractEarModule.java
 Sat Jun 14 20:48:38 2014
@@ -21,6 +21,8 @@ package org.apache.maven.plugin.ear;
 
 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.output.StandardFileNameMapping;
 import org.apache.maven.plugin.ear.util.ArtifactRepository;
 import org.codehaus.plexus.util.xml.XMLWriter;
 
@@ -213,6 +215,16 @@ public abstract class AbstractEarModule
     }
 
     /**
+     * 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.

Modified: 
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java?rev=1602622&r1=1602621&r2=1602622&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java
 Sat Jun 14 20:48:38 2014
@@ -659,8 +659,7 @@ public class EarMojo
             {
                 // 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( generatedDescriptorLocation, "temp" ), 
module.getUri() );
+                workDirectory = new File( new File( 
generatedDescriptorLocation, "temp" ), module.getUri() );
                 workDirectory.mkdirs();
                 getLog().debug( "Created a temporary work directory: " + 
workDirectory.getAbsolutePath() );
 
@@ -711,11 +710,16 @@ public class EarMojo
 
                     if ( module.getLibDir() != null )
                     {
+                        //MEAR-189:
+                        //We use the original name, cause in case of 
fileNameMapping to no-version/full 
+                        //we coulnd 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.getBundleFileName() );
+                            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 + "'" );


Reply via email to