You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Edelson, Justin" <Ju...@mtvstaff.com> on 2008/09/04 03:47:10 UTC
Stuck on custom wagon and plexus
I'm writing a Maven plugin that requires a customized version of the SCP Wagon. While I've written a number of plugins in the past, this is the first time I've tried to create a Plexus component and I seem to be stuck.
Here's what I've done:
* In one project, I have a class (...JschTunnelWagon), an interface (...TunnelWagon), and a components.xml file (in src/main/resources/plexus) with this content:
<component-set>
<components>
<component>
<role>org.apache.maven.wagon.Wagon</role>
<role-hint>ssh-pf</role-hint>
<implementation>com.mtvi.plateng.maven.wagon.JschTunnelWagon</implementation>
[other configuration]
</component>
</components>
</component-set>
* In my plugin project, I depend upon the first project and do this:
/**
* The Tunneling Wagon.
*
* @parameter expression="${component.org.apache.maven.wagon.Wagon#ssh-pf}"
* @required
* @readonly
*/
private TunnelWagon wagon;
When I try to execute my mojo, I get this error:
Component descriptor cannot be found in the component repository: org.apache.maven.wagon.Wagonssh-pf.
With -X, I see this:
Caused by: org.codehaus.plexus.component.composition.CompositionException: Composition failed of field wagon in object of type com.mtvi.plateng.maven.utils.TunnelCreatorMojo because the requirement ComponentRequirement{role='org.apache.maven.wagon.Wagon', roleHint='ssh-pf', fieldName='wagon'} was missing
I'm sure I'm missing something simple, but if anyone can help, I'd appreciate it.
Thanks,
Justin
Re: Stuck on custom wagon and plexus
Posted by Brett Porter <br...@gmail.com>.
this could be a classloading issue.
How are you instantiating the wagon, and how are you declaring it to Maven
(is it just a dependency of the plugin?)
- Brett
2008/9/4 Edelson, Justin <Ju...@mtvstaff.com>
> Thanks Brett. I knew it was something simple.
>
> That got me one step further, now I'm getting:
> Caused by: org.codehaus.plexus.component.composition.CompositionException:
> Composition failed for the field knownHostsProvider in object of type
> com.mtvi.plateng.maven.wagon.JschTunnelWagon
> 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)
> ... 35 more
> Caused by: java.lang.IllegalArgumentException
> at
> sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
> at java.lang.reflect.Field.set(Field.java:656)
> at
> org.codehaus.plexus.component.composition.FieldComponentComposer.assignRequirementToField(FieldComponentComposer.java:137)
> ... 39 mor
>
> knownHostsProvider is a field in AbstractJschWagon, which is extended by
> ScpWagon, which my class then extends. I basically just copied the component
> configuration from that of ScpWagon
>
>
>
>
> ________________________________
>
> From: Brett Porter [mailto:brett.porter@gmail.com]
> Sent: Wed 9/3/2008 9:57 PM
> To: Maven Users List
> Subject: Re: Stuck on custom wagon and plexus
>
>
>
> Is the resource really in that directory?
> It should be src/main/resources/META-INF/plexus/components.xml instead :)
>
> Cheers,
> Brett
>
> 2008/9/4 Edelson, Justin <Ju...@mtvstaff.com>
>
> > I'm writing a Maven plugin that requires a customized version of the SCP
> > Wagon. While I've written a number of plugins in the past, this is the
> first
> > time I've tried to create a Plexus component and I seem to be stuck.
> >
> > Here's what I've done:
> > * In one project, I have a class (...JschTunnelWagon), an interface
> > (...TunnelWagon), and a components.xml file (in
> src/main/resources/plexus)
> > with this content:
> > <component-set>
> > <components>
> > <component>
> > <role>org.apache.maven.wagon.Wagon</role>
> > <role-hint>ssh-pf</role-hint>
> >
> >
> <implementation>com.mtvi.plateng.maven.wagon.JschTunnelWagon</implementation>
> >
> > [other configuration]
> >
> > </component>
> > </components>
> > </component-set>
> > * In my plugin project, I depend upon the first project and do this:
> > /**
> > * The Tunneling Wagon.
> > *
> > * @parameter
> > expression="${component.org.apache.maven.wagon.Wagon#ssh-pf}"
> > * @required
> > * @readonly
> > */
> > private TunnelWagon wagon;
> >
> > When I try to execute my mojo, I get this error:
> > Component descriptor cannot be found in the component repository:
> > org.apache.maven.wagon.Wagonssh-pf.
> >
> > With -X, I see this:
> > Caused by:
> org.codehaus.plexus.component.composition.CompositionException:
> > Composition failed of field wagon in object of type
> > com.mtvi.plateng.maven.utils.TunnelCreatorMojo because the requirement
> > ComponentRequirement{role='org.apache.maven.wagon.Wagon',
> roleHint='ssh-pf',
> > fieldName='wagon'} was missing
> >
> > I'm sure I'm missing something simple, but if anyone can help, I'd
> > appreciate it.
> >
> > Thanks,
> > Justin
> >
> >
>
>
> --
> Brett Porter
> Blog: http://blogs.exist.com/bporter/
>
>
>
--
Brett Porter
Blog: http://blogs.exist.com/bporter/
RE: Stuck on custom wagon and plexus
Posted by "Edelson, Justin" <Ju...@mtvstaff.com>.
Thanks Brett. I knew it was something simple.
That got me one step further, now I'm getting:
Caused by: org.codehaus.plexus.component.composition.CompositionException: Composition failed for the field knownHostsProvider in object of type com.mtvi.plateng.maven.wagon.JschTunnelWagon
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)
... 35 more
Caused by: java.lang.IllegalArgumentException
at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
at java.lang.reflect.Field.set(Field.java:656)
at org.codehaus.plexus.component.composition.FieldComponentComposer.assignRequirementToField(FieldComponentComposer.java:137)
... 39 mor
knownHostsProvider is a field in AbstractJschWagon, which is extended by ScpWagon, which my class then extends. I basically just copied the component configuration from that of ScpWagon
________________________________
From: Brett Porter [mailto:brett.porter@gmail.com]
Sent: Wed 9/3/2008 9:57 PM
To: Maven Users List
Subject: Re: Stuck on custom wagon and plexus
Is the resource really in that directory?
It should be src/main/resources/META-INF/plexus/components.xml instead :)
Cheers,
Brett
2008/9/4 Edelson, Justin <Ju...@mtvstaff.com>
> I'm writing a Maven plugin that requires a customized version of the SCP
> Wagon. While I've written a number of plugins in the past, this is the first
> time I've tried to create a Plexus component and I seem to be stuck.
>
> Here's what I've done:
> * In one project, I have a class (...JschTunnelWagon), an interface
> (...TunnelWagon), and a components.xml file (in src/main/resources/plexus)
> with this content:
> <component-set>
> <components>
> <component>
> <role>org.apache.maven.wagon.Wagon</role>
> <role-hint>ssh-pf</role-hint>
>
> <implementation>com.mtvi.plateng.maven.wagon.JschTunnelWagon</implementation>
>
> [other configuration]
>
> </component>
> </components>
> </component-set>
> * In my plugin project, I depend upon the first project and do this:
> /**
> * The Tunneling Wagon.
> *
> * @parameter
> expression="${component.org.apache.maven.wagon.Wagon#ssh-pf}"
> * @required
> * @readonly
> */
> private TunnelWagon wagon;
>
> When I try to execute my mojo, I get this error:
> Component descriptor cannot be found in the component repository:
> org.apache.maven.wagon.Wagonssh-pf.
>
> With -X, I see this:
> Caused by: org.codehaus.plexus.component.composition.CompositionException:
> Composition failed of field wagon in object of type
> com.mtvi.plateng.maven.utils.TunnelCreatorMojo because the requirement
> ComponentRequirement{role='org.apache.maven.wagon.Wagon', roleHint='ssh-pf',
> fieldName='wagon'} was missing
>
> I'm sure I'm missing something simple, but if anyone can help, I'd
> appreciate it.
>
> Thanks,
> Justin
>
>
--
Brett Porter
Blog: http://blogs.exist.com/bporter/
Re: Stuck on custom wagon and plexus
Posted by Brett Porter <br...@gmail.com>.
Is the resource really in that directory?
It should be src/main/resources/META-INF/plexus/components.xml instead :)
Cheers,
Brett
2008/9/4 Edelson, Justin <Ju...@mtvstaff.com>
> I'm writing a Maven plugin that requires a customized version of the SCP
> Wagon. While I've written a number of plugins in the past, this is the first
> time I've tried to create a Plexus component and I seem to be stuck.
>
> Here's what I've done:
> * In one project, I have a class (...JschTunnelWagon), an interface
> (...TunnelWagon), and a components.xml file (in src/main/resources/plexus)
> with this content:
> <component-set>
> <components>
> <component>
> <role>org.apache.maven.wagon.Wagon</role>
> <role-hint>ssh-pf</role-hint>
>
> <implementation>com.mtvi.plateng.maven.wagon.JschTunnelWagon</implementation>
>
> [other configuration]
>
> </component>
> </components>
> </component-set>
> * In my plugin project, I depend upon the first project and do this:
> /**
> * The Tunneling Wagon.
> *
> * @parameter
> expression="${component.org.apache.maven.wagon.Wagon#ssh-pf}"
> * @required
> * @readonly
> */
> private TunnelWagon wagon;
>
> When I try to execute my mojo, I get this error:
> Component descriptor cannot be found in the component repository:
> org.apache.maven.wagon.Wagonssh-pf.
>
> With -X, I see this:
> Caused by: org.codehaus.plexus.component.composition.CompositionException:
> Composition failed of field wagon in object of type
> com.mtvi.plateng.maven.utils.TunnelCreatorMojo because the requirement
> ComponentRequirement{role='org.apache.maven.wagon.Wagon', roleHint='ssh-pf',
> fieldName='wagon'} was missing
>
> I'm sure I'm missing something simple, but if anyone can help, I'd
> appreciate it.
>
> Thanks,
> Justin
>
>
--
Brett Porter
Blog: http://blogs.exist.com/bporter/