You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support running a console. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping console startup.");
getLog().warn("This feature relies on Java's SecurityManager, which is deprecated for removal in Java 17. Java 18 and later will require `-Djava.security.manager=allow` be used to continue using this feature.");
thrownewMojoExecutionException("Unable to get a Groovy class from classpath (" + e.getMessage() + "). Do you have Groovy as a compile dependency in your project or the plugin?", e);
120
-
} catch (InvocationTargetExceptione) {
121
-
if (e.getCause() instanceofNoClassDefFoundError && "org/apache/ivy/core/report/ResolveReport".equals(e.getCause().getMessage())) {
122
-
thrownewMojoExecutionException("Groovy 1.7.6 and 1.7.7 have a dependency on Ivy to run the console. Either change your Groovy version or add Ivy as a project or plugin dependency.", e);
123
-
} else {
124
-
thrownewMojoExecutionException("Error occurred while calling a method on a Groovy class from classpath.", e);
125
-
}
126
-
} catch (IllegalAccessExceptione) {
127
-
thrownewMojoExecutionException("Unable to access a method on a Groovy class from classpath.", e);
128
-
} catch (InstantiationExceptione) {
129
-
thrownewMojoExecutionException("Error occurred while instantiating a Groovy class from classpath.", e);
130
-
} finally {
131
-
if (!allowSystemExits) {
132
-
System.setSecurityManager(sm);
133
-
}
120
+
// wait for console to be closed
121
+
waitForConsoleClose();
122
+
} catch (ClassNotFoundExceptione) {
123
+
thrownewMojoExecutionException("Unable to get a Groovy class from classpath (" + e.getMessage() + "). Do you have Groovy as a compile dependency in your project or the plugin?", e);
124
+
} catch (InvocationTargetExceptione) {
125
+
if (e.getCause() instanceofNoClassDefFoundError && "org/apache/ivy/core/report/ResolveReport".equals(e.getCause().getMessage())) {
126
+
thrownewMojoExecutionException("Groovy 1.7.6 and 1.7.7 have a dependency on Ivy to run the console. Either change your Groovy version or add Ivy as a project or plugin dependency.", e);
127
+
} else {
128
+
thrownewMojoExecutionException("Error occurred while calling a method on a Groovy class from classpath.", e);
129
+
}
130
+
} catch (IllegalAccessExceptione) {
131
+
thrownewMojoExecutionException("Unable to access a method on a Groovy class from classpath.", e);
132
+
} catch (InstantiationExceptione) {
133
+
thrownewMojoExecutionException("Error occurred while instantiating a Groovy class from classpath.", e);
134
+
} finally {
135
+
if (!allowSystemExits) {
136
+
System.setSecurityManager(sm);
134
137
}
135
-
} else {
136
-
getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support running a console. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping console startup.");
getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support script execution. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping script execution.");
getLog().warn("This feature relies on Java's SecurityManager, which is deprecated for removal in Java 17. Java 18 and later will require `-Djava.security.manager=allow` be used to continue using this feature.");
thrownewMojoExecutionException("Unable to get a Groovy class from classpath (" + e.getMessage() + "). Do you have Groovy as a compile dependency in your project or the plugin?", e);
156
-
} catch (InvocationTargetExceptione) {
157
-
thrownewMojoExecutionException("Error occurred while calling a method on a Groovy class from classpath.", e);
158
-
} catch (InstantiationExceptione) {
159
-
thrownewMojoExecutionException("Error occurred while instantiating a Groovy class from classpath.", e);
160
-
} catch (IllegalAccessExceptione) {
161
-
thrownewMojoExecutionException("Unable to access a method on a Groovy class from classpath.", e);
162
-
} finally {
163
-
if (!allowSystemExits) {
164
-
System.setSecurityManager(sm);
165
-
}
157
+
// run the scripts
158
+
executeScripts(groovyShellClass, shell);
159
+
} catch (ClassNotFoundExceptione) {
160
+
thrownewMojoExecutionException("Unable to get a Groovy class from classpath (" + e.getMessage() + "). Do you have Groovy as a compile dependency in your project or the plugin?", e);
161
+
} catch (InvocationTargetExceptione) {
162
+
thrownewMojoExecutionException("Error occurred while calling a method on a Groovy class from classpath.", e);
163
+
} catch (InstantiationExceptione) {
164
+
thrownewMojoExecutionException("Error occurred while instantiating a Groovy class from classpath.", e);
165
+
} catch (IllegalAccessExceptione) {
166
+
thrownewMojoExecutionException("Unable to access a method on a Groovy class from classpath.", e);
167
+
} finally {
168
+
if (!allowSystemExits) {
169
+
System.setSecurityManager(sm);
166
170
}
167
-
} else {
168
-
getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support script execution. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping script execution.");
thrownewMojoExecutionException("Unable to get a Groovy class from classpath (" + e.getMessage() + "). Do you have Groovy as a compile dependency in your project or the plugin?", e);
114
-
} catch (InvocationTargetExceptione) {
115
-
if (e.getCause() instanceofNoClassDefFoundError && e.getCause().getMessage() != null && e.getCause().getMessage().contains("jline")) {
116
-
thrownewMojoExecutionException("Unable to get a JLine class from classpath. This might be because of a JLine version mismatch. If you are using Groovy < 2.2.0-beta-1, make sure you include JLine 1.0 as a runtime dependency in your project or the plugin.", e);
117
-
} else {
118
-
thrownewMojoExecutionException("Error occurred while calling a method on a Groovy class from classpath.", e);
119
-
}
120
-
} catch (IllegalAccessExceptione) {
121
-
thrownewMojoExecutionException("Unable to access a method on a Groovy class from classpath.", e);
122
-
} catch (InstantiationExceptione) {
123
-
thrownewMojoExecutionException("Error occurred while instantiating a Groovy class from classpath.", e);
124
-
} finally {
125
-
if (!allowSystemExits) {
126
-
System.setSecurityManager(sm);
127
-
}
128
-
}
129
-
} else {
93
+
if (!groovyVersionSupportsAction()) {
130
94
getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support running a shell. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping shell startup.");
getLog().warn("This feature relies on Java's SecurityManager, which is deprecated for removal in Java 17. Java 18 and later will require `-Djava.security.manager=allow` be used to continue using this feature.");
thrownewMojoExecutionException("Unable to get a Groovy class from classpath (" + e.getMessage() + "). Do you have Groovy as a compile dependency in your project or the plugin?", e);
118
+
} catch (InvocationTargetExceptione) {
119
+
if (e.getCause() instanceofNoClassDefFoundError && e.getCause().getMessage() != null && e.getCause().getMessage().contains("jline")) {
120
+
thrownewMojoExecutionException("Unable to get a JLine class from classpath. This might be because of a JLine version mismatch. If you are using Groovy < 2.2.0-beta-1, make sure you include JLine 1.0 as a runtime dependency in your project or the plugin.", e);
121
+
} else {
122
+
thrownewMojoExecutionException("Error occurred while calling a method on a Groovy class from classpath.", e);
123
+
}
124
+
} catch (IllegalAccessExceptione) {
125
+
thrownewMojoExecutionException("Unable to access a method on a Groovy class from classpath.", e);
126
+
} catch (InstantiationExceptione) {
127
+
thrownewMojoExecutionException("Error occurred while instantiating a Groovy class from classpath.", e);
0 commit comments