You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Olivier Lamy (JIRA)" <ji...@codehaus.org> on 2010/12/21 22:06:58 UTC

[jira] Closed: (MINVOKER-112) duplicate script classpath entries are not filtered out, can cause ClassCastException

     [ http://jira.codehaus.org/browse/MINVOKER-112?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Olivier Lamy closed MINVOKER-112.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 1.6

fixed rev 1051652.
Thanks !

> duplicate script classpath entries are not filtered out, can cause ClassCastException
> -------------------------------------------------------------------------------------
>
>                 Key: MINVOKER-112
>                 URL: http://jira.codehaus.org/browse/MINVOKER-112
>             Project: Maven 2.x Invoker Plugin
>          Issue Type: Bug
>            Reporter: luke w patterson
>            Assignee: Olivier Lamy
>             Fix For: 1.6
>
>         Attachments: script-classpath-duplicates-fix.patch, script-classpath-duplicates-it.patch
>
>
> (it test case attached)
> when addTestClassPath http://maven.apache.org/plugins/maven-invoker-plugin/run-mojo.html#addTestClassPath
> is set to "true" but the consuming project also depends on groovy or beanshell, scripts fail with ClassCastException,
> because the jars end up on the classpath twice
> error example:
> {noformat} 
> 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:432)
> 	at groovy.lang.GroovyShell.parse(GroovyShell.java:584)
> 	at groovy.lang.GroovyShell.parse(GroovyShell.java:564)
> 	at groovy.lang.GroovyShell.evaluate(GroovyShell.java:542)
> 	at groovy.lang.GroovyShell.evaluate(GroovyShell.java:518)
> 	at org.apache.maven.plugin.invoker.GroovyScriptInterpreter.evaluateScript(GroovyScriptInterpreter.java:83)
> {noformat}
> I created a fix locally, but it's rough right now.  Will polish it up and submit later.  Basically, it adds 
> {code}
> /**
>  * @parameter expression="${plugin.artifacts}"
>  * @required
>  * @readonly
>  */
> private List pluginArtifacts;
> {code}
> to AbstractInvokerMojo, and then spins through the Artifacts, retrieving their file paths, and removes those from the list sent to "scriptRunner.setClassPath"
> Granted, the proposed fix could be smarter, cause it only filters out exact matches, but it's better than the current behavior.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira