Skip to content

rjcoulter22/test-pom-artifact

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

test-pom-artifact

A minimal proof-of-concept demonstrating how to use Maven BOM (Bill of Materials) imports for dependency version management.

What This Demonstrates

This PoC shows how to import a pom type artifact to manage dependency versions centrally. Specifically, it uses the Apache Camel Spring Boot dependencies BOM to manage versions without declaring them in individual dependencies.

How It Works

Step 1: Import the BOM in <dependencyManagement>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.apache.camel.springboot</groupId>
            <artifactId>camel-spring-boot-dependencies</artifactId>
            <version>4.8.0</version>
            <type>pom</type>              <!-- ⚡ Key: type is 'pom' -->
            <scope>import</scope>          <!-- ⚡ Key: scope is 'import' -->
        </dependency>
    </dependencies>
</dependencyManagement>

Step 2: Declare Dependencies Without Versions

<dependencies>
    <dependency>
        <groupId>org.apache.camel.springboot</groupId>
        <artifactId>camel-http-starter</artifactId>
        <!-- ⚡ No version! Resolved from BOM to 4.8.0 -->
    </dependency>
    
    <dependency>
        <groupId>org.apache.camel.springboot</groupId>
        <artifactId>camel-jackson-starter</artifactId>
        <!-- ⚡ No version! Also resolved from BOM to 4.8.0 -->
    </dependency>
</dependencies>

Step 3: View the Resolved Versions

mvn dependency:tree

Result:

com.example:test-pom-artifact:jar:1.0.0-SNAPSHOT
+- org.apache.camel.springboot:camel-http-starter:jar:4.8.0:compile
|  +- org.apache.camel:camel-http:jar:4.8.0:compile
|  |  +- org.apache.camel:camel-http-common:jar:4.8.0:compile
|  |  +- org.apache.camel:camel-file:jar:4.8.0:compile
|  |  \- jakarta.servlet:jakarta.servlet-api:jar:6.0.0:compile
|  +- org.apache.httpcomponents.client5:httpclient5:jar:5.3.1:compile
|  \- org.apache.camel.springboot:camel-core-starter:jar:4.8.0:compile
|     +- org.apache.camel:camel-core-engine:jar:4.8.0:compile
|     |  +- org.apache.camel:camel-api:jar:4.8.0:compile
|     |  \- org.apache.camel:camel-util:jar:4.8.0:compile
|     \- org.apache.camel.springboot:camel-spring-boot:jar:4.8.0:compile
|        +- org.apache.camel:camel-spring:jar:4.8.0:compile
|        \- org.apache.camel:camel-health:jar:4.8.0:compile
\- org.apache.camel.springboot:camel-jackson-starter:jar:4.8.0:compile
   \- org.apache.camel:camel-jackson:jar:4.8.0:compile
      \- com.fasterxml.jackson.core:jackson-databind:jar:2.17.2:compile

Key observations:

  • ✅ All org.apache.camel* artifacts use version 4.8.0 (managed by BOM)
  • ✅ Transitive dependencies also properly versioned
  • ✅ No version conflicts

Why Use a BOM?

  1. Centralized version management - Change one property to upgrade all related dependencies
  2. No version conflicts - All components guaranteed to be compatible versions
  3. Cleaner pom.xml - No version numbers scattered throughout dependencies

References

About

Test to see how POM artifacts resolve

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages