File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

War depending on another war -Maven

 
A Kumar
Ranch Hand
Posts: 980
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 17616
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
A Kumar
Ranch Hand
Posts: 980
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic