jira-importer commented on issue #642: URL: https://github.com/apache/maven-invoker-plugin/issues/642#issuecomment-2957810706
**[Martin Todorov](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=carlspring)** commented I am getting this as well with: ``` mvn --version Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00) Maven home: /java/apache/maven-3.3.9 Java version: 1.8.0_65, vendor: Oracle Corporation Java home: /java/jdk1.8.0_65/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "4.5.0-6-default", arch: "amd64", family: "unix" ``` The exception: ``` Running post-build script: /java/jenkins/jobs/project1/jobs/project1-web-integration-tests/workspace/target/it/deploy-and-delete/verify.groovy groovy.lang.GroovyRuntimeException: Failed to create Script instance for class: class Script1. Reason: java.lang.ClassCastException: Script1 cannot be cast to groovy.lang.GroovyObject at org.codehaus.groovy.runtime.InvokerHelper.createScript(InvokerHelper.java:447) at groovy.lang.GroovyShell.parse(GroovyShell.java:686) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:568) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:608) at groovy.lang.GroovyShell.evaluate(GroovyShell.java:579) at org.apache.maven.shared.scriptinterpreter.GroovyScriptInterpreter.evaluateScript(GroovyScriptInterpreter.java:83) at org.apache.maven.shared.scriptinterpreter.ScriptRunner.executeRun(ScriptRunner.java:249) at org.apache.maven.shared.scriptinterpreter.ScriptRunner.run(ScriptRunner.java:177) at org.apache.maven.plugin.invoker.AbstractInvokerMojo.runBuild(AbstractInvokerMojo.java:1746) at org.apache.maven.plugin.invoker.AbstractInvokerMojo.runBuild(AbstractInvokerMojo.java:1415) at org.apache.maven.plugin.invoker.AbstractInvokerMojo.runBuilds(AbstractInvokerMojo.java:1262) at org.apache.maven.plugin.invoker.AbstractInvokerMojo.execute(AbstractInvokerMojo.java:737) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.jvnet.hudson.maven3.launcher.Maven32Launcher.main(Maven32Launcher.java:132) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238) at jenkins.maven3.agent.Maven32Main.launch(Maven32Main.java:186) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at hudson.maven.Maven3Builder.call(Maven3Builder.java:136) at hudson.maven.Maven3Builder.call(Maven3Builder.java:71) at hudson.remoting.UserRequest.perform(UserRequest.java:152) at hudson.remoting.UserRequest.perform(UserRequest.java:50) at hudson.remoting.Request$2.run(Request.java:332) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassCastException: Script1 cannot be cast to groovy.lang.GroovyObject at org.codehaus.groovy.runtime.InvokerHelper.createScript(InvokerHelper.java:420) ... 44 more ``` Plugin configuration: ``` <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-invoker-plugin</artifactId> <version>2.0.0</version> <configuration> <debug>true</debug> <preBuildHookScript>clean</preBuildHookScript> <postBuildHookScript>verify</postBuildHookScript> <settingsFile>src/it/settings.xml</settingsFile> <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo> <addTestClassPath>true</addTestClassPath> </configuration> <executions> <execution> <id>invoker-integration-tests</id> <goals> <goal>run</goal> </goals> <phase>test</phase> </execution> </executions> <dependencies> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>2.4.6</version> </dependency> </dependencies> </plugin> ``` I also have: ``` <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>2.4.6</version> <scope>test</scope> </dependency> ``` And that doesn't seem to help. Is there a way around this? I mean, this was all working fine for our project till a few days ago. There have been no changes to the said project in a long while and the code was running these integration tests just fine for a long time (we're using the `maven-invoker-plugin` to simulate Maven behavior against another project, so our CI was set up to invoke these test when there were changes to the other project). I've also posted this on Stackoverflow, as I wasn't initially sure whether it was a bug, or not: - http://stackoverflow.com/questions/37642843/weird-maven-invoker-plugin-exception-java-lang-classcastexception-script1-cann From the discussion in this bug report and [this discussion](http://maven.40175.n5.nabble.com/Maven-invoker-plugin-addTestClassPath-failing-but-manually-adding-as-dependency-works-td5843422.html), I am under the impression that other people have been able to find a workaround, but adding the `groovy-all` dependency doesn't seem to be making a difference in my case at all. Please advise! -- 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-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org