aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes merge two war files into one Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "merge two war files into one" Watch "merge two war files into one" New topic
Author

merge two war files into one

neeravagl agl
Greenhorn

Joined: Jul 27, 2009
Posts: 2
Hi everyone,

i have two war files that i deploy separately.
now instead of going through that pain i want to make one war file, deploying which would deploy those two wars. this can make life easier for other developers where they can just deploy one war instead of multiple.
I am using maven.

can anybody give ideas to approach this.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

Yes. Don't.

By definition, a WAR is an atomic unit of deployment. The only way to make a deployable with multiple WARs in it would be to create an EAR file. That works for the full-service J2EE servers, but not for Tomcat. Tomcat can't handle EARs.

In any event, an EAR is a single webapp deployment itself, so it's not going to work very well for deploying multiple unrelated webapps.


Customer surveys are for companies who didn't pay proper attention to begin with.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

Since Maven places the contents of the WAR into target/project-name, why not create and ant script that builds a WAR from the two target/project-name directories? You could even embedded the ant script within a pom is you must use mvn.


JBoss In Action
Andres Gomez Casanova
Greenhorn

Joined: Aug 03, 2009
Posts: 1

Try to use assembly plugin.

Maven Assembly Plugin

neeravagl agl wrote:Hi everyone,

i have two war files that i deploy separately.
now instead of going through that pain i want to make one war file, deploying which would deploy those two wars. this can make life easier for other developers where they can just deploy one war instead of multiple.
I am using maven.

can anybody give ideas to approach this.


Andrés Gómez Casanova
AngocA
IBM Certified Database Administrator - DB2 9 DBA for Linux, UNIX and Windows
IBM Certified Database Administrator - DB2 UDB V8.1 for Linux, UNIX and Windows
IBM Certified Associate Developer - WebSphere Studio V5.0
zabin shariff
Greenhorn

Joined: Jun 03, 2010
Posts: 19
Hi there

I have the same issue, but I am not using Maven. I want to merge two war files by using ANT. Can anybody tell me how can I do that?
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

zabin, since your question is not the same as the original poster's please ask it in a new post.
 
 
subject: merge two war files into one