dependencyManagement and scope

前端 未结 4 1406
既然无缘
既然无缘 2020-12-24 04:41

I usually put a section in parent-project/pom.xml. This section contains dec

4条回答
  •  粉色の甜心
    2020-12-24 05:04

    A little late to the party, but I'll add my two cents. I recently ran into a very difficult to debug issue. I have a parent pom for managing dependencies across multiple projects. I had it set with all the dependencies common amongst them and included groupId, artifactId, version and the most common scope. My thinking would be that I would not have to include scope in the actual dependency section in each project if it fell in line with that most common scope. The problem occurred when some of those dependencies showed up as transitive dependencies. For example if

    • A depends on B at compile scope
    • B depends on C at compile scope
    • C is set to provided in dependencyManagement of parent

    Then A's transitive dependency on C is determined to be provided. I'm not really sure if that makes sense or not, but it certainly is confusing.

    Anyway, save yourself the hassle, and leave scope out of your dependencyManagement.

提交回复
热议问题