Skip to content

Add the evaluateGroovy rule - #1035

Closed
slachiewicz wants to merge 1 commit into
masterfrom
agent/evaluate-groovy
Closed

slachiewicz wants to merge 1 commit into
masterfrom
agent/evaluate-groovy

Conversation

@slachiewicz

@slachiewicz slachiewicz commented Sep 20, 2026 •

Copy link
Copy Markdown
Member

Groovy-backed counterpart of evaluateBeanshell, which is deprecated ahead of the BeanShell retirement (apache/maven#13207). Same shape: condition (Maven ${…} interpolated first, then evaluated by GroovyShell, must yield a boolean) and message.

Groovy is an optional dependency of enforcer-rules rather than a hard one: it is about 7 MB and the enforcer runs in nearly every build. Users add org.apache.groovy:groovy to the plugin declaration (shown on the rule page); without it the rule fails with a one-line message saying exactly that. The Groovy call sits in a nested class so the rule itself loads and can report the absence.

The rule page notes the one porting gotcha: BeanShell compared bare words (${project.artifactId} == foo), Groovy needs both sides quoted. The deprecation notices on evaluateBeanshell now point here.

Verified: TestEvaluateGroovy 8/8; ITs evaluate-groovy (two rules pass), evaluate-groovy-missing (expected failure with the classpath message) and evaluate-beanshell → Passed: 3; apache-rat:check clean; mvn site -pl enforcer-rules renders the new page.

@slachiewicz slachiewicz added the enhancement New feature or request label Sep 20, 2026
@slachiewicz
slachiewicz marked this pull request as ready for review September 20, 2026 13:46
Groovy is the replacement engine for BeanShell across Maven
(apache/maven#13207). The dependency is optional: Groovy is ~7 MB and
the enforcer runs in nearly every build, so users who want the rule add
org.apache.groovy:groovy to the plugin declaration and the rule reports
its absence in one line.
---
title: Beanshell
author:
- Brian Fox

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.

?

@@ -0,0 +1,86 @@
---
title: Beanshell

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.

?

Comment thread enforcer-rules/pom.xml
<version>2.0b6</version>
</dependency>
<dependency>
<!-- for evaluateGroovy; not shipped with the plugin, users add it to the plugin declaration -->

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.

To check if optional is not added to plugin dependencies, maybe scope provided

@slachiewicz

Copy link
Copy Markdown
Member Author

Not sure if it shoudl go here. Maybe better place woudl be to mojohuse?

@slawekjaranowski

Copy link
Copy Markdown
Member

Not sure if it shoudl go here. Maybe better place woudl be to mojohuse?

I'm for adding it (and other) here ... we have a lack of maintainers for mojohuse, so I hope that in ASF we have more

@slawekjaranowski

Copy link
Copy Markdown
Member

Should be done as continuation for

@slachiewicz slachiewicz added the wontfix This will not be worked on label Oct 7, 2026
@slachiewicz slachiewicz closed this Oct 7, 2026
@slachiewicz
slachiewicz deleted the agent/evaluate-groovy branch October 7, 2026 12:06
@slawekjaranowski

Copy link
Copy Markdown
Member

@slachiewicz why closed? ... it was ok for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request wontfix This will not be worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants