You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2018/03/08 20:07:21 UTC

[maven-ear-plugin] 01/01: [MEAR-261] - In cases where fileNameMapping is used fail the build 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.

This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a commit to branch MEAR-261
in repository https://gitbox.apache.org/repos/asf/maven-ear-plugin.git

commit 32794374427e6ae8177591a4d8c6e7ee7bfafc1e
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Thu Mar 8 21:05:09 2018 +0100

    [MEAR-261] - In cases where fileNameMapping is used fail the build
     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.
---
 .../ear-module/pom.xml                             |  1 -
 .../filenamemapping-usage-fail/invoker.properties  | 18 +++++++++++
 src/it/filenamemapping-usage-fail/pom.xml          | 36 ++++++++++++++++++++++
 src/it/filenamemapping-usage-fail/verify.groovy    | 32 +++++++++++++++++++
 .../war-module}/pom.xml                            | 26 +++-------------
 .../war-module/src/main/webapp/WEB-INF/web.xml     | 23 ++++++++++++++
 .../ear-module/pom.xml                             |  1 -
 .../apache/maven/plugins/ear/AbstractEarMojo.java  |  8 +++++
 src/test/resources/projects/project-035/pom.xml    |  1 -
 src/test/resources/projects/project-078/pom.xml    |  1 -
 10 files changed, 122 insertions(+), 25 deletions(-)

diff --git a/src/it/skinny-wars-filenamemapping-no-version/ear-module/pom.xml b/src/it/filenamemapping-usage-fail/ear-module/pom.xml
similarity index 94%
copy from src/it/skinny-wars-filenamemapping-no-version/ear-module/pom.xml
copy to src/it/filenamemapping-usage-fail/ear-module/pom.xml
index 8b860dd..0cfc8c5 100644
--- a/src/it/skinny-wars-filenamemapping-no-version/ear-module/pom.xml
+++ b/src/it/filenamemapping-usage-fail/ear-module/pom.xml
@@ -54,7 +54,6 @@ under the License.
             ! Only artifactId.extension
             ! no groupId/version etc. 
            -->
-          <outputFileNameMapping>@{artifactId}@@{dashClassifier?}@.@{extension}@</outputFileNameMapping>
           <fileNameMapping>no-version</fileNameMapping>
         </configuration>
       </plugin>
diff --git a/src/it/filenamemapping-usage-fail/invoker.properties b/src/it/filenamemapping-usage-fail/invoker.properties
new file mode 100644
index 0000000..f2a7dfb
--- /dev/null
+++ b/src/it/filenamemapping-usage-fail/invoker.properties
@@ -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
index 0000000..d8b6339
--- /dev/null
+++ b/src/it/filenamemapping-usage-fail/pom.xml
@@ -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
index 0000000..96b6b37
--- /dev/null
+++ b/src/it/filenamemapping-usage-fail/verify.groovy
@@ -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/skinny-wars-filenamemapping-no-version/ear-module/pom.xml b/src/it/filenamemapping-usage-fail/war-module/pom.xml
similarity index 59%
copy from src/it/skinny-wars-filenamemapping-no-version/ear-module/pom.xml
copy to src/it/filenamemapping-usage-fail/war-module/pom.xml
index 8b860dd..c6be50e 100644
--- a/src/it/skinny-wars-filenamemapping-no-version/ear-module/pom.xml
+++ b/src/it/filenamemapping-usage-fail/war-module/pom.xml
@@ -23,9 +23,9 @@ under the License.
   <modelVersion>4.0.0</modelVersion>
 
   <groupId>org.apache.maven.its.ear.skinnywars</groupId>
-  <artifactId>ear-module</artifactId>
+  <artifactId>war-module</artifactId>
   <version>1.0</version>
-  <packaging>ear</packaging>
+  <packaging>war</packaging>
 
   <dependencies>
     <dependency>
@@ -33,30 +33,14 @@ under the License.
       <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. 
-           -->
-          <outputFileNameMapping>@{artifactId}@@{dashClassifier?}@.@{extension}@</outputFileNameMapping>
-          <fileNameMapping>no-version</fileNameMapping>
-        </configuration>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-war-plugin</artifactId>
+        <version>2.1.1</version>
       </plugin>
     </plugins>
   </build>
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
index 0000000..c1af95d
--- /dev/null
+++ b/src/it/filenamemapping-usage-fail/war-module/src/main/webapp/WEB-INF/web.xml
@@ -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>
diff --git a/src/it/skinny-wars-filenamemapping-no-version/ear-module/pom.xml b/src/it/skinny-wars-filenamemapping-no-version/ear-module/pom.xml
index 8b860dd..474fcf1 100644
--- a/src/it/skinny-wars-filenamemapping-no-version/ear-module/pom.xml
+++ b/src/it/skinny-wars-filenamemapping-no-version/ear-module/pom.xml
@@ -55,7 +55,6 @@ under the License.
             ! no groupId/version etc. 
            -->
           <outputFileNameMapping>@{artifactId}@@{dashClassifier?}@.@{extension}@</outputFileNameMapping>
-          <fileNameMapping>no-version</fileNameMapping>
         </configuration>
       </plugin>
     </plugins>
diff --git a/src/main/java/org/apache/maven/plugins/ear/AbstractEarMojo.java b/src/main/java/org/apache/maven/plugins/ear/AbstractEarMojo.java
index f8285d9..5488426 100644
--- a/src/main/java/org/apache/maven/plugins/ear/AbstractEarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/ear/AbstractEarMojo.java
@@ -173,6 +173,14 @@ public abstract class AbstractEarMojo
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
+        if ( fileNameMapping != null )
+        {
+            getLog().error( "fileNameMapping has been removed with version 3.0.0. You are still using it." );
+            getLog().error( "Use outputFileNameMapping instead." );
+            throw new MojoExecutionException( "fileNameMapping has ben removed with version 3.0.0 "
+                + "but you are still using it." );
+        }
+
         final JavaEEVersion javaEEVersion = JavaEEVersion.getJavaEEVersion( version );
         getLog().debug( "Resolving artifact type mappings ..." );
         ArtifactTypeMappingService typeMappingService;
diff --git a/src/test/resources/projects/project-035/pom.xml b/src/test/resources/projects/project-035/pom.xml
index 6ee0f6f..4556e4f 100644
--- a/src/test/resources/projects/project-035/pom.xml
+++ b/src/test/resources/projects/project-035/pom.xml
@@ -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>
diff --git a/src/test/resources/projects/project-078/pom.xml b/src/test/resources/projects/project-078/pom.xml
index cbf7c74..2fd5d5d 100644
--- a/src/test/resources/projects/project-078/pom.xml
+++ b/src/test/resources/projects/project-078/pom.xml
@@ -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>

-- 
To stop receiving notification emails like this one, please contact
khmarbaise@apache.org.