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 8017541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:52:29+00:00 2026-06-04T20:52:29+00:00

I have this setup currently: Project A outputs a war file – has a

  • 0

I have this setup currently:

Project A outputs a war file – has a configuration file (WEB-INF/web.xml). We’ve been delivering this with a commented out section of configuration which gets uncommented manually when the project is deployed in a particular environment.

Needs of the project have changed – and I need Project A to be built without that section of configuration entirely; and I need another project (Project B) to be built WITH that section of configuration (enabled, not commented out).

Rather than having the file exist in both projects (dual maintenance), I had hoped I could have Project B depend on Project A (via war overlay), and then use the maven-config-processor-plugin to add my special config to WEB-INF/web.xml, then re-package the war file.

This doesn’t seem to work – though – the config modification can work if the target already exists (i.e. after the previous run), but when I run everything together, the overlay and repackaging into the new war happens together – and I can’t figure out any way to make the config-processor plugin operate in the middle. Basically, the default order ends up being “config-processor” (which fails because the overlay hasn’t happened yet), then “war” (all as one unit). I can’t make the config-processor happen after the overlay but before the war is fully packaged.

Multiple people on the internets have asked over the last few years if there is a way to inject a plugin in between the “unpack the overlay” and “repack the war file” steps, but nobody has seemingly answered this definitively either way. Any ideas?

  • 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-06-04T20:52:30+00:00Added an answer on June 4, 2026 at 8:52 pm

    Since war overlays and war packaging all seems to happen as part of a single goal, I don’t think there’s a way to get in the middle of it. As a workaround, you could extract web.xml in an earlier phase and process it. The maven-dependency-plugin can be used in Project B to extract web.xml from Project A into a work directory, then run maven-config-processor-plugin on web.xml and place the result somewhere else, then instruct maven-war-plugin to include that processed web.xml before overlays. In Project B’s POM:

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.4</version>
            <executions>
                <!-- Extract web.xml from Project A -->
                <execution>
                    <id>unpack-webxml</id>
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>unpack</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>your.group</groupId>
                                <artifactId>project.a</artifactId>
                                <version>...</version>
                                <type>war</type>
                                <overWrite>true</overWrite>
                                <outputDirectory>${project.build.directory}/myconfig/work</outputDirectory>
                                <includes>WEB-INF/web.xml</includes>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>com.google.code.maven-config-processor-plugin</groupId>
            <artifactId>maven-config-processor-plugin</artifactId>
            <version>2.0</version>
            <executions>
                <!-- Process extracted web.xml and place in temp build directory -->
                <execution>
                    <id>process-webxml</id>
                    <goals>
                        <goal>process</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${project.build.directory}/myconfig/build</outputDirectory>
                        <transformations>
                            <transformation>
                                <input>${project.build.directory}/myconfig/work/WEB-INF/web.xml</input>
                                <output>WEB-INF/web.xml</output>
                                <!-- your transformation config -->
                            </transformation>
                        </transformations>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
                <webResources>
                    <!-- Instruct war plugin to include temp build directory in webapp -->
                    <resource>
                        <directory>${project.build.directory}/myconfig/build</directory>
                        <includes>
                            <include>**</include>
                        </includes>
                    </resource>
                </webResources>
                <overlays>
                    <!-- Overlay customization if needed -->
                </overlays>
            </configuration>
        </plugin>
    </plugins>
    

    As far as I can tell, the war plugin includes webResources first, followed by src/main/webapp, followed by overlays.

    I’m not familiar with maven-config-processor-plugin, so I apologize if my configuration there is not correct.

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

Sidebar

Related Questions

I need to call exec and build a wix setup project. Currently I have
We have a setup project that currently adds Project Output's from different visual studio
This is my first serious project using NHibernate and I have setup log4net to
I'm currently working on a fairly large project that has been migrated from Ant
If i have a project which has a text file inside of it and
I currently have a single solution with a single project and this generates executable
I have a TeamCity project setup that currently looks at the trunk of my
I have this setup in my models: class Author(models.Model): name = models.CharField(max_length=100) class Topic(models.Model):
On my portfolio page I have this setup: <div id=portfolio> <ul id=sites> <li> <h3><a
I have this following setup, a textarea named with some data in it that

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.