Hi, For some reason this simple little task is making my head spin... 


I am trying to filter out some files from my war using 
<webResources>/<resource>/<excludes>....    But everything i try to exclude
ends up 
being put into the .war.


There does seem to be a bug related to the issue I'm having
(http://jira.codehaus.org/browse/MWAR-198)
hopefully someone can help me with a work-around ?


Here's what i did ...

I created a simple maven web project using mvn archetype:generate.   

Then i added the following lines to the pom (in the build section):

          <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>

                    <webResources>
                        <resource>
                            <filtering>true</filtering>
                            <directory>src/main/webapp</directory>
                            <excludes>
                                <exclude>**/*.jsp</exclude>
                            </excludes>
                        </resource>
                    </webResources>

                </configuration>
            </plugin>
          </plugins>


I put in some dummy jsp's in the project for testing, like so:

cbedf...@cbedford-laptop: /tmp/trial/findFiles > find . | grep jsp

./src/main/webapp/pig/zooboo.jsp
./src/main/webapp/index.jsp




Then i ran mvn -X install  .. the debug output indicated that the maven-war
plugin 
recognized the file patterns that i specified as 'to be excluded'.. Here is
the output:

[DEBUG] Configuring mojo
'org.apache.maven.plugins:maven-war-plugin:2.0.2:war' -->
[DEBUG]   (f) archiveClasses = false
[DEBUG]   (s) classesDirectory = /tmp/trial/findFiles/target/classes
[DEBUG]   (f) filters = []
[DEBUG]   (f) outputDirectory = /tmp/trial/findFiles/target
[DEBUG]   (f) primaryArtifact = true
[DEBUG]   (s) project = MavenProject: com.lackey:findFiles:1.0-SNAPSHOT @
/tmp/trial/findFiles/pom.xml
[DEBUG]   (f) warName = findFiles
[DEBUG]   (s) warSourceDirectory = /tmp/trial/findFiles/src/main/webapp
[DEBUG]   (s) filtering = true
[DEBUG]   (s) directory = src/main/webapp
[DEBUG]   (s) excludes = [**/*.jsp]
[DEBUG]   (f) webResources = [Lorg.apache.maven.model.Resource;@1815338
[DEBUG]   (s) webappDirectory = /tmp/trial/findFiles/target/findFiles
[DEBUG]   (f) workDirectory = /tmp/trial/findFiles/target/war/work
[DEBUG] -- end configuration --




HOWEVER.. when i dumped out the contents of the .war. .the files i was
trying to 
filter were still there (as you can see below.).  




cbedf...@cbedford-laptop: /tmp/trial/findFiles > rm -rf  /tmp/jar/*
cbedf...@cbedford-laptop: /tmp/trial/findFiles > cp target/findFiles.war 
/tmp/jar
cbedf...@cbedford-laptop: /tmp/trial/findFiles > cd !$
cd /tmp/jar
cbedf...@cbedford-laptop: /tmp/jar > jar xvf findFiles.war 
  created: META-INF/
 inflated: META-INF/MANIFEST.MF
  created: pig/
  created: WEB-INF/
 inflated: pig/zooboo.jsp       <<<---
 inflated: index.jsp        <<<---
 inflated: zoo.do       
 inflated: WEB-INF/web.xml
  created: META-INF/maven/
  created: META-INF/maven/com.lackey/
  created: META-INF/maven/com.lackey/findFiles/
 inflated: META-INF/maven/com.lackey/findFiles/pom.xml
 inflated: META-INF/maven/com.lackey/findFiles/pom.properties


 
I tried using <includes>...</includes>   as well as <excludes>..  this did
not help at all.



If anyone sees a problem with how i invoked the plugin, or knows of a
work-around, 
please do let me know !  i'd be very grateful. 

thanks !
 chris 



PS:

I tried the work-around in this thread (using packagingExcludes)
http://old.nabble.com/Exclude-subversion-files-in-war-td5288845.html#a5288845

didn't work for me.

-- 
Chris Bedford

Founder & Lead Lackey
Build Lackey Labs:  http://buildlackey.com
Go Grails!: http://groovy.buildlackey.com





-- 
View this message in context: 
http://old.nabble.com/not-able-to-get-maven-war-plugin-to-filter-out-unwanted-resources-from-my-.war-file.-tp27649724p27649724.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to