Can anyone tell me why I can't seem to get <excludes> to work for a
webResource?

I have the following in my pom:
<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-war-plugin</artifactId>
   <version>2.0.1</version>
   <configuration>
       <warName>${project.build.finalName}</warName>
       <warSourceExcludes>WEB-INF/lib/log4j*.jar</warSourceExcludes>
       <webResources>
           <resource>
               <directory>src/main/webapp</directory>
               <excludes>
                   <exclude>**/*.gif</exclude>
               </excludes>
           </resource>
       </webResources>
   </configuration>
</plugin>

and a directory structure like:

pom.xml
src
   main
       webapp
           images
               x.gif
               y.gif

But the gifs still get get packaged in the war in the images directory.  How
come?

Thanks,
Michael



On 2/9/07, sam <[EMAIL PROTECTED]> wrote:

HI,
   YES! I got it clearly! thanks very much!


2007/2/9, franz see <[EMAIL PROTECTED]>:
>
>
> Good day to you, ??,
>
> The default includes means *all*. Inlcuding the cvs and .whatever files
:)
> That is unless you specify an include, which would override the default.
>
> Meaning, if you only have
>
> <configuration>
>      <webResources>
>        <resource>
>          <!-- this is relative to the pom.xml directory -->
>          <directory>resource2/</directory>
>        </resource>
>      </webResources>
>    </configuration>
>
> Then all of resource2's content would be included. But if you have
>
> <configuration>
>      <webResources>
>        <resource>
>          <!-- this is relative to the pom.xml directory -->
>          <directory>resource2/</directory>
>          <!-- the list has a default value of ** -->
>          <includes>
>             <include>image2/*.jpg</include>
>          <includes>
>        </resource>
>      </webResources>
>    </configuration>
>
> Then only the jpg files under resource2/image2 would be included. So if
> you
> have something like resource2/my.txt and
> resource2/whatever-folder/some-other-folder/another.txt, those would not
> be
> included.
>
> But if you have something like
>
> <configuration>
>      <webResources>
>        <resource>
>          <!-- this is relative to the pom.xml directory -->
>          <directory>resource2/</directory>
>          <!-- the list has a default value of ** -->
>          <includes>
>             <include>image2/*.jpg</include>
>          <includes>
>          <!-- there's no default value for this -->
>          <excludes>
>             <exclude>**/*.jpg</exlude>
>          </excludes>
>        </resource>
>      </webResources>
>    </configuration>
>
> Then *none* from resource2 would be included. Why? Because it's like
> saying
> get all resource2/image2/*.jpg and from those, remove the
> resource2/**/*.jpg
> :) ( note: even if you declare the excludes first, followed by the
> includes,
> the evalution of what resources to be included would still be the same )
> ...That is why it is said there that exclude has a higher priority.
>
> Regarding the comments, "this is relative to the pom.xml directory"
merely
> says that the <directory> is relative to the base directory ( the
> directory
> containing the pom.xml ). Thus, declaring
<directory>resource2</directory>
> is like saying ${basedir}/resource2 ( where ${basedir} is the directory
> containing your pom.xml ).
>
> "the list has a default value of **" on the other hand is saying that
the
> default is
>
> <includes>
> <include>**</include>
> </includes>
>
> And by default, meaning, that is what it will use if you don't specify
> one.
>
> And as for "there's no default value for this", it's saying that the
> exclude
> tag has no default value. Meaning, if you don't specify any exclude, it
> will
> not remove anything from what you included in the directory :)
>
> Umm..did I answer your question or is there some parts that are still
> confusing? :)
>
> Cheers,
> Franz
>
>
> 秋秋 wrote:
> >
> > HI,
> >     Unfortunately, I am none the wiser for "default value",have a look
> > this
> > below:
> >  <configuration>
> >       <webResources>
> >         <resource>
> >           <!-- this is relative to the pom.xml directory -->
> >           <directory>resource2/</directory>
> >           <!-- the list has a default value of ** -->
> >           <includes>
> >              <include>image2/*.jpg</include>
> >           <includes>
> >           <!-- there's no default value for this -->
> >           <excludes>
> >              <exclude>**/*.jpg</exlude>
> >           </excludes>
> >         </resource>
> >       </webResources>
> >     </configuration>
> >
>
http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html
> ,
> >
> > 2007/2/9, Stephane Nicoll <[EMAIL PROTECTED]>:
> >>
> >> Hi,
> >>
> >>
> >> On 2/9/07, sam <[EMAIL PROTECTED]> wrote:
> >> > Hi,
> >> >    I am reading
> >> >
> >>
>
http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html
> >> ,
> >> > There
> >> > are some configuration like below:
> >> > <configuration>
> >> >         <webResources>
> >> >           <resource>
> >> >             <!-- this is relative to the pom.xml directory -->
> >> >             <directory>resource2</directory>
> >> >            * <!-- the list has a default value of ** -->
> >> > *            <includes>
> >> >                <include>**/*.jpg</include>
> >> >             <includes>
> >> >           </resource>
> >> >         </webResources>
> >> >       </configuration
> >> >
> >> > What does the "dafault value" mean?I can't understand.
> >>
> >> I guess it means that the default include value takes *all* files
> >> (minus the usual excludes such as CVS/svn hidden files, etc).
> >>
> >> HTH,
> >>
> >> Stéphane
> >>
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >
>
> --
> View this message in context:
>
http://www.nabble.com/What-is-the-default-value-for-resource--tf3199119s177.html#a8882942
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to