Pregunta

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?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top