• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

War depending on another war -Maven

 
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic