Op Sat, 05 Sep 2015 10:33:30 +0200 schreef Barrie Treloar
<[email protected]>:
On 5 September 2015 at 17:35, Robert Scholte <[email protected]>
wrote:
Op Sat, 05 Sep 2015 08:56:09 +0200 schreef Barrie Treloar <
[email protected]>:
I'm using the invoker plugin to test the mojo I'm hacking.
I had assumed that the mojo's classpath would be available to invoker,
but
when I print out the classpath that doesn't appear to be the case.
"the mojo"? the mojo you are testing? No, that's just a standalone mojo.
m-invoker-p just triggers it, it has no knowledge of the mojo it is
executing. That's one of the reasons why MINVOKER-154 is still open.
Yes, the mojo I am testing with invoker.
I'm really just after some of the helper classes that are on the
classpath
of the mojo.
Seems silly to rewrite verbosely how to read a pom and create a model
and a
MavenProject.
I've tried the addTestClassPath option but then I'm getting
groovy.lang.GroovyRuntimeException: Failed to create Script instance
for
class: class Script1. Reason: java.lang.ClassCastException: Script1
cannot
be cast to groovy.lang.GroovyObject
Already if you set addTestClassPath to true? Any chance you specified a
different verion of groovy somewhere?
No groovy anywhere.
Only via invoker.
I guess there's an issue with your script, I've seen it working.
If you are using imports, could you use fully qualified classnames in the
code instead?
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/script-class-loading/
this should reflect your usecase, right?
Which looks a bit like
https://issues.apache.org/jira/browse/MINVOKER-112
.
If I add in the dependency directly to the maven-invoker-plugin then I
can
keep working.
What's the correct way?
The preferred way right now is adding the dependency as test-scoped to
the
maven-invoker-plugin. This should make it available for the scripts. I
still want to support custom scopes for plugin dependencies, so you can
easily specify when to use which dependency.
I've just used the default scope when adding the dependency to
maven-invoker-plugin, which works for me too.
I was trying to be lazy and just get the kitchen sink since I knew the
helper classes were already on my mojo's classpath. I didn't want to work
out which bits I actually needed :)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]