Re: not able to get maven war plugin to filter out unwanted resources from my .war file.
well, i could attach an ant run script (that does the file moving) to the prepare-package phase... but unfortunately there is no post-package phase.. this means that if anyone runs 'package' the files would be moved from where they need to be during dev/test phases, and never moved back. for production .war's i strip out my environmental properties and deploy them separately, or let the server administrator deal with setting the properties... so some stuff has to be present on the classpath during dev, but not production. So, good idea in theory.. .but because of the lack of a post-package phase.. it opens the build script to behaving strangely. thanks in any case for your response ! chris -- Chris Bedford Founder Lead Lackey Build Lackey Labs: http://buildlackey.com Go Grails!: http://groovy.buildlackey.com Wayne Fay wrote: 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. Well... an obvious workaround would be to simply move the files to a directory not being packaged by Maven, or just delete them. I am guessing this is not acceptable for some reason. Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org -- 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.-tp27649724p27656990.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
Re: not able to get maven war plugin to filter out unwanted resources from my .war file.
Thanks very much to all of you for your help ! I have found a very simple answer, which suggests to me that CURRENT DOCUMENTATION IS MISSING AN IMPORTANT EXAMPLE.. how to exclude stuff from the default webapp directory. I will add this example to the maven user wiki.. but for closure (i think) on this topic, here is the trick i used: build finalNamefindFiles/finalName plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-war-plugin/artifactId version2.1-beta-1/version configuration warSourceExcludes**/*.jsp/warSourceExcludes /configuration /plugin /plugins /build i'm attaching the entire sample project as well. regards . chris -- Chris Bedford Founder Lead Lackey Build Lackey Labs: http://buildlackey.com Go Grails!: http://groovy.buildlackey.com http://old.nabble.com/file/p27661695/excludeExample.tar.gz excludeExample.tar.gz -- 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.-tp27649724p27661695.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
not able to get maven war plugin to filter out unwanted resources from my .war file.
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/excludesBut 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 groupIdorg.apache.maven.plugins/groupId artifactIdmaven-war-plugin/artifactId version2.0.2/version configuration webResources resource filteringtrue/filtering directorysrc/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