Skip to content

Add enforceBytecodeVersion rule based on mojohaus#968

Merged
cstamas merged 9 commits into
masterfrom
enforce-bytecode-version
May 14, 2026
Merged

Add enforceBytecodeVersion rule based on mojohaus#968
cstamas merged 9 commits into
masterfrom
enforce-bytecode-version

Conversation

@cstamas

@cstamas cstamas commented Mar 25, 2026

Copy link
Copy Markdown
Member

This rule is very often used, and does not require anything special like new dependency, hence it should be among "built in" rules.

OTOH, it had issues, for example on larger multi projects did recheck same (potentially huge) JAR over and over again. It is now altered to not repeat same check (same options against same file) within same session.

This rule is 100% drop-in replacement for old uses (ITs are unmodified and just copied over), moreover rule itself has set priority that if enforce plugin gets updated with this rule, but the extra rules are present, the new rule will kick in. All the options are same as before, and rule name is unchanged as well.

Where it differs, and is reflected in ITs: is not so chatty as mojohaus one, it does not tell "skipped due scope", "skipped due regexp" etc, hence ITs are modified to simply assert for presence or absence of "[DEBUG] Analyzing GAV..." string instead.

This rule is very often used, and does not require anything special
like new dependency, hence it should be among "built in" rules.

OTOH, it had issues, for example on larger multi projects did
recheck same (potentinally huge) JAR over and over again.
It is now altered to not repeat same check (same options
against same file).
@cstamas cstamas self-assigned this Mar 25, 2026
@cstamas

cstamas commented Mar 25, 2026

Copy link
Copy Markdown
Member Author

Applied PR comments and added new option processOncePerSession (by def true), that if configured to false this rule will behave as before, to be able to disable optimization if it comes in way for any reason.

@slawekjaranowski

Copy link
Copy Markdown
Member

We also need to add a documentation.

I don't know why one test fail on Jenkins ...

@slawekjaranowski

Copy link
Copy Markdown
Member

As it is a modified version not directly copied from mojohaus, maybe we can change tile of change to something like:

Add enforceBytecodeVersion rule based on mojohaus

To avoid questions about IP rights 😄

@cstamas cstamas changed the title Moved rule from mojohaus: enforceBytecodeVersion Add enforceBytecodeVersion rule based on mojohaus Mar 25, 2026
@cstamas cstamas added the enhancement New feature or request label May 13, 2026
@cstamas cstamas requested a review from slawekjaranowski May 14, 2026 09:08
Comment thread pom.xml Outdated
<!-- the same as in Maven -->
<!-- all the same as in Maven -->
<resolver.version>1.9.25</resolver.version>
<version.plexus-utils>3.6.0</version.plexus-utils>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

3.6.1 or 4.0.3 due to CVE
it is also in parent

@cstamas cstamas merged commit 8e4f5b9 into master May 14, 2026
21 checks passed
@cstamas cstamas deleted the enforce-bytecode-version branch May 14, 2026 17:44
@github-actions github-actions Bot added this to the 3.6.3 milestone May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants