jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven 2 & 3
  • MNG-4384

Can not use the plexus component org.sonatype.plexus.components.sec.dispatcher.SecDispatcher since maven 2.2.0

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: 2.2.0, 2.2.1
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    linux
  • Complexity:
    Intermediate

Description

The SecDispatcher was callable from a plugin before 2.2.0, but not any longer :

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

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.

Issue Links

relates to

New Feature - A new feature of the product, which has yet to be developed. MRELEASE-648 Putting SVN password in settings.xml doesn't support password encryption

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

New Feature - A new feature of the product, which has yet to be developed. SCM-495 Support for encrypted passwords in settings.xml

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Benjamin Bentmann added a comment - 10/Feb/11 7:59 AM

Going forward, I would like plugins to eventually use o.a.m.s.crypto.SettingsDecrypter. 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:

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

and in the mojo inject the component via

/** @component role-hint="mng-4384" */
private SecDispatcher secDispatcher;

Note the role hints used here to avoid problematic clashes with the component instances from Maven core.

Show
Benjamin Bentmann added a comment - 10/Feb/11 7:59 AM Going forward, I would like plugins to eventually use o.a.m.s.crypto.SettingsDecrypter. 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:
<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>
and in the mojo inject the component via
/** @component role-hint="mng-4384" */
private SecDispatcher secDispatcher;
Note the role hints used here to avoid problematic clashes with the component instances from Maven core.
Hide
Permalink
Tony Chemit added a comment - 10/Feb/11 11:01 AM

When I will use maven 3.0.2 api I will use SettingsDecrypter component.

Thanks for your replies.

Show
Tony Chemit added a comment - 10/Feb/11 11:01 AM When I will use maven 3.0.2 api I will use SettingsDecrypter component. Thanks for your replies.
Hide
Permalink
Brett Porter added a comment - 20/Apr/11 6:27 AM

the settings decrypter won't let you decrypt anything not already decrypted by Maven (proxies, etc.), so I'm not sure if it's useful to plugins.

Also, the example above should be src/main/resources/META-INF/plexus/components.xml (plexus was omitted).

Here is a basis for it: http://svn.apache.org/repos/asf/maven/sandbox/trunk/examples/plugins/maven-security-mojo

Show
Brett Porter added a comment - 20/Apr/11 6:27 AM the settings decrypter won't let you decrypt anything not already decrypted by Maven (proxies, etc.), so I'm not sure if it's useful to plugins. Also, the example above should be src/main/resources/META-INF/plexus/components.xml (plexus was omitted). Here is a basis for it: http://svn.apache.org/repos/asf/maven/sandbox/trunk/examples/plugins/maven-security-mojo

People

  • Assignee:
    Benjamin Bentmann
    Reporter:
    Tony Chemit
Vote (0)
Watch (0)

Dates

  • Created:
    30/Sep/09 1:31 AM
    Updated:
    20/Apr/11 6:27 AM
    Resolved:
    10/Feb/11 7:59 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.