bom-search-maven-plugin Maven Plugin

Maven plugin to suggest which BOM artifact to use based on project dependencies.

License

License

MIT
Categories

Categories

Maven Build Tools Search Business Logic Libraries
GroupId

GroupId

com.github.olegzzz
ArtifactId

ArtifactId

bom-search-maven-plugin
Last Version

Last Version

1.5
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

bom-search-maven-plugin Maven Plugin
Maven plugin to suggest which BOM artifact to use based on project dependencies.
Project URL

Project URL

https://github.com/olegzzz/bom-search-maven-plugin
Source Code Management

Source Code Management

https://github.com/olegzzz/bom-search-maven-plugin

Download bom-search-maven-plugin

How to add to project

<plugin>
    <groupId>com.github.olegzzz</groupId>
    <artifactId>bom-search-maven-plugin</artifactId>
    <version>1.5</version>
</plugin>

Dependencies

compile (4)

Group / Artifact Type Version
ch.qos.logback : logback-classic jar 1.1.7
javax.inject : javax.inject jar 1
org.jsoup : jsoup jar 1.13.1
org.apache.maven.shared : maven-shared-incremental jar 1.1

provided (4)

Group / Artifact Type Version
org.apache.maven : maven-plugin-api jar 3.6.0
org.apache.maven : maven-core jar 3.6.0
org.apache.maven : maven-artifact jar 3.6.0
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.6.0

test (4)

Group / Artifact Type Version
org.apache.maven : maven-compat jar 3.6.0
org.apache.maven.plugin-testing : maven-plugin-testing-harness jar 3.3.0
org.mockito : mockito-core jar 3.6.28
junit : junit jar 4.13.1

Project Modules

There are no modules declared in this project.

BOM search maven plugin

Master Status CodeQL Maven Central License: MIT

Plugin to lookup bill of materials (BOM) artifacts to retrofit existing project.

Motivation

Oftentimes a project of decent size contains multiple dependencies that share the same group. More often than not those dependencies managed via a common version hardcoded into project properties. Sometimes dependency management is used. In any case, it would greatly simplify dependency management if one single BOM file can be referenced to make sure all related dependencies have specific versions.

Here is a problem: with a lot of dependencies in the pom-file it's hard to figure out if any two or more share same group or if BOM available for those groups.

This plugin tries to do just that: given the project pom to lookup possible BOM artifacts for a group of dependencies.

Configuration

Goals

search runs a search for available BOM artifacts for current project.

enforce fails the build if it finds BOM artifacts available for current project but not used.

Settings

Name Type Description
<minOccurrence> int Minimal number of dependencies that share a group to search for BOM for that group.
User property: bomsearch.minOccurrence
Default value: 2
<mavenRepoUrl> URL Maven repository URL.
User property: bomsearch.mavenRepoUrl
Default value: https://repo.maven.apache.org/maven2
<incremental> boolean Use results from previous run if possible.
User property: bomsearch.incremental
Default value: true
<lenient> boolean If set to true, enforce goal will not fail the build, but still logs warnings.
User property: bomsearch.lenient
Default value: false
<skip> boolean Disable plugin.
User property: bomsearch.skip
Default value: false

Usage

Add to <build> section of the pom-file:

<plugin>
    <groupId>com.github.olegzzz</groupId>
    <artifactId>bom-search-maven-plugin</artifactId>
    <version>1.5</version>
    <executions>
        <execution>
            <id>default-cli</id>
            <goals>
                <goal>enforce</goal>
            </goals>
        </execution>
    </executions>
</plugin>

and run mvn verify

Build log will contain warnings with suggested BOM dependencies to include into the project. Let's say a project has multiple dropwizard dependencies, then looking into the log one can pick suggested BOM file (io.dropwizard:dropwizard-bom in this case):

[INFO] --- bom-search-maven-plugin:1.5:enforce (default-cli) ---
[INFO] Following BOMs found for module: [io.dropwizard:dropwizard-bom]
[WARNING] Following BOMs available but not used: [io.dropwizard:dropwizard-bom]

Versions

Version
1.5
1.4
1.3
1.2
1.1
1.0