newLearner
newLearner

Reputation: 767

How to handle dependency in maven project?

I have a project A which has B as parent in it's pom.xml and I am getting all the dependencies. Now I need a class P which has been defined in project X and I can use that only if I include Y as a parent (so I think it is case of transitive dependency, though I am not sure if this is a correct understanding).

Now as my project A already has a parent defined so I cannot define Y in the same pom.xml and hence I am not able to get the class P in project A. I tried adding X as normal dependency but I am getting cannot resolve dependency while building project.

How can I handle this ?

Upvotes: 1

Views: 94

Answers (1)

J Fabian Meier
J Fabian Meier

Reputation: 35903

If you want to use a class of X, you need to declare X as dependency, not as parent.

Upvotes: 1

Related Questions