简体   繁体   中英

Generate multiple War from one project with Maven

I have developed a WebApp (that i'll call W)used in conjunction with 3 different applications (A,B and C).

W needs different dependencies based on which application it is used in conjunction with(for example different versions of Oracle Coherence).

At the moment I use 3 maven projects with the exact same code (the code from W) with different configuration files and different dependencies.

I would like to be able to generate my 3 wars without having 3 times the very same code (the code from W) in 3 different projects.

Is it possible?Is it possible with maven? Thanks in advance.

If these projects have anything in common, it makes most sense to have 4 war projects:

  • one for the common part, with all the common classes and resources
  • one for each deviation

Then you can use WAR Overlays to embed the common part in each project.

IMHO this is better than trying to put all the dependencies into one pom, using profiles or other tricks.

BTW this question is very similar to yours.

Why not create a library project and set this as dependency to your web applications?

So you have one code base only (in the library) and the configuration is in the 3 war projects.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM