You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Benjamin Bentmann (JIRA)" <ji...@codehaus.org> on 2011/02/10 14:59:24 UTC

[jira] Closed: (MNG-4384) Can not use the plexus component org.sonatype.plexus.components.sec.dispatcher.SecDispatcher since maven 2.2.0

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

Benjamin Bentmann closed MNG-4384.
----------------------------------

       Resolution: Won't Fix
    Fix Version/s:     (was: Issues to be reviewed for 3.x)
         Assignee: Benjamin Bentmann

Going forward, I would like plugins to eventually use {{[o.a.m.s.crypto.SettingsDecrypter|http://maven.apache.org/ref/3.0.2/maven-settings-builder/apidocs/org/apache/maven/settings/crypto/SettingsDecrypter.html]}}. In the meantime, this issue can be worked around by depending on {{plexus-sec-dispatcher}} in compile scope and adding the following {{src/main/resources/META-INF/components.xml}} to a plugin:
{code:xml}
<component-set>
  <components>
    <component>
      <role>org.sonatype.plexus.components.sec.dispatcher.SecDispatcher</role>
      <role-hint>mng-4384</role-hint>
      <implementation>org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher</implementation>
      <requirements>
        <requirement>
          <role>org.sonatype.plexus.components.cipher.PlexusCipher</role>
          <role-hint>mng-4384</role-hint>
          <field-name>_cipher</field-name>
        </requirement>
      </requirements>
      <configuration>
        <_configuration-file>~/.m2/settings-security.xml</_configuration-file>
      </configuration>
    </component>
    <component>
      <role>org.sonatype.plexus.components.cipher.PlexusCipher</role>
      <role-hint>mng-4384</role-hint>
      <implementation>org.sonatype.plexus.components.cipher.DefaultPlexusCipher</implementation>
    </component>
  </components>
</component-set>
{code}
and in the mojo inject the component via
{code:java}
/** @component role-hint="mng-4384" */
private SecDispatcher secDispatcher;
{code}
Note the role hints used here to avoid problematic clashes with the component instances from Maven core.

>  Can not use the plexus component org.sonatype.plexus.components.sec.dispatcher.SecDispatcher since maven 2.2.0
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: MNG-4384
>                 URL: http://jira.codehaus.org/browse/MNG-4384
>             Project: Maven 2 & 3
>          Issue Type: Bug
>    Affects Versions: 2.2.0, 2.2.1
>         Environment: linux
>            Reporter: Tony Chemit
>            Assignee: Benjamin Bentmann
>
> The SecDispatcher was callable from a plugin before 2.2.0, but not any longer :
> {noformat}
> Caused by: org.codehaus.plexus.component.composition.CompositionException: Composition failed of field sec in object of type org.nuiton.mail.plugin.SendEmailMojo because the requirement ComponentRequirement{role='org.sonatype.plexus.components.sec.dispatcher.SecDispatcher', roleHint='default', fieldName='sec'} was missing
>         at org.codehaus.plexus.component.composition.FieldComponentComposer.assignRequirementToField(FieldComponentComposer.java:154)
>         at org.codehaus.plexus.component.composition.FieldComponentComposer.assembleComponent(FieldComponentComposer.java:73)
>         at org.codehaus.plexus.component.composition.DefaultComponentComposerManager.assembleComponent(DefaultComponentComposerManager.java:68)
>         at org.codehaus.plexus.DefaultPlexusContainer.composeComponent(DefaultPlexusContainer.java:1486)
>         at org.codehaus.plexus.personality.plexus.lifecycle.phase.CompositionPhase.execute(CompositionPhase.java:29)
>         ... 26 more
> Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupException: Unable to lookup component 'org.sonatype.plexus.components.sec.dispatcher.SecDispatcherdefault', it could not be started
>         at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:339)
>         at org.codehaus.plexus.component.composition.FieldComponentComposer.assignRequirementToField(FieldComponentComposer.java:129)
>         ... 30 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.ClassicSingletonComponentManager.getComponent(ClassicSingletonComponentManager.java:92)
>         at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:331)
>         ... 31 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)
>         ... 34 more
> Caused by: org.codehaus.plexus.component.composition.CompositionException: Composition failed for the field _cipher in object of type org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher
>         at org.codehaus.plexus.component.composition.FieldComponentComposer.assignRequirementToField(FieldComponentComposer.java:144)
>         at org.codehaus.plexus.component.composition.FieldComponentComposer.assembleComponent(FieldComponentComposer.java:73)
>         at org.codehaus.plexus.component.composition.DefaultComponentComposerManager.assembleComponent(DefaultComponentComposerManager.java:68)
>         at org.codehaus.plexus.DefaultPlexusContainer.composeComponent(DefaultPlexusContainer.java:1486)
>         at org.codehaus.plexus.personality.plexus.lifecycle.phase.CompositionPhase.execute(CompositionPhase.java:29)
>         ... 36 more
> Caused by: java.lang.IllegalArgumentException: Can not set org.sonatype.plexus.components.cipher.PlexusCipher field org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher._cipher to org.sonatype.plexus.components.cipher.DefaultPlexusCipher
>         at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
>         at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
>         at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
>         at java.lang.reflect.Field.set(Field.java:657)
>         at org.codehaus.plexus.component.composition.FieldComponentComposer.assignRequirementToField(FieldComponentComposer.java:137)
>         ... 40 more
> {noformat}
> Brett told me on the list : 
> It looks like when they were added, they were not properly "hidden"  
> from plugin classes. So you will need to ensure you use the exact  
> version of the library that is used in Maven.

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