Hi,

I found that help:evaluate is also not working on Maven 3 due to some API abuse:

[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-help-plugin:2.1.1-SNAPSHOT:evaluate 
(default-cli) on project test: NoSuchMethodException: 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(java.lang.String,
 org.apache.maven.execution.MavenSession, 
org.apache.maven.project.MavenProject, java.lang.String, boolean, boolean) -> 
[Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal 
org.apache.maven.plugins:maven-help-plugin:2.1.1-SNAPSHOT:evaluate 
(default-cli) on project test: NoSuchMethodException: 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(java.lang.String,
 org.apache.maven.execution.MavenSession, 
org.apache.maven.project.MavenProject, java.lang.String, boolean, boolean)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:580)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:323)
        [snip]
Caused by: org.apache.maven.plugin.MojoFailureException: NoSuchMethodException: 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(java.lang.String,
 org.apache.maven.execution.MavenSession, 
org.apache.maven.project.MavenProject, java.lang.String, boolean, boolean)
        at 
org.apache.maven.plugins.help.HelpUtil.getMojoDescriptor(HelpUtil.java:103)
        at 
org.apache.maven.plugins.help.EvaluateMojo.getEvaluator(EvaluateMojo.java:360)
        at 
org.apache.maven.plugins.help.EvaluateMojo.handleResponse(EvaluateMojo.java:385)
        at 
org.apache.maven.plugins.help.EvaluateMojo.execute(EvaluateMojo.java:253)
        at 
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:105)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:576)
        ... 14 more

The same affects help:describe -Dcmd=some:goal (as opposed to a lifecycle 
phase). I've added ITs for both cases.

It is being particularly evil by finding a private method on the lifecycle 
executor and making it public internally.

The DefaultLifecycleExecutor has a comment on the 3-arg variant of the 
getMojoDescriptor method - it seems it was a similar problem for old versions 
of the remote-resources plugin, but I can't find the actual problem. r757504 
where the comment was added didn't offer much insight.

I'm looking for other's thoughts on the best way to fix this.

For the usage in evaluate, it could be fixed in the help plugin by constructing 
the plugin descriptor by hand (it only uses the goal name for exception output) 
and banning ${plugin.*} expressions (which make little sense as they are 
evaluated against the Help plugin).

However, for the use in describe, I don't see any way around using the original 
method from the exposed APIs, as it needs:
- to be able to resolve a prefix to a plugin
- to be able to load the plugin descriptor for a plugin coordinate (could be 
done from the plugin manager if the Maven requirement is bumped to Maven 2.2.1+)

It seems like we need to restore the previous method (it need only delegate to 
the 3-arg variant as the last 3 aren't used), and add some way in Maven 3 to 
achieve prefix -> plugin resolution from the public API for future migration.

Thoughts?

Cheers,
Brett

--
Brett Porter
br...@apache.org
http://brettporter.wordpress.com/





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to