aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes War depending on another war -Maven Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "War depending on another war -Maven" Watch "War depending on another war -Maven" New topic
Author

War depending on another war -Maven

A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Hi,

I am trying to create an ear that has one war dependent on another war using Maven

i am not able to compile war2 which needs some war1 classes..

Any pointers to resolve this??

Thanks in advance
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

The key word there is "dependent". Dependencies are what Maven does best.

If both projects are under Maven control, you can build the dependency using one of the repository-related goals (such as "mvn install") and it will copy the target and POM info to your repository where you can list it as a dependency in the other project in the usual way.

However, WARs can't, strictly speaking, depend on other WARs. J2EE doesn't work that way, regardless of what Maven might allow. Most commonly what people really mean is that they have common code, in which case it's usually recommended to make that common code into a JAR and make that JAR a dependency of both WARs.

Of course, if what you really want is simply to ensure that you have built the latest versions, you can define a POM project which includes both WARs as dependencies.


Customer surveys are for companies who didn't pay proper attention to begin with.
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Thank you!!!

Got it right with the dependent tag though i am not sure why it didnt come around the first time i made the changes..

I exited from the command prompt and then opened a new one and it worked fine..

I do agree that 1 war dependent on another is a bad idea but unfortunately things are that way and its out of my control and cant help it; ideally i would have preferred a dependent jar and not a war.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: War depending on another war -Maven