Aimee Vostri
Aimee Vostri

Reputation: 1

Skip Maven Dependency for build

So, i have 3 projects A, B and C. A is a testing framework that is used as a dependency in B. C is a maven plugin that makes an installable archive with everything from B(C is added as a build plugin in B's pom.xml, when you run mvn install in B project, the C plugin will try and take everything from B (including dependencies) and makes an installable archive with everything).

My problem is that A cannot be added to the archive because it is only used for testing purposes, so I have to skip it somehow. But, if I skip A, I also skip all the dependencies that A has and that I might need at some point. So I will need to exclude the dependencies that are only used by A project, is there anyway I can do that?

Or maybe something easier than that: I don't know how to read A's dependency from C. I can read B's dependencies in C plugin, but I don't know how to get all A's dependency there also(like a tree).

Upvotes: 0

Views: 210

Answers (1)

J Fabian Meier
J Fabian Meier

Reputation: 35805

B should declare all its dependencies. It should not rely on A "bringing in" dependencies. So declare A as test dependency, and add all dependencies of A that you need in B to B itself.

Upvotes: 1

Related Questions