Hello everyone, :-)

 

I'm currently writing a Maven plug-in again. And I'm experiencing some
add odd behavior.

Maybe I should add first that I'm currently executing my Mojo using the
MojoRule within a JUnit test.

The parameters of my Mojo are annotated using the @Parameter annotation
of Maven.

 

That annotation has a property name() (from the Javadoc):

 

name of the bean property used to get/set the field: by default, field
name is used.

 

So I thought I can use that when the name of the property in the Mojo
and in the POM file differ.

Let's say I have a Mojo property "hdd", but I want to use
"hardDiskDrive" in the POM file.

But it seems that Maven doesn't care for that annotation as I get an
error:

 

org.codehaus.plexus.component.configurator.ComponentConfigurationExcepti
on: Cannot find 'hardDiskDrive' in class test.example.MyMojo

                at
org.eclipse.sisu.plexus.CompositeBeanHelper.setProperty(CompositeBeanHel
per.java:252)

                at
org.codehaus.plexus.component.configurator.converters.composite.ObjectWi
thFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:10
1)

                at
org.codehaus.plexus.component.configurator.BasicComponentConfigurator.co
nfigureComponent(BasicComponentConfigurator.java:34)

                at
org.codehaus.plexus.component.configurator.AbstractComponentConfigurator
.configureComponent(AbstractComponentConfigurator.java:44)

                at
org.apache.maven.plugin.testing.AbstractMojoTestCase.lookupConfiguredMoj
o(AbstractMojoTestCase.java:484)

                at
org.apache.maven.plugin.testing.MojoRule.lookupConfiguredMojo(MojoRule.j
ava:197)

                [...]

 

Any ideas about that? Are annotations not evaluated by the classes used
by MojoRule?

 

I also realized that the property readonly() of the @Parameter
annotation is totally ignored in this scenerio.

 

Regards

Gerrit

 

Reply via email to