Maven not able to find setter for MavenProjectHelper property
-------------------------------------------------------------

         Key: MNG-1465
         URL: http://jira.codehaus.org/browse/MNG-1465
     Project: Maven 2
        Type: Bug
    Reporter: David Jackman


This might really be a plexus issue (I don't know enough about the code to know 
for sure).

I have a Mojo class with a field of type MavenProjectHelper.  For all other 
field, I've followed the pattern of using a private member field with a prefix 
of "m_", then using the property parameter to indicate a setter method for that 
field that Maven should use.  This seems to work find for most of my 
properties, but the one that takes a MavenProjectHelper won't work that way.  
For some reason, it looks for a field of that name and not a setter method for 
that property.

Here's the field definition and the setter method:
    /**
     * @parameter 
expression="${component.org.apache.maven.project.MavenProjectHelper}" 
property="projectHelper"
     */
    private MavenProjectHelper m_projectHelper;

    /**
     * Sets the project helper.
     * 
     * @param projectHelper  the project helper to use.
     */
    public void setProjectHelper(MavenProjectHelper projectHelper)
    {
        this.m_projectHelper = projectHelper;
    }

And the error I get back when attempting to use the Mojo looks like this:
[INFO] Internal error in the plugin manager executing goal 
'no.fast.buildprocess:docextractor:1.0-SNAPSHOT:configdocjar': Unable to find 
the mojo 'no.fast.buildprocess:docextractor:1.0-SNAPSHOT:configdocjar' in the 
plugin 'no.fast.buildprocess:docextractor'
Component Composition failed. No field of name: 'projectHelper' exists in 
component: role: 'null', implementation: 'no.fast.buildprocess.ConfigdocJarMojo'
[INFO] 
----------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Internal error in the 
plugin manager executing goal 
'no.fast.buildprocess:docextractor:1.0-SNAPSHOT:configdocjar': Unable to find 
the mojo 'no.fast.buildprocess:docextractor:1.0-SNAPSHOT:configdocjar' in the 
plugin 'no.fast.buildprocess:docextractor'
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:523)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:482)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:452)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:301)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:268)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:137)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.PluginManagerException: Unable to find the 
mojo 'no.fast.buildprocess:docextractor:1.0-SNAPSHOT:configdocjar' in the 
plugin 'no.fast.buildprocess:docextractor'
        at 
org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:533)
        at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:390)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:519)
        ... 16 more
Caused by: 
org.codehaus.plexus.component.repository.exception.ComponentLookupException: 
Unable to lookup component 
'org.apache.maven.plugin.Mojono.fast.buildprocess:docextractor:1.0-SNAPSHOT:configdocjar',
 it could not be started
        at 
org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:335)
        at 
org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:436)
        at 
org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:524)
        ... 18 more
Caused by: 
org.codehaus.plexus.component.repository.exception.ComponentLifecycleException: 
Error starting component
        at 
org.codehaus.plexus.component.manager.AbstractComponentManager.startComponentLifecycle(AbstractComponentManager.java:109)
        at 
org.codehaus.plexus.component.manager.AbstractComponentManager.createComponentInstance(AbstractComponentManager.java:95)
        at 
org.codehaus.plexus.component.manager.PerLookupComponentManager.getComponent(PerLookupComponentManager.java:48)
        at 
org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:327)
        ... 20 more
Caused by: 
org.codehaus.plexus.personality.plexus.lifecycle.phase.PhaseExecutionException: 
Error composing component
        at 
org.codehaus.plexus.personality.plexus.lifecycle.phase.CompositionPhase.execute(CompositionPhase.java:33)
        at 
org.codehaus.plexus.lifecycle.AbstractLifecycleHandler.start(AbstractLifecycleHandler.java:101)
        at 
org.codehaus.plexus.component.manager.AbstractComponentManager.startComponentLifecycle(AbstractComponentManager.java:105)
        ... 23 more
Caused by: org.codehaus.plexus.component.composition.CompositionException: 
Component Composition failed. No field of name: 'projectHelper' exists in 
component: role: 'null', implementation: 'no.fast.buildprocess.ConfigdocJarMojo'
        at 
org.codehaus.plexus.component.composition.FieldComponentComposer.getFieldByName(FieldComponentComposer.java:224)
        at 
org.codehaus.plexus.component.composition.FieldComponentComposer.findMatchingField(FieldComponentComposer.java:171)
        at 
org.codehaus.plexus.component.composition.FieldComponentComposer.assembleComponent(FieldComponentComposer.java:62)
        at 
org.codehaus.plexus.component.composition.DefaultComponentComposerManager.assembleComponent(DefaultComponentComposerManager.java:68)
        at 
org.codehaus.plexus.DefaultPlexusContainer.composeComponent(DefaultPlexusContainer.java:1476)
        at 
org.codehaus.plexus.personality.plexus.lifecycle.phase.CompositionPhase.execute(CompositionPhase.java:29)
        ... 25 more

-- 
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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to