在maven中,它的“org.apache.commons.collections:commons-collections”与“commons-collections:commons-collections”相同吗?

j2g*_*2gl 0 java apache-commons maven

我刚刚在我的 pom 文件中看到 Apache commons-collections 有两个不同的组 id:

<dependency>
    <groupId>commons-collections</groupId>
    <artifactId>commons-collections</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)

和这个:

<dependency>
    <groupId>org.apache.commons.collections</groupId>
    <artifactId>commons-collections</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)

这两个是一样的吗?如果它们相同,那么按照惯例应该使用哪一个?

j2g*_*2gl 7

对于 commons-collections 版本 3,没有 groupId:org.apache.commons.collections,因此在版本 4 之前使用:

<dependency>
  <groupId>commons-collections</groupId>
  <artifactId>commons-collections</artifactId>
  <version>3.2.2</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

从版本 4 开始:

<dependency>
  <groupId>org.apache.commons</groupId>
  <artifactId>commons-collections4</artifactId>
  <version>4.1</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

请注意,工件 ID 已更改为commons-collections4

参考:https://issues.apache.org/jira/browse/COLLECTIONS-382