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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:08:34+00:00 2026-06-11T10:08:34+00:00

I need to create two WAR files with two different web.xml files using Maven.

  • 0

I need to create two WAR files with two different web.xml files using Maven. The WAR files are the same otherwise.

The WAR files are created as expected, however, the second file has the same web.xml file as the first.

How can I force the Maven WAR plugin to use the second file for the second WAR? I cannot use profiles since I need both files created in one pass.

My current code:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-war-plugin</artifactId>
  <version>2.2</version>
  <configuration>
    <warSourceDirectory>${basedir}/WEB</warSourceDirectory>
    <warName>main</warName>
    <webXml>${basedir}/CONF/web.xml</webXml>
  </configuration>
  <executions>
    <execution>
      <id>hist-war</id>
      <phase>package</phase>
      <goals>
        <goal>war</goal>
      </goals>
      <configuration>
        <warName>hist</warName>
        <warSourceDirectory>${basedir}/WEB</warSourceDirectory>
        <webXml>${basedir}/CONF/hist.web.xml</webXml>
      </configuration>
    </execution>
  </executions>
</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-06-11T10:08:35+00:00Added an answer on June 11, 2026 at 10:08 am

    Use the overlay feature of the Maven WAR plugin.

    You need two WAR projects. The first is your original one, with its web.xml file in the correct place. This doesn’t have any specific needs in terms of configuration. Just ensure that it builds as you expect.

    The second only contains its POM and the alternate web.xml in the WEB-INF directory. This project’s POM must contain a dependency on the first project with type specified as war and scope specified as runtime. You should not need to explicitly configure the Maven WAR plugin.

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

Sidebar

Related Questions

I need to create a new Hash object using two arrays. But, the conditions
We are planning to create two sharepoint web applications using SharePoint 2010 Enterprise Edition.
I need to create two (or more) WPF windows from the same process. But
I need to create two controls that contain the same amound of items (a
I need to create two UIPickers Dynamically with different input values. I did n't
I have two WARS: base-overlay example-app base-overlay has XML config files in src/main/webapp/WEB-INF/spring/*.xml .
I'm trying to use a custom filename since i need to create two files
I have a newbie LINQ question. I need to create two objects of same
I need to create two pages in wordpress with two different layouts. So what
So I'm doing this project for my OO class. We need to create two

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.