Repository navigation
Description
Tracking issue for retiring BeanShell across the Maven estate: deprecate it now, migrate what we own, remove it in the next majors.
Why
- The
bshartifact we ship is dead on Central:org.apache-extras.beanshell:bshlast published 2.0b6 on 2016-02-05 (the CVE-2016-2510 fix). The GitHub project released 2.1.1 in 2022 but never to Central; nothing since. - Every use we have is a test-script or expression language for which Groovy is already the second engine in the same component, and the newer ITs are written in Groovy.
maven-plugin-toolsalready dropped BeanShell mojos for 4.0.0 (MPLUGIN-525).- Both interpreters redirect the JVM-global
System.out/System.errand serialize all script runs behind a static lock (Global System.out/System.err redirection and static lock serialize all script runs JVM-wide maven-script-interpreter#205); fixing that for one engine is cheaper than for two.
Where BeanShell is used
| Component | Use | Notes |
|---|---|---|
| maven-script-interpreter | BeanShellScriptInterpreter, registered as bsh next to groovy |
Also the fallback for any unrecognised script extension (ScriptRunner) |
| maven-invoker-plugin | setup/prebuild/postbuild/selector scripts |
Through maven-script-interpreter |
| maven-archetype-plugin | archetype:integration-test verify scripts |
Through maven-script-interpreter |
| maven-enforcer | evaluateBeanshell rule, direct bsh dependency |
The only place where BeanShell is user-facing syntax; 212 pom.xml on GitHub use the rule |
| maven-plugin-tools 3.x | maven-script-beanshell, maven-plugin-tools-beanshell |
Gone on master (MPLUGIN-525); ends with the 3.x line |
| Our own ITs | 549 .bsh scripts in the 3.x plugin lines (444 verify.bsh, 70 setup.bsh) against 1 009 .groovy |
Largest holders: assembly 107, invoker 79, install 47, dependency 44, shade 36, javadoc 28, war 24, deploy 22, site 21, clean 16 |
Outside the estate, GitHub code search finds 1 628 src/it/**/verify.bsh against 3 240 verify.groovy.
Status (2026-09-30)
50 of the 54 PRs linked here are merged. On the default branches of every apache/maven-* repository the only .bsh files left are engine coverage: maven-invoker-plugin's 17 script-* fixtures, maven-script-interpreter's 7 test resources, and maven-archetype's verify-script-beanshell-rejected fixture, which checks that BeanShell is refused.
maven-archetype has already removed BeanShell on master: verify scripts run through Groovy directly and maven-script-interpreter is gone (f4e8441fb).
Still open:
| PR | State |
|---|---|
apache/maven-enforcer#1035 evaluateGroovy rule |
approved, green |
| apache/maven-script-interpreter#216 deprecate BeanShell | green, needs review |
| apache/maven-script-interpreter#217 unknown extensions run as Groovy (stacked on #216) | green, needs review |
apache/maven-script-interpreter#218 per-thread output instead of swapping System.out (stacked on #217, fixes apache/maven-script-interpreter#205) |
green, needs review |
The three maven-script-interpreter PRs missed 1.9 (2026-09-19), so the deprecation ships in 1.10.
Plan
-
Deprecate now in maven-invoker-plugin and maven-archetype-plugin: docs and parameter javadoc say BeanShell scripts are deprecated, port to Groovy. — Deprecate BeanShell hook scripts maven-invoker-plugin#768, Deprecate BeanShell verify scripts for archetype:integration-test maven-archetype#1030
-
maven-script-interpreter 1.10:
@DeprecatedonBeanShellScriptInterpreter, warning on every BeanShell run, site note — Deprecate BeanShell scripts maven-script-interpreter#216; unknown extensions run as Groovy instead of BeanShell — Run scripts with an unknown extension as Groovy maven-script-interpreter#217 (stacked). Next: 1.11 makesbshan optional dependency. -
maven-enforcer: deprecate
evaluateBeanshell(@Deprecated, runtime warning, docs). — Deprecate the evaluateBeanshell rule maven-enforcer#1034. Replacement decided:evaluateGroovy, Add the evaluateGroovy rule maven-enforcer#1035 (Groovy is an optional dependency users add to the plugin declaration; the deprecation notices point at it). -
Migrate our ITs:
.bsh→.groovy, one PR per repo, rename commit first. Done for the September-round repos and the small MojoHaus ones:maven-invoker-plugin keeps 17
.bshfiles under thebeanshell/fixture directories of itsscript-*ITs on purpose: they exercise the plugin's own interpreter detection and are the engine's coverage until it is removed.What actually needed changing when porting (everything else was byte-identical after the rename):
"$…"in double-quoted strings interpolates in Groovy (literal-placeholder assertions → single quotes);String[] x = { … }initialisers do not parse (→ list literals); typed redeclarations in one scope are a compile error; a script-level method cannot see typed script locals (→@Field). -
Remaining
.bshITs, whole estate (3.x lines and, where master is the Maven 4 line, master too):Left as
.bshon purpose, all engine coverage: maven-invoker-plugin's 17script-*/src/it/beanshell/fixtures, maven-script-interpreter's 7 test resources, and maven-plugin-tools 3.x's two BeanShell mojo sources. After these merge, no other.bshremains in the estate.More Groovy differences met on the way, beyond the four above:
inis a keyword;File + Stringthrows at runtime (noFile.plus(String));'/'is a String, soFile.separatorChar == '/'needsas char; an import of a class that does not exist fails compilation even when unused; a script-level method needs a return type; BeanShell'sx == voidbecomes!binding.hasVariable('x'); aprintlnof a never-declared variable throws instead of printing void. The last three only show up when the IT actually runs, not undergroovyc. -
Remove: maven-script-interpreter 2.0 drops
bsh, the fallback becomes an error; maven-invoker-plugin follows on its next minor after that. maven-archetype-plugin is done on master (f4e8441fb).
PRs and per-repo issues link back here.
Activity
Port the IT scripts from BeanShell to Groovy
Port the IT scripts from BeanShell to Groovy
Deprecate BeanShell verify scripts for archetype:integration-test
Deprecate the evaluateBeanshell rule
Port the IT scripts from BeanShell to Groovy
Port the IT scripts from BeanShell to Groovy
Port the IT scripts from BeanShell to Groovy
Port the IT scripts from BeanShell to Groovy
Port the IT scripts from BeanShell to Groovy
Port the IT scripts from BeanShell to Groovy
Deprecate BeanShell hook scripts
Port the IT scripts from BeanShell to Groovy
18 remaining items
Port the IT scripts from BeanShell to Groovy
Port the IT scripts from BeanShell to Groovy
Port the IT scripts from BeanShell to Groovy
Port the IT scripts from BeanShell to Groovy
Add the evaluateGroovy rule
Run verify scripts with Groovy directly and drop maven-script-interpr…
Run verify scripts with Groovy directly and drop maven-script-interpr…
Port the integration test verify scripts from BeanShell to Groovy
Port the integration test verify scripts from BeanShell to Groovy
Port the IT scripts from BeanShell to Groovy
Port the IT scripts from BeanShell to Groovy
Warn when a hook or selector script is BeanShell
Deprecate BeanShell scripts