开发者

excluding dependency from common project

I have three projects right now that form a dependency chain, Project A depends on Project B depends on Project C.

In Project B, I am attempting to exclude the xml-apis jar that is causing problems with weblogic. I'm doing so like this in Project B's POM:

<dependency>
    <groupId>com.company</groupId>
    <artifactId>projectC</artifactId>
    <version>1.0.3-SNAPSHOT</version>
    <exclusions>
        <exclusion>
            <artifactId>xml-apis</artifactId>
            <groupId>xml-apis</groupId>
        </exclusion>
    </exclusions>
</dependency>

However, the xml-apis artifact is still being included when I package Project A. What is the correct way to exclude this xml-apis jar? Should I find exactly what package in Project C is bringing this in and mark it as provided there?

Right now my workaround is to just list the above dependency in Proj开发者_开发百科ect A's POM.

EDIT:

Project A has a dependency on Project B and Project C. Since Project B has a dependency on Project C and Project B would never be used without Project C I was hoping to not have to include the dependency information in Project A and Project B.


Project B's pom states that it uses Project C, except that it (Project B) doesn't need the xml-apis.

Project A's pom also states that it uses Project C, but without saying it doesn't need xml-apis, therefore maven assumes it does need them.

You can either add the dependency on xml-apis to Project A with a scope of provided, meaning that yes you need them but you're going to make sure an implementation is available and you don't want maven to include them, or you could remove Project A's dependency on Project C.


Project B does not depend on A. Insert the excludes statement in b's pom on the C dependency.


The question is not clear, maybe clear but confusing. Just do mvn dependency:tree, check and exclude the dependency you need in the correct pom, whether it is A or B or C.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜