[MEAR-261] - In cases where fileNameMapping is used fail the build
authorKarl Heinz Marbaise <khmarbaise@apache.org>
Thu, 8 Mar 2018 20:05:09 +0000 (21:05 +0100)
committerKarl Heinz Marbaise <khmarbaise@apache.org>
Fri, 9 Mar 2018 19:19:14 +0000 (20:19 +0100)
 o Added IT to check if it's working correct.
 o Fixed other IT's which would fail otherwise and would
   mask the real intention of the IT's.

src/it/filenamemapping-usage-fail/ear-module/pom.xml [new file with mode: 0644]
src/it/filenamemapping-usage-fail/invoker.properties [new file with mode: 0644]
src/it/filenamemapping-usage-fail/pom.xml [new file with mode: 0644]
src/it/filenamemapping-usage-fail/verify.groovy [new file with mode: 0644]
src/it/filenamemapping-usage-fail/war-module/pom.xml [new file with mode: 0644]
src/it/filenamemapping-usage-fail/war-module/src/main/webapp/WEB-INF/web.xml [new file with mode: 0644]
src/it/skinny-wars-filenamemapping-no-version/ear-module/pom.xml
src/main/java/org/apache/maven/plugins/ear/AbstractEarMojo.java
src/test/resources/projects/project-035/pom.xml
src/test/resources/projects/project-078/pom.xml

diff --git a/src/it/filenamemapping-usage-fail/ear-module/pom.xml b/src/it/filenamemapping-usage-fail/ear-module/pom.xml
new file mode 100644 (file)
index 0000000..0cfc8c5
--- /dev/null
@@ -0,0 +1,62 @@
+<?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>
+          <defaultLibBundleDir>lib/</defaultLibBundleDir>
+          <!--
+            ! Only artifactId.extension
+            ! no groupId/version etc. 
+           -->
+          <fileNameMapping>no-version</fileNameMapping>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/src/it/filenamemapping-usage-fail/invoker.properties b/src/it/filenamemapping-usage-fail/invoker.properties
new file mode 100644 (file)
index 0000000..f2a7dfb
--- /dev/null
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.buildResult = failure
diff --git a/src/it/filenamemapping-usage-fail/pom.xml b/src/it/filenamemapping-usage-fail/pom.xml
new file mode 100644 (file)
index 0000000..d8b6339
--- /dev/null
@@ -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-261</description>
+
+  <modules>
+      <module>ear-module</module>
+      <module>war-module</module>
+  </modules>
+</project>
diff --git a/src/it/filenamemapping-usage-fail/verify.groovy b/src/it/filenamemapping-usage-fail/verify.groovy
new file mode 100644 (file)
index 0000000..96b6b37
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+def buildLog = new File( basedir, "build.log" ).getText('UTF-8')
+
+if (!buildLog.contains ( '[ERROR] fileNameMapping has been removed with version 3.0.0. You are still using it.' )) {
+  println ( "missing output about fileNameMapping removement.")
+  return false
+}
+if (!buildLog.contains ( '[ERROR] Use outputFileNameMapping instead.' )) {
+  println ( "missing information about usage today.")
+  return false
+}
+
+
+return true;
diff --git a/src/it/filenamemapping-usage-fail/war-module/pom.xml b/src/it/filenamemapping-usage-fail/war-module/pom.xml
new file mode 100644 (file)
index 0000000..c6be50e
--- /dev/null
@@ -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>
diff --git a/src/it/filenamemapping-usage-fail/war-module/src/main/webapp/WEB-INF/web.xml b/src/it/filenamemapping-usage-fail/war-module/src/main/webapp/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..c1af95d
--- /dev/null
@@ -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>
index 8b860dd..474fcf1 100644 (file)
@@ -55,7 +55,6 @@ under the License.
             ! no groupId/version etc. 
            -->
           <outputFileNameMapping>@{artifactId}@@{dashClassifier?}@.@{extension}@</outputFileNameMapping>
-          <fileNameMapping>no-version</fileNameMapping>
         </configuration>
       </plugin>
     </plugins>
index f8285d9..5488426 100644 (file)
@@ -173,6 +173,14 @@ public abstract class AbstractEarMojo
     public void execute()\r
         throws MojoExecutionException, MojoFailureException\r
     {\r
+        if ( fileNameMapping != null )\r
+        {\r
+            getLog().error( "fileNameMapping has been removed with version 3.0.0. You are still using it." );\r
+            getLog().error( "Use outputFileNameMapping instead." );\r
+            throw new MojoExecutionException( "fileNameMapping has ben removed with version 3.0.0 "\r
+                + "but you are still using it." );\r
+        }\r
+\r
         final JavaEEVersion javaEEVersion = JavaEEVersion.getJavaEEVersion( version );\r
         getLog().debug( "Resolving artifact type mappings ..." );\r
         ArtifactTypeMappingService typeMappingService;\r
index 6ee0f6f..4556e4f 100644 (file)
@@ -65,7 +65,6 @@ under the License.
         <artifactId>maven-ear-plugin</artifactId>
         <version>@project.version@</version>
         <configuration>
-          <fileNameMapping>full</fileNameMapping>
           <defaultLibBundleDir>libs</defaultLibBundleDir>
           <modules>
             <sarModule>
index cbf7c74..2fd5d5d 100644 (file)
@@ -54,7 +54,6 @@ under the License.
         <configuration>
           <version>1.3</version>
           <outputFileNameMapping>@{artifactId}@.@{extension}@</outputFileNameMapping>
-          <fileNameMapping>no-version-for-ejb</fileNameMapping>
         </configuration>
       </plugin>
     </plugins>