Author: snicoll
Date: Wed Nov  1 09:33:24 2006
New Revision: 470001

URL: http://svn.apache.org/viewvc?view=rev&rev=470001
Log:
MEAR-33: unpack flag can be set to false even if the artifact is witin the 
unpack list.

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/EarModule.java
    
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarMojo.java

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?view=diff&rev=470001&r1=470000&r2=470001
==============================================================================
--- 
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
 Wed Nov  1 09:33:24 2006
@@ -50,7 +50,7 @@
 
     protected Boolean excluded = Boolean.FALSE;
 
-    protected Boolean unpack = Boolean.FALSE;
+    protected Boolean unpack = null;
 
     /**
      * Empty constructor to be used when the module
@@ -190,9 +190,9 @@
         return excluded.booleanValue();
     }
 
-    public boolean shouldUnpack()
+    public Boolean shouldUnpack()
     {
-        return unpack.booleanValue();
+        return unpack;
     }
 
     public String toString()

Modified: 
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarModule.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarModule.java?view=diff&rev=470001&r1=470000&r2=470001
==============================================================================
--- 
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarModule.java
 (original)
+++ 
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarModule.java
 Wed Nov  1 09:33:24 2006
@@ -66,10 +66,13 @@
     /**
      * 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
      */
-    public boolean shouldUnpack();
+    public Boolean shouldUnpack();
 
     /**
      * Appends the <tt>XML</tt> representation of this module.

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?view=diff&rev=470001&r1=470000&r2=470001
==============================================================================
--- 
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
 Wed Nov  1 09:33:24 2006
@@ -22,7 +22,6 @@
 import org.apache.maven.plugin.MojoFailureException;
 import org.codehaus.plexus.archiver.ArchiverException;
 import org.codehaus.plexus.archiver.UnArchiver;
-import org.codehaus.plexus.archiver.Archiver;
 import org.codehaus.plexus.archiver.jar.JarArchiver;
 import org.codehaus.plexus.archiver.manager.ArchiverManager;
 import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
@@ -161,13 +160,13 @@
                 String type = (String) it.next();
                 if ( !EarModuleFactory.standardArtifactTypes.contains( type ) )
                 {
-                    throw new MojoExecutionException( "Invalid type["+type+"] 
supported types are "+ EarModuleFactory.standardArtifactTypes);
+                    throw new MojoExecutionException(
+                        "Invalid type[" + type + "] supported types are " + 
EarModuleFactory.standardArtifactTypes );
                 }
             }
-            getLog().debug( "Initialized unpack types "+ unpackTypesList);
+            getLog().debug( "Initialized unpack types " + unpackTypesList );
         }
 
-
         // Copy modules
         try
         {
@@ -182,7 +181,11 @@
                         "; Did you package/install " + module.getArtifact() + 
"?" );
                 }
 
-                if ( unpackTypesList.contains( module.getType()) || 
module.shouldUnpack() )
+                // 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
+                if ( ( unpackTypesList.contains( module.getType() ) &&
+                    ( module.shouldUnpack() == null || 
module.shouldUnpack().booleanValue() ) ) ||
+                    ( module.shouldUnpack() != null && 
module.shouldUnpack().booleanValue() ) )
                 {
                     getLog().info( "Copying artifact[" + module + "] to[" + 
module.getUri() + "] (unpacked)" );
                     // Make sure that the destination is a directory to avoid 
plexus nasty stuff :)


Reply via email to