Unfortunately, this won't work for a number of reasons.
You will either need to:
a) provide an alternative configurator instead of a converter. It can
extend normal one, and then call "converterLookup.add( new
EarSecurityConverter() );" in its constructor. You'd add @configurator
<role-hint> to the mojo, and won't need the component definition below,
but instead a component definition for the configurator. The Cobertura
plugin *used* to do that if you look in its SVN history.
b) use a different type (I think PlexusConfiguration is valid one) that
you can convert by hand (it's basically a tree of nodes, attributes and
values).
Cheers,
Brett
Stephane Nicoll wrote:
> Hi guys,
>
> I am trying to implement a plexus converter to implement MEAR-8. I need to
> be able to retrieve a piece of XML from the pom, validate it and inject it
> in the auto-generated application.xml.
>
> Sample pom:
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-ear-plugin</artifactId>
> <configuration>
> <resourcesDir>${basedir}/META-INF</resourcesDir>
> <security>
> <security-role id="SecurityRole_1131964323008">
> <description></description>
> <role-name>manager</role-name>
> </security-role>
> <security-role id="SecurityRole_1131964323018">
> <description></description>
> <role-name>teller</role-name>
> </security-role>
> </security>
> </configuration>
> </plugin>
>
> I have create an EarSecurity POJO with a list of SecurityRole POJOs. This
> field is defined as a security parameter in the GenerateApplicationXmlMojo
>
> /**
> * The security-roles to be added to the auto-generated
> * application.xml file.
> *
> * @parameter
> */
> private EarSecurity security;
>
> I am now trying to register my converter so I put the following in
> src/main/resources/META-INF/plexus/components.xml:
>
> <plexus>
> <components>
> <component>
> <role>
> org.codehaus.plexus.component.configurator.converters.basic.AbstractBasicConverter
> </role>
> <role-hint>EarSecurity</role-hint>
> <implementation>
> org.apache.maven.plugin.ear.security.EarSecurityConverter</implementation>
> </component>
> </components>
> </plexus>
>
> However, If I try to use my security param locally, it still uses the
> default converter
>
> Caused by:
> org.codehaus.plexus.component.configurator.ComponentConfigurationException:
> Cannot find setter nor field in
> org.apache.maven.plugin.ear.security.EarSecurity for 'securityRole'
> at
> org.codehaus.plexus.component.configurator.converters.ComponentValueSetter
> .<init>(ComponentValueSetter.java:68)
> at
> org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration
> (ObjectWithFieldsConverter.java:134)
> at
> org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.fromConfiguration
> (ObjectWithFieldsConverter.java:90)
> at
> org.codehaus.plexus.component.configurator.converters.ComponentValueSetter.configure
> (ComponentValueSetter.java:247)
> at
> org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration
> (ObjectWithFieldsConverter.java:137)
> at
> org.codehaus.plexus.component.configurator.BasicComponentConfigurator.configureComponent
> (BasicComponentConfigurator.java:56)
> at org.apache.maven.plugin.DefaultPluginManager.populatePluginFields
> (DefaultPluginManager.java:1030)
>
>
> Can anyone help me?
>
> Thanks,
> Stéphane
>
> --
> .::You're welcome ::.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]