mavenbuild-dependenciesmaven-reactor

maven: do not include module dependency


I've searched this for quite some time now and haven't found an answer I need.

I'm working on a project which consists of 3 modules:

  1. module (jar)
  2. server (war)
  3. client (war)

server and client depend on module, but client also depends on the fact that server is built before the client so it's WSDL's are generated before client's wsimport can import them and generate client classes.

How can I set client project to be dependent on server project in a way that server project will not be included in the client.war or overlayed in any way and only instruct Maven to build and package server before client?

And how to add a war-deploy to Glassfish action during package phase of the server project?

Right now I only have clean project which only depends on the module project which can be embedded into server and client.


Solution

  • You can add an dependency from the client-module to the server-module and set this dependency to provided (the scope). Then the server-module should not be part of the client-module.

    But I am not sure if this is the maven-way. Sounds a bit like a hack...