Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix BOMs not being inlined #612

Merged
merged 1 commit into from
Sep 13, 2023
Merged

Fix BOMs not being inlined #612

merged 1 commit into from
Sep 13, 2023

Conversation

melix
Copy link
Contributor

@melix melix commented Sep 13, 2023

This commit fixes a problem where some aliases were not inlined in the platform BOM. For example, the junit BOM dependency is missing from the platform, despite micronaut-test including it.

The reason is that in micronaut-test, junit is a managed version, but for a BOM (alias boms-...). There were 2 ways to fix this problem:

  1. include all versions from the embedded catalog during inlining. This worked, but with a drawback: only the version would be included (e.g junit), but no library would be present. Which means that the user would still have to figure out the coordinates of, say, the junit BOM.
  2. the fix in this PR, which is to include boms- dependencies into the generated catalog. This works well and should be backwards compatible, since we're only adding new entries to the catalogs.

It's worth noting that we don't do this for boms-micronaut- entries, which, in this case, are available as independent version catalogs. Including them would lead to potentially many BOM inclusion conflicts, since many projects may include other Micronaut BOMs.

Fixes #611

This commit fixes a problem where some aliases were not inlined
in the platform BOM. For example, the `junit` BOM dependency
is missing from the platform, despite `micronaut-test` including
it.

The reason is that in `micronaut-test`, `junit` is a managed
version, but for a BOM (alias `boms-...`). There were 2 ways
to fix this problem:

1. include all versions from the embedded catalog during
inlining. This worked, but with a drawback: only the version
would be included (e.g `junit`), but no library would be present.
Which means that the user would still have to figure out the
coordinates of, say, the junit BOM.
2. the fix in this PR, which is to include `boms-` dependencies
into the generated catalog. This works well and should be
backwards compatible, since we're only adding new entries to
the catalogs.

It's worth noting that we _don't_ do this for `boms-micronaut-`
entries, which, in this case, are available as independent
version catalogs. Including them would lead to potentially
many BOM inclusion conflicts, since many projects may include
other Micronaut BOMs.

Fixes #611
@melix melix added the bug Something isn't working label Sep 13, 2023
@melix melix added this to the 6.5.7 milestone Sep 13, 2023
@melix melix requested a review from timyates September 13, 2023 08:33
@melix melix self-assigned this Sep 13, 2023
@timyates
Copy link
Contributor

So after this change, the only difference in the catalogs is:

Module Extra catalog entries
micronaut-test boms-junit, boms-kotest, boms-rest, and boms-spock
micronaut-platform boms-junit5, boms-testcontainers

There's no junit version in the platform catalog, nor mention of the junit bom from the micronaut-test catalog

Is that right? I'm confused...

@melix
Copy link
Contributor Author

melix commented Sep 13, 2023

The micronaut-test BOM now includes in the [versions] section the junit entry and the junit bom in libraries:

[versions]
junit = "5.10.0"
...
[libraries]
...
boms-junit = {group = "org.junit", name = "junit-bom", version.ref = "junit" }

The generated platform file after this change has:

[versions]
...
jte = "2.3.2"
junit = "5.10.0" # <--- this is new
junit5 = "5.10.0"

[libraries]
...
azure-functions-java-library = {group = "com.microsoft.azure.functions", name = "azure-functions-java-library", version.ref = "azure-functions-java-library" }
boms-junit = {group = "org.junit", name = "junit-bom", version.ref = "junit" } # <--- this is new too

@timyates
Copy link
Contributor

Gah, I hadn't added mavenLocal to the micronaut-platform build, so resolution was failing silently running ./gradlew pAPTBR

correct diff is

77a78
> junit = "5.10.0"
203a205
> rest-assured = "5.3.2"
240a243
> boms-junit = {group = "org.junit", name = "junit-bom", version.ref = "junit" }
241a245,247
> boms-kotest = {group = "io.kotest", name = "kotest-bom", version.ref = "kotest" }
> boms-rest-assured = {group = "io.rest-assured", name = "rest-assured-bom", version.ref = "rest-assured" }
> boms-spock = {group = "org.spockframework", name = "spock-bom", version.ref = "spock" }

@melix melix merged commit 087a677 into master Sep 13, 2023
3 checks passed
@melix melix deleted the cc/issue-611 branch September 13, 2023 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

managed-version not inlined if used for bom, but not dependency
2 participants