Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
Maven User
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<p>I wasn't able to figure out how to do simple exclude filtering of files under my src/main/webapp directory by looking at the current usage examples on the maven war plug-in page. This simple tutorial describes how to use the warSourceExcludes tag to perform this task. [ Suggestion: the official documentation page for maven:war plugin could use a how-to example along the lines of what I present below].</p> <p>Sometimes you want to filter out stuff in your war file that want to use for development and testing, but don't want to have included in your production environment. An example is deployment environment specific properties files that you want to have on your classpath (during dev/test), but not in your .war (so that an admin can twiddle the properties without cracking open your .war).</p> <h1>Tutorial</h1> <p>Here's an example of how to this.</p> <ul class="alternate"> <li>Create a simple web application using maven archetype:</li> </ul> <ul class="alternate"> <li>mvn archetype:generate -DarchetypeGroupId=org.codehaus.groovy.maven.archetypes -DgroupId=com.foo -DartifactId=example -Dpackage=com.lackey</li> </ul> <ul class="alternate"> <li>choose option 18 (simple web app -- this will generate a simple web app project).</li> </ul> <ul class="alternate"> <li>cd example</li> </ul> <ul class="alternate"> <li>create a file src/main/webapp/server.properties</li> </ul> <ul class="alternate"> <li>run: mvn package</li> </ul> <ul class="alternate"> <li>notice you have a file target/example/server.properties -- this means server.properties will end up in your .war.</li> </ul> <ul class="alternate"> <li>now change your pom file to include the following directives in the <build> block:</li> </ul> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> <build> <finalName>findFiles</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1-beta-1</version> <configuration> <warSourceExcludes>**/*.jsp</warSourceExcludes> </configuration> </plugin> </plugins> </build> </pre></td></tr></table> <ul class="alternate"> <li>run: mvn package (again)</li> </ul> <p>notice the file target/example/server.properties is no longer present. You can check the .war as well, it won't be there, which is what you want in this case.</p> <p>Hope you will find this useful !</p> <p> - Chris</p> <p>--<br /> Chris Bedford<br /> Founder & Lead Lackey<br /> Build Lackey Labs: <a href="http://buildlackey.com/">http://buildlackey.com</a><br /> Go Grails!: <a href="http://groovy.buildlackey.com/">http://groovy.buildlackey.com</a></p>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced