You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by de...@apache.org on 2011/12/06 15:25:41 UTC

svn commit: r1210930 - in /maven/plugins/trunk/maven-ear-plugin/src: it/non-skinny-wars/ it/non-skinny-wars/ear-module/ it/non-skinny-wars/war-module/ it/skinny-wars/ear-module/ main/java/org/apache/maven/plugin/ear/

Author: dennisl
Date: Tue Dec  6 14:25:40 2011
New Revision: 1210930

URL: http://svn.apache.org/viewvc?rev=1210930&view=rev
Log:
[MEAR-60] Improve support for skinny war files

o Add a configuration parameter so that skinny WARs is not the default behavior, in order to preserve backwards compatibility.

Added:
    maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/
      - copied from r1210910, maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars/
Modified:
    maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/ear-module/pom.xml
    maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/pom.xml
    maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/verify.bsh
    maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/war-module/pom.xml
    maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars/ear-module/pom.xml
    maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java

Modified: maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/ear-module/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/ear-module/pom.xml?rev=1210930&r1=1210910&r2=1210930&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/ear-module/pom.xml (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/ear-module/pom.xml Tue Dec  6 14:25:40 2011
@@ -22,7 +22,7 @@ under the License.
 <project>
   <modelVersion>4.0.0</modelVersion>
 
-  <groupId>org.apache.maven.its.ear.skinnywars</groupId>
+  <groupId>org.apache.maven.its.ear.nonskinnywars</groupId>
   <artifactId>ear-module</artifactId>
   <version>1.0</version>
   <packaging>ear</packaging>
@@ -34,7 +34,7 @@ under the License.
       <version>2.5</version>
     </dependency>
     <dependency>
-      <groupId>org.apache.maven.its.ear.skinnywars</groupId>
+      <groupId>org.apache.maven.its.ear.nonskinnywars</groupId>
       <artifactId>war-module</artifactId>
       <version>1.0</version>
       <type>war</type>

Modified: maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/pom.xml?rev=1210930&r1=1210910&r2=1210930&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/pom.xml (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/pom.xml Tue Dec  6 14:25:40 2011
@@ -22,12 +22,12 @@ under the License.
 <project>
   <modelVersion>4.0.0</modelVersion>
 
-  <groupId>org.apache.maven.its.ear.skinnywars</groupId>
+  <groupId>org.apache.maven.its.ear.nonskinnywars</groupId>
   <artifactId>pom</artifactId>
   <version>1.0</version>
   <packaging>pom</packaging>
 
-  <description>Test Skinny WAR generation</description>
+  <description>Test non Skinny WAR generation</description>
 
   <modules>
       <module>ear-module</module>

Modified: maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/verify.bsh?rev=1210930&r1=1210910&r2=1210930&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/verify.bsh (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/verify.bsh Tue Dec  6 14:25:40 2011
@@ -14,7 +14,8 @@ JarFile jar = new JarFile( jarFile );
 
 String[] includedEntries = {
     "WEB-INF/web.xml",
-    "META-INF/MANIFEST.MF"
+    "META-INF/MANIFEST.MF",
+    "WEB-INF/lib/commons-lang-2.5.jar"
 };
 for ( String included : includedEntries )
 {
@@ -25,18 +26,6 @@ for ( String included : includedEntries 
     }
 }
 
-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: " + included );
-    }
-}
-
 jar.close();
 
 

Modified: maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/war-module/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/war-module/pom.xml?rev=1210930&r1=1210910&r2=1210930&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/war-module/pom.xml (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/it/non-skinny-wars/war-module/pom.xml Tue Dec  6 14:25:40 2011
@@ -22,7 +22,7 @@ under the License.
 <project>
   <modelVersion>4.0.0</modelVersion>
 
-  <groupId>org.apache.maven.its.ear.skinnywars</groupId>
+  <groupId>org.apache.maven.its.ear.nonskinnywars</groupId>
   <artifactId>war-module</artifactId>
   <version>1.0</version>
   <packaging>war</packaging>

Modified: maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars/ear-module/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars/ear-module/pom.xml?rev=1210930&r1=1210929&r2=1210930&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars/ear-module/pom.xml (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/it/skinny-wars/ear-module/pom.xml Tue Dec  6 14:25:40 2011
@@ -47,6 +47,9 @@ under the License.
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-ear-plugin</artifactId>
         <version>@project.version@</version>
+        <configuration>
+          <skinnyWars>true</skinnyWars>
+        </configuration>
       </plugin>
     </plugins>
   </build>

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=1210930&r1=1210929&r2=1210930&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 Tue Dec  6 14:25:40 2011
@@ -195,6 +195,16 @@ public class EarMojo
     private File resourcesDir;
 
     /**
+     * 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.
+     *
+     * @parameter expression="${maven.ear.skinnyWars}" default-value="false"
+     * @since 2.7
+     */
+    private boolean skinnyWars;
+
+    /**
      * The Jar archiver.
      *
      * @component role="org.codehaus.plexus.archiver.Archiver" role-hint="jar"
@@ -326,7 +336,7 @@ public class EarMojo
                     destinationFile.mkdirs();
                     unpack( sourceFile, destinationFile );
 
-                    if ( module.changeManifestClasspath() )
+                    if ( skinnyWars && module.changeManifestClasspath() )
                     {
                         changeManifestClasspath( module, destinationFile );
                     }
@@ -338,7 +348,7 @@ public class EarMojo
                         getLog().info( "Copying artifact [" + module + "] to [" + module.getUri() + "]" );
                         FileUtils.copyFile( sourceFile, destinationFile );
 
-                        if ( module.changeManifestClasspath() )
+                        if ( skinnyWars && module.changeManifestClasspath() )
                         {
                             changeManifestClasspath( module, destinationFile );
                         }