eclipse-collections icon indicating copy to clipboard operation
eclipse-collections copied to clipboard

Add a bill of materials (BOM) POM

Open marschall opened this issue 2 years ago • 2 comments

It would be nice if the project provided a Bill of Materials (BOM) POMs that contain all the artifacts of the project.

Many projects like Spring and JUnit provide BOM POMs so that versions have to be specified only once.

Right now if somebody wants to use Eclipse Collections the version has to be specified twice.

<dependencies>
  <dependency>
    <groupId>org.eclipse.collections</groupId>
    <artifactId>eclipse-collections-api</artifactId>
    <version>11.1.0</version>
  </dependency>

  <dependency>
    <groupId>org.eclipse.collections</groupId>
    <artifactId>eclipse-collections</artifactId>
    <version>11.1.0</version>
  </dependency>

With a BOM POM the version has to be specified only once.

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.eclipse.collections</groupId>
      <artifactId>eclipse-collections-bom</artifactId>
      <version>11.1.0</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

<dependencies>
  <dependency>
    <groupId>org.eclipse.collections</groupId>
    <artifactId>eclipse-collections-api</artifactId>
  </dependency>

  <dependency>
    <groupId>org.eclipse.collections</groupId>
    <artifactId>eclipse-collections</artifactId>
  </dependency>
</dependencies>

It is a bit more verbose. There are other solutions for this like properties. Using BOM POMs is completely optional to users.

marschall avatar Aug 29 '23 16:08 marschall

If both dependencies should have the same version, you can also use properties:

<properties>
  <eclipse-collections.version>11.1.0</eclipse-collections.version>
</properties>
<dependencies>
  <dependency>
    <groupId>org.eclipse.collections</groupId>
    <artifactId>eclipse-collections-api</artifactId>
    <version>${eclipse-collections.version}</version>
  </dependency>

  <dependency>
    <groupId>org.eclipse.collections</groupId>
    <artifactId>eclipse-collections</artifactId>
    <version>${eclipse-collections.version}</version>
  </dependency>
</dependencies>

danthe1st avatar Sep 04 '23 14:09 danthe1st

Hello sir, "I'm eager to make a meaningful contribution to this codebase and help resolve any issues that may arise."

AnamuddinAhmad avatar Sep 14 '23 12:09 AnamuddinAhmad