0

I have a project with submodules.

 Proj
    ProjA
    ProjB
    ProjC

ProjA is dependent on ProjY which is dependent on ProjX.

  ProjA-->ProjY-->ProjX

I am specifying ProjY dependency in ProjA. Should I include ProjX dependency in ProjA separately? (Transitive dependency?)

And what if ProjB has dependency on ProjX? Should I include that seperately? Or I can include that in the Porj (main) level?

Kevin Rave
  • 13,876
  • 35
  • 109
  • 173

1 Answers1

0

I am specifying ProjY dependency in ProjA. Should I include ProjX dependency in ProjA separately? (Transitive dependency?)

You should not include the dependency to ProjX in ProjA since Maven takes care of that. If it does not, some configuration is wrong. Taking care of transitive dependencies is one of Mavens main features and saves you some hassle with managing your dependencies (though it can be annoying sometimes, when you get dependencies in your project that you didn't expect).

And what if ProjB has dependency on ProjX? Should I include that seperately? Or I can include that in the Porj (main) level?

Yes, you whould include the dependency in ProjB separately. To make sure you get the same version of ProjX in all your modules, you can define it in a -element in your parent pom.xml. You can then leave out the version when defining the dependency in your module pom.xml's.

Tom
  • 3,913
  • 19
  • 28
  • If I include the dependency on Main Proj Level (Top Level), then is it available to all sub-modules? – Kevin Rave Jul 01 '13 at 19:28
  • No. On parent level you can only define dependencies with their versions in a central place and all sub modules can include this dependency on their own without having to define a version. Every module must define its own dependecies explicitly. – Tom Jul 01 '13 at 19:41