The whole problem with the old overlay was that you didn't have enough control. 
I think we should err on the side of giving control at the expense of some 
extra configuration. Not doing this leaves too much to chance and you can't 
guarantee repeatability.

-----Original Message-----
From: Stephane Nicoll [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 08, 2007 9:12 AM
To: Maven Developers List
Subject: Re: svn commit: r582805 - in 
/maven/plugins/trunk/maven-war-plugin/src: 
main/java/org/apache/maven/plugin/war/overlay/ site/apt/ 
test/java/org/apache/maven/plugin/war/ 
test/java/org/apache/maven/plugin/war/stub/

On 10/8/07, olivier lamy <[EMAIL PROTECTED]> wrote:
> Ok, I see.
> But if I had a zip overlay manually : do I win against the global for this ?

had -> add ?

Well, no. The flag disables the behavior altogether. If it's
activated, all overlays are taken (and we can control overlay per
overlay with the "skip" attribute of the overlay config).

Now, maybe it does not make sense. I am just wondering if users will
not complain about the fact to add an entry for each zip overlay.
They'll have to do it anyway for the targetPath thingy.

Well, let's leave it like this for the alpha. We'll change if someone
complains :)

Thanks,
Stéphane
>
>
> --
> Olivier
>
> 2007/10/8, Stephane Nicoll <[EMAIL PROTECTED]>:
> >
> > Olivier,
> >
> > The idea we put forward was the presence of a flag that enable /
> > disable the zip handling altogether. Having to declare every overlay
> > when you actually want this as the default is a bit painful.
> >
> > Please read the discussion in the Jira issue (Unless you disagree with
> > the proposal).
> >
> > Thanks,
> > Stéphane
> >
> >
> >
> > ---------- Forwarded message ----------
> > From: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> > Date: Oct 8, 2007 2:44 PM
> > Subject: svn commit: r582805 - in
> > /maven/plugins/trunk/maven-war-plugin/src:
> > main/java/org/apache/maven/plugin/war/overlay/ site/apt/
> > test/java/org/apache/maven/plugin/war/
> > test/java/org/apache/maven/plugin/war/stub/
> > To: [EMAIL PROTECTED]
> >
> >
> > Author: olamy
> > Date: Mon Oct  8 05:44:27 2007
> > New Revision: 582805
> >
> > URL: http://svn.apache.org/viewvc?rev=582805&view=rev
> > Log:
> > [MWAR-104] to preserve backward comp. zip overlay must be off by default
> >   add some notes on this in overlays.apt.
> >
> > Modified:
> >
> >     
> > maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/OverlayManager.java
> >     maven/plugins/trunk/maven-war-plugin/src/site/apt/overlays.apt
> >
> >     
> > maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarZipTest.java
> >
> >     
> > maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/stub/ZipArtifactStub.java
> >
> > Modified:
> > maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/OverlayManager.java
> > URL:
> > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/OverlayManager.java?rev=582805&r1=582804&r2=582805&view=diff
> >
> > ==============================================================================
> > ---
> > maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/OverlayManager.java
> > (original)
> > +++
> > maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/overlay/OverlayManager.java
> > Mon Oct  8 05:44:27 2007
> > @@ -23,6 +23,7 @@
> > import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
> > import org.apache.maven.plugin.war.Overlay;
> > import org.apache.maven.project.MavenProject;
> > +import org.codehaus.plexus.util.StringUtils;
> >
> > import java.util.ArrayList;
> > import java.util.Iterator;
> > @@ -41,10 +42,6 @@
> >
> >      private final MavenProject project;
> >
> > -    //private final List warArtifactss;
> > -
> > -    //private final List zipArtifacts;
> > -
> >      private final List artifactsOverlays;
> >
> >      /**
> > @@ -70,29 +67,12 @@
> >          }
> >          this.project = project;
> >
> > -        //this.warArtifacts = getOverlaysAsArtifactsWithType( "war" );
> > -
> > -        //this.zipArtifacts = getOverlaysAsArtifactsWithType( "zip" );
> > -
> >          this.artifactsOverlays = getOverlaysAsArtifacts();
> >
> >          // Initialize
> >          initialize( defaultIncludes, defaultExcludes );
> >
> >      }
> > -
> > -    /**
> > -     * Returns the war artifactst attachted to the project.
> > -     *
> > -     * @return a list of war Artifact
> > -     */
> > -    /*
> > -    public List getWarArtifacts()
> > -    {
> > -        return warArtifacts;
> > -    }
> > -    */
> > -
> >
> >
> >      /**
> > @@ -247,12 +227,43 @@
> >          while ( it.hasNext() )
> >          {
> >              Artifact artifact = (Artifact) it.next();
> > -            if ( !artifact.isOptional() && filter.include( artifact )
> > -                && ( "war".equals( artifact.getType() ) ||
> > "zip".equals( artifact.getType() ) ) )
> > +            if ( !artifact.isOptional() && filter.include( artifact )
> > && ( "war".equals( artifact.getType() ) ) )
> > +            {
> > +                result.add( artifact );
> > +            }
> > +            // zip overlay is disabled by default except if user want
> > it in the mojo's overlays
> > +            if ( !artifact.isOptional() && filter.include( artifact )
> > && ( "zip".equals( artifact.getType() ) ) )
> >              {
> > +                Overlay overlay = getAssociatedOverlay( artifact );
> > +                // if the overlay doesn't exists we create a new with
> > skip by default
> > +                if ( overlay != null )
> > +                {
> > +                    Overlay zipOverlay = new DefaultOverlay(artifact);
> > +                    zipOverlay.setSkip( true );
> > +                    this.overlays.add( zipOverlay );
> > +                }
> >                  result.add( artifact );
> >              }
> >          }
> >          return result;
> > +    }
> > +
> > +    private Overlay getAssociatedOverlay( Artifact artifact )
> > +    {
> > +        if ( this.overlays == null )
> > +        {
> > +            return null;
> > +        }
> > +        for ( Iterator iterator = this.overlays.iterator();
> > iterator.hasNext(); )
> > +        {
> > +            Overlay overlay = (Overlay) iterator.next();
> > +            if ( StringUtils.equals( artifact.getGroupId(),
> > overlay.getGroupId() )
> > +                && StringUtils.equals( artifact.getArtifactId(),
> > overlay.getArtifactId() )
> > +                && StringUtils.equals( artifact.getClassifier(),
> > overlay.getClassifier() ))
> > +            {
> > +                return overlay;
> > +            }
> > +        }
> > +        return null;
> >      }
> > }
> >
> > Modified: maven/plugins/trunk/maven-war-plugin/src/site/apt/overlays.apt
> > URL:
> > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/site/apt/overlays.apt?rev=582805&r1=582804&r2=582805&view=diff
> >
> > ==============================================================================
> > --- maven/plugins/trunk/maven-war-plugin/src/site/apt/overlays.apt
> > (original)
> > +++ maven/plugins/trunk/maven-war-plugin/src/site/apt/overlays.apt Mon
> > Oct  8 05:44:27 2007
> > @@ -333,4 +333,34 @@
> >    [...]
> > +-----------------+
> >
> > +* Zip dependencies with overlays
> >
> > +  The plugin now handles zip dependencies and can extract content to
> > the webapp directory.
> > +
> > +  <<To preserve backward compatibility and some user workaround this
> > features is disabled by default.>>
> > +
> > +  To enable this you have to declare your zip dependency in the
> > overlays mojo configuration section.
> > +
> > +  A sample configuration for a zip (groupId : zipGroupId, artifactId :
> > zipId).
> > +  With this configuration, the zip content will be in
> > webappDirectory/scripts/.
> > +
> > ++-----------------+
> > + [...]
> > +   <plugins>
> > +     <plugin>
> > +       <groupId>org.apache.maven.plugins</groupId>
> > +       <artifactId>maven-war-plugin</artifactId>
> > +       <configuration>
> > +         <overlays>
> > +            <overlay>
> > +              <groupId>zipGroupId</groupId>
> > +              <artifactId>zipId</artifactId>
> > +              <!-- optionnal the path to put zip content -->
> > +              <targetPath>scripts</targetPath>
> > +            </overlay>
> > +          </overlays>
> > +       </configuration>
> > +      </plugin>
> > +   </plugins>
> > + [...]
> > ++-----------------+
> >
> > Modified:
> > maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarZipTest.java
> > URL:
> > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarZipTest.java?rev=582805&r1=582804&r2=582805&view=diff
> >
> > ==============================================================================
> > ---
> > maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarZipTest.java
> > (original)
> > +++
> > maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/WarZipTest.java
> > Mon Oct  8 05:44:27 2007
> > @@ -89,11 +89,14 @@
> >          return webAppDirectory;
> >      }
> >
> > -    public void testOneZip()
> > +    public void testOneZipWithNoSkip()
> >          throws Exception
> >      {
> >          File webAppDirectory = configureMojo( "one-zip" );
> >
> > +        Overlay overlay = new DefaultOverlay( buildZipArtifact() );
> > +        //overlay.setSkip( false );
> > +        mojo.addOverlay( overlay );
> >          mojo.execute();
> >
> >          File foo = new File( webAppDirectory, "foo.txt" );
> > @@ -115,7 +118,7 @@
> >          File webAppDirectory = configureMojo(
> > "one-zip-overlay-targetPath" );
> >
> >          Overlay overlay = new DefaultOverlay( buildZipArtifact() );
> > -        //overlay.setIncludes( new String[] {"**/**"} );
> > +        overlay.setSkip( false );
> >          overlay.setTargetPath( "overridePath" );
> >          mojo.addOverlay( overlay );
> >
> > @@ -134,17 +137,31 @@
> >          assertTrue( "bar/bar.txt not a file", bar.isFile() );
> >      }
> >
> > -    public void testOneZipWithWithSkip()
> > +    public void testOneZipDefaultSkip()
> >          throws Exception
> >      {
> >          File webAppDirectory = configureMojo( "one-zip-overlay-skip" );
> >
> > +        mojo.execute();
> > +
> > +        assertZipContentNotHere( webAppDirectory );
> > +    }
> > +
> > +    public void testOneZipWithWithForceSkip()
> > +        throws Exception
> > +    {
> > +        File webAppDirectory = configureMojo( "one-zip-overlay-skip" );
> >          Overlay overlay = new DefaultOverlay( buildZipArtifact() );
> >          overlay.setSkip( true );
> >          mojo.addOverlay( overlay );
> >
> >          mojo.execute();
> > +        assertZipContentNotHere( webAppDirectory );
> >
> > +    }
> > +
> > +    protected void assertZipContentNotHere(File webAppDirectory)
> > +    {
> >          File foo = new File( webAppDirectory.getPath() +
> > File.separatorChar + "overridePath", "foo.txt" );
> >          assertFalse( "foo.txt exists", foo.exists() );
> >          assertFalse( "foo.txt a file", foo.isFile() );
> > @@ -156,5 +173,5 @@
> >          File bar = new File( barDirectory, "bar.txt" );
> >          assertFalse( "bar/bar.txt exists", bar.exists() );
> >          assertFalse( "bar/bar.txt is a file", bar.isFile() );
> > -    }
> > +    }
> > }
> >
> > Modified:
> > maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/stub/ZipArtifactStub.java
> > URL:
> > http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/stub/ZipArtifactStub.java?rev=582805&r1=582804&r2=582805&view=diff
> >
> > ==============================================================================
> > ---
> > maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/stub/ZipArtifactStub.java
> > (original)
> > +++
> > maven/plugins/trunk/maven-war-plugin/src/test/java/org/apache/maven/plugin/war/stub/ZipArtifactStub.java
> > Mon Oct  8 05:44:27 2007
> > @@ -37,6 +37,12 @@
> >          this.zip = zipFile;
> >      }
> >
> > +
> > +    public String getId()
> > +    {
> > +        return null;
> > +    }
> > +
> >      public ArtifactHandler getArtifactHandler()
> >      {
> >          return super.getArtifactHandler();
> >
> >
> >
> >
> > --
> > Large Systems Suck: This rule is 100% transitive. If you build one,
> > you suck" -- S.Yegge
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Olivier
>


-- 
Large Systems Suck: This rule is 100% transitive. If you build one,
you suck" -- S.Yegge

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to