在 Maven 中,它的 "org.apache.commons.collections:commons-collections" 与 "commons-collections:commons-collections" 相同?
In maven it's "org.apache.commons.collections:commons-collections" the same as "commons-collections:commons-collections"?
我刚刚在我的 pom 文件中看到 Apache commons-collections 有两个不同的组 ID:
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
还有这个:
<dependency>
<groupId>org.apache.commons.collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
这两个是一样的吗?如果它们相同,按照惯例应该使用哪一个?
对于 commons-collections 版本 3,没有 groupId:org.apache.commons.collections,因此在版本 4 之前使用:
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</dependency>
从版本 4 开始:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.1</version>
</dependency>
请注意,工件 ID 已更改为 commons-collections4。
我刚刚在我的 pom 文件中看到 Apache commons-collections 有两个不同的组 ID:
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
还有这个:
<dependency>
<groupId>org.apache.commons.collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
这两个是一样的吗?如果它们相同,按照惯例应该使用哪一个?
对于 commons-collections 版本 3,没有 groupId:org.apache.commons.collections,因此在版本 4 之前使用:
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</dependency>
从版本 4 开始:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.1</version>
</dependency>
请注意,工件 ID 已更改为 commons-collections4。