【发布时间】:2015-04-02 15:50:54
【问题描述】:
我有一个 pom 可以在 pom 中不定义依赖版本的情况下正常工作,而另一个没有依赖版本的 pom 则无法正常工作。
有效的:
<project>
<parent>
<artifactId>artifact-parent</artifactId>
<groupId>group-parent</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>group-a</groupId>
<artifactId>artifact-a</artifactId>
</dependency>
<dependency>
<groupId>group-a</groupId>
<artifactId>artifact-b</artifactId>
</dependency>
</dependencies>
</project>
这个不起作用:
<project>
<dependencies>
<dependency>
<groupId>group-a</groupId>
<artifactId>artifact-a</artifactId>
</dependency>
<dependency>
<groupId>group-a</groupId>
<artifactId>artifact-b</artifactId>
</dependency>
</dependencies>
</project>
这两个似乎唯一不同的是:
<parent>
<artifactId>artifact-parent</artifactId>
<groupId>group-parent</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
第二个不起作用它对我来说似乎很好,但我的问题是为什么第一个起作用?
这个三位一体代表了具体项目在时间上的坐标, 将其划分为该项目的依赖项。
所以我的问题是第一个是如何工作的?
【问题讨论】:
标签: maven dependencies pom.xml