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

Reduce spurious invalidations of the up-to-date index in Maven plugin #1461

Merged
merged 3 commits into from
Jan 8, 2023

Conversation

lutovich
Copy link
Contributor

@lutovich lutovich commented Jan 7, 2023

Improve selectivity in Maven plugin fingerprint

PluginFingerprint captures a particular configuration of the Spotless Maven plugin. It is used to invalidate the up-to-date index when plugin's configuration changes.

Invalidations of the index file seem to be too frequent because PluginFingerprint includes the effective (as in Effective POM) configuration of the Spotless plugin. For example, it includes dependencies declared outside of the <plugin </plugin> XML element. So addition of an unrelated project dependency will invalidate the index file.

Spotless Maven plugin manages its own dependencies using ArtifactResolver. There's no need to include the effective <plugin> object into PluginFingerprint. This PR simplifies the fingerprint to include only the plugin's version and serialized configuration of all formatters. It should be backward-compatible because fingerprint format change will simply trigger an invalidation of the index file.

Improve index file invalidation message in Maven plugin

Do not mention plugin fingerprint because it is an implementation detail and can be confusing to users. Explain why index file invalidation could happen.


This PR is related to #1372.

`PluginFingerprint` captures a particular configuration of the Spotless Maven
plugin. It is used to invalidate the up-to-date index when plugin's configuration
changes.

Invalidations of the index file seem to be too frequent because `PluginFingerprint`
includes the effective (as in Effective POM) configuration of the Spotless plugin.
For example, it includes dependencies declared outside of the `<plugin></plugin>`
XML element. So addition of an unrelated project dependency will invalidate the
index file.

Spotless Maven plugin manages its own dependencies using `ArtifactResolver`. There's
no need to include the effective `<plugin>` object into `PluginFingerprint`. This
commit simplifies the fingerprint to include only the plugin's version and serialized
configuration of all formatters. It should be backward-compatible because fingerprint
format change will simply trigger an invalidation of the index file.
Do not mention plugin fingerprint because it is an implementation detail and
can be confusing to users. Explain why index file invalidation could happen.
Copy link
Member

@nedtwigg nedtwigg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Add a changelog entry and press merge :)

@lutovich lutovich merged commit c50503e into diffplug:main Jan 8, 2023
@lutovich lutovich deleted the improve-maven-plugin-fingerprint branch January 8, 2023 13:15
@nedtwigg
Copy link
Member

Published in plugin-maven 2.30.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants