You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/12/07 08:39:24 UTC

[GitHub] [maven-script-interpreter] olamy commented on a diff in pull request #87: catch this error to give more groovy error details

olamy commented on code in PR #87:
URL: https://github.com/apache/maven-script-interpreter/pull/87#discussion_r1041910867


##########
src/main/java/org/apache/maven/shared/scriptinterpreter/GroovyScriptInterpreter.java:
##########
@@ -78,6 +78,8 @@ public Object evaluateScript(
             }
         } catch (IOException e) {
             throw new ScriptEvaluationException(e);
+        } catch (Throwable e) {
+            throw new ScriptEvaluationException(e);

Review Comment:
   yes and no :) 
   the previous code was not catching this 
   ```
   Running pre-build script: /Volumes/workspace/dev/sources/maven/plugins/maven-invoker-plugin/target/it/selector-scripts/setup.groovy
   java.lang.ExceptionInInitializerError
   	at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:71)
   	at groovy.lang.GroovyObjectSupport.getDefaultMetaClass(GroovyObjectSupport.java:46)
   	at groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:32)
   	at groovy.lang.Binding.<init>(Binding.java:36)
   	at org.apache.maven.shared.scriptinterpreter.GroovyScriptInterpreter.evaluateScript(GroovyScriptInterpreter.java:65)
   	at org.apache.maven.shared.scriptinterpreter.ScriptRunner.executeRun(ScriptRunner.java:222)
   	at org.apache.maven.shared.scriptinterpreter.ScriptRunner.run(ScriptRunner.java:159)
   	at org.apache.maven.plugins.invoker.AbstractInvokerMojo.runBuild(AbstractInvokerMojo.java:2047)
   	at org.apache.maven.plugins.invoker.AbstractInvokerMojo.runBuild(AbstractInvokerMojo.java:1721)
   	at org.apache.maven.plugins.invoker.AbstractInvokerMojo.lambda$runBuilds$4(AbstractInvokerMojo.java:1431)
   	at org.apache.maven.plugins.invoker.JobExecutor.lambda$null$1(JobExecutor.java:69)
   	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
   	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
   	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
   	at java.base/java.lang.Thread.run(Thread.java:829)
   Caused by: groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [groovy-xml is loaded in version 4.0.6 and you are trying to load version 3.0.10
   	at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$DefaultModuleListener.onModule(MetaClassRegistryImpl.java:534)
   	at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromProperties(ExtensionModuleScanner.java:87)
   	at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromMetaInf(ExtensionModuleScanner.java:81)
   	at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModulesFrom(ExtensionModuleScanner.java:63)
   	at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModules(ExtensionModuleScanner.java:54)
   	at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:133)
   	at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:94)
   	at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:37)
   ```
   but yeah it would be better to move L65 `new GroovyShell` inside the try



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org