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

Add configuration option to omit dependency exclusions stanzas from flattened POM #288

Closed
josple opened this issue Jul 10, 2022 · 1 comment · Fixed by #289
Closed

Add configuration option to omit dependency exclusions stanzas from flattened POM #288

josple opened this issue Jul 10, 2022 · 1 comment · Fixed by #289

Comments

@josple
Copy link

josple commented Jul 10, 2022

New Feature Summary

Add a new configuration option called omitExclusions that by default is set to false (to mirror current functionality) but when it is explicitly set to true then the exclusions stanzas within dependency stanzas will not be present in the flattened POM.

Why is this feature required?

The company I work for has a large monorepo which contains 100s of (Maven) modules. We version each module independently but build all modules together in a single monobuild. We maintain a parent BOM that contains all of our dependency management including the versions of our modules within the monorepo. This BOM will therefore change on every merge which means that if we were to publish this BOM and resolve it from our 100s of modules then every module would have to be published for every merge - which would mean we couldn't version our modules independently and instead would have to publish all of our modules for every merge even if their binary has not changed. To get around this we never publish our parent BOM and instead we flatten our module POMs to incorporate the latest BOM info and we ignore this POM when doing the checksums that determine if a module needs to be published.

The challenge we have is that we sometimes get stale exclusions present in the (flattened) POMs of our published modules. This occurs in the following scenario:

  1. we have an exclusion in the parent BOM
  2. we publish a module (let's call it "Module A") whose (flattened) POM includes this exclusion
  3. we change the parent BOM to no longer have the exclusion...but this does not trigger "Module A" to publish again

In this scenario, if we were now to perform a resolve that included Module A the stale exclusion would still apply - which is a major problem for us!

What we would like is to never include the exclusions stanzas in our flattened POMs. For us, this will work perfectly because we know that every resolve we perform uses our parent BOM and therefore we are guaranteed to additively add any up-to-date exclusions to the POM dependency declarations that we resolve and as such don't require our published (flattened) POMs to ever have exclusions specified in them.

@josple
Copy link
Author

josple commented Jul 11, 2022

Created PR #289 for this proposed new feature.

josple pushed a commit to josple/flatten-maven-plugin that referenced this issue Aug 4, 2022
Introduces a new 'omitExclusions' configuration option that is false by default to maintain backwards compatible behaviour. When this new configuration option is explicitly set to true then this will result in the flattened POM omitting all exclusions stanzas from the dependency stanzas.

Implements mojohaus#288
josple pushed a commit to josple/flatten-maven-plugin that referenced this issue Aug 4, 2022
Introduces a new 'omitExclusions' configuration option that is false by default to maintain backwards compatible behaviour. When this new configuration option is explicitly set to true then this will result in the flattened POM omitting all exclusions stanzas from the dependency stanzas.

Fixes mojohaus#288
slawekjaranowski pushed a commit that referenced this issue Aug 5, 2022
Introduces a new 'omitExclusions' configuration option that is false by default to maintain backwards compatible behaviour. When this new configuration option is explicitly set to true then this will result in the flattened POM omitting all exclusions stanzas from the dependency stanzas.

Fixes #288
@josple josple mentioned this issue Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants