You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2026/09/30 14:55:50 UTC

(maven-script-interpreter) branch master updated: Deprecate BeanShell scripts

This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-script-interpreter.git


The following commit(s) were added to refs/heads/master by this push:
     new 456ead6  Deprecate BeanShell scripts
456ead6 is described below

commit 456ead6ada19a3dd9e3407f6520443d884bf68f9
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sun Sep 20 16:00:31 2026 +0200

    Deprecate BeanShell scripts
    
    Groovy is the second engine for everything BeanShell does here, and the
    bsh artifact has had no release on Central since 2016. Running a .bsh
    script now logs a warning; BeanShell becomes an optional dependency in
    1.11 and support for it will be removed later (apache/maven#13207).
---
 .../shared/scriptinterpreter/BeanShellScriptInterpreter.java   |  3 +++
 .../apache/maven/shared/scriptinterpreter/ScriptRunner.java    | 10 +++++++++-
 src/site/markdown/index.md.vm                                  |  2 ++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/maven/shared/scriptinterpreter/BeanShellScriptInterpreter.java b/src/main/java/org/apache/maven/shared/scriptinterpreter/BeanShellScriptInterpreter.java
index a2c6426..8fe96ae 100644
--- a/src/main/java/org/apache/maven/shared/scriptinterpreter/BeanShellScriptInterpreter.java
+++ b/src/main/java/org/apache/maven/shared/scriptinterpreter/BeanShellScriptInterpreter.java
@@ -37,7 +37,10 @@ import bsh.TargetError;
  * Provides a facade to evaluate BeanShell scripts.
  *
  * @author Benjamin Bentmann
+ * @deprecated since 1.10: BeanShell scripts are deprecated, port them to Groovy. BeanShell becomes an optional
+ *             dependency in 1.11 and support for it will be removed later (apache/maven#13207).
  */
+@Deprecated
 class BeanShellScriptInterpreter implements ScriptInterpreter {
 
     private static class ChildFirstURLClassLoader extends URLClassLoader {
diff --git a/src/main/java/org/apache/maven/shared/scriptinterpreter/ScriptRunner.java b/src/main/java/org/apache/maven/shared/scriptinterpreter/ScriptRunner.java
index 0efed83..2317c06 100644
--- a/src/main/java/org/apache/maven/shared/scriptinterpreter/ScriptRunner.java
+++ b/src/main/java/org/apache/maven/shared/scriptinterpreter/ScriptRunner.java
@@ -62,8 +62,10 @@ public class ScriptRunner implements Closeable {
     private String encoding;
 
     /**
-     * Creates a new script runner with BSH and Groovy interpreters.
+     * Creates a new script runner with BSH and Groovy interpreters. BeanShell is deprecated: it becomes an optional
+     * dependency in 1.11 and support for it will be removed later.
      */
+    @SuppressWarnings("deprecation")
     public ScriptRunner() {
         scriptInterpreters = new LinkedHashMap<>();
         scriptInterpreters.put("bsh", new BeanShellScriptInterpreter());
@@ -206,6 +208,12 @@ public class ScriptRunner implements Closeable {
             name = name.substring(name.lastIndexOf('.') + 1);
             LOG.debug("Running script with {} :{}", name, scriptFile);
         }
+        if (interpreter instanceof BeanShellScriptInterpreter) {
+            LOG.warn(
+                    "BeanShell scripts are deprecated, port {} to Groovy; BeanShell becomes an optional dependency"
+                            + " in maven-script-interpreter 1.11 and support for it will be removed later",
+                    scriptFile);
+        }
 
         String script;
         try {
diff --git a/src/site/markdown/index.md.vm b/src/site/markdown/index.md.vm
index a2ba72d..cc50289 100644
--- a/src/site/markdown/index.md.vm
+++ b/src/site/markdown/index.md.vm
@@ -21,6 +21,8 @@ under the License.
 
 This component provides some utilities to interpret/execute some scripts for various implementations: groovy or beanshell.
 
+**BeanShell is deprecated** since 1.10: port `.bsh` scripts to Groovy. Running a BeanShell script logs a warning, BeanShell becomes an optional dependency in 1.11, and support for it will be removed later. The retirement is tracked in [apache/maven#13207](https://github.com/apache/maven/issues/13207).
+
 Dependency declaration
 ----------------------