Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6970577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:43:38+00:00 2026-05-27T16:43:38+00:00

I need to produce different WARs from a Maven project, according to values that

  • 0

I need to produce different WARs from a Maven project, according to values that vary between profiles.

For some files, I have default values that may be overwritten by configuration. For example, I might have an images folder with default images, and the “prof1” profile might overwrite some of them, while the “prof2” profile might use only the default images.

I’m having troubles implementing this using the Maven War Plugin. I listed the different webresources in the config shown below, but the values are not overridden – instead, the default images are always shown. It’s probably relevant that I placed the web application files into the /Webcontent/ directory, instead of /src/main/webapp; I could switch back if needed.

Here’s my maven war plugin configuration:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1.1</version>
    <configuration>
        <overwrite>true</overwrite>
        <webResources>  
            <resource>
                <directory>${basedir}/WebContent</directory>
                <excludes>
                    <exclude>**/resources/*</exclude>
                </excludes>
            </resource> 
            <resource>
                <directory>${basedir}/WebContent/resources</directory>
                <targetPath>WEB-INF/classes</targetPath>
                <filtering>true</filtering>
            </resource>
            <resource >
                <directory>${basedir}/version/${profile.name}</directory>
            </resource>
        </webResources>
        <archiveClasses>false</archiveClasses>
        <archive>
            <manifest>
                <addClasspath>true</addClasspath>
                <classpathPrefix />
            </manifest>
        </archive>
    </configuration>
</plugin>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:43:39+00:00Added an answer on May 27, 2026 at 4:43 pm

    I had the same problem, apparently resources in the WebContent portion of your app are not handled by this kind of filtering, I used the approach where you copy resources for a particular profile to a temporary build folder,and then combine it with the war, it’s outlined here:

    http://edeustace.wordpress.com/2010/07/08/processing-resources-with-the-maven-war-plugin/

    and that worked great-

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a small .NET application that can produce SWF files, and I need
I have two systems that produce different types of messages that I need to
I need to produce somewhat complicated PDFs from a Rails app - tables with
I need to have a formula produce a null in some cases, numeric in
I need to produce an array that is formatted as follows: Array( Array([100000116287110]=> Array([name]
I have a problem where I need to select data from three different tables,
I need an application to produce a PDF file using several different custom templates.
I have a template string and an array of parameters that come from different
I need to compare two directories, and produce some sort of structured output (text
short: I need to filter all .java files and every META-INF folder from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.