Maven-我应该包括导入的库包含的依赖项吗

时间:2018-11-30 12:27:21

标签: java maven dependency-management

假设我有一个工件my-project-core,其中包含与库的某些依赖项:

<artifactId>my-project-core</artifactId>
<name>CORE</name>

...

<dependency>
    <groupId>com.bun.puffy</groupId>
    <artifactId>just-the-lib</artifactId>
    <version>1.0.0</version>
</dependency>

我想在与my-project-core有依赖性的新项目中使用它

<artifactId>new-project-using-core</artifactId>
<name>NEW PROJECT USING CORE</name>

...

<dependency>
    <groupId>com.bun.puffy</groupId>
    <artifactId>my-project-core</artifactId>
    <version>1.0.0</version>
</dependency>

<!-- should I also add this ?
<dependency>
    <groupId>com.bun.puffy</groupId>
    <artifactId>just-the-lib</artifactId>
    <version>1.0.0</version>
</dependency>
-->

我应该在新项目中添加对just-the-lib的依赖关系还是应该不这样做,而是依赖于my-project-core的依赖关系?什么是利弊?

0 个答案:

没有答案