Hi,

the docs are not up-to-date, all issues have been migrated to http://issues.apache.org/jira/browse/MPLUGINTESTING You are correct that there's not a lot of activity on this subproject, because most of our Maven Plugins use the Maven Invoker Plugin for testing. It's all a matter of priority.

thanks,
Robert

On Mon, 16 Apr 2018 09:26:08 +0200, <g.h...@aurenz.de> wrote:

Hello everyone,

after trying different approaches and seeing the efforts needed I give up on this. Especially as I realized that the maven-plugin-testing-harness latest version 3.3.0 was realized at 2014-12-17. I thought about opening an issue in the issue tracking system of the project, just to realize that they had it at Codehaus, which closed its doors some time ago.

Hopefully someone of the "Maven Plugin Testing Mechanism" will read this.

Until then proper Maven Plug-in testing is not possible using JUnit - especially not if it is in the IDE (Eclipse+M2E) and not during the Maven build.

Regards,
Gerrit

-----Ursprüngliche Nachricht-----
Von: g.h...@aurenz.de [mailto:g.h...@aurenz.de]
Gesendet: Freitag, 13. April 2018 15:53
An: users@maven.apache.org
Betreff: AW: Writing own plugin: The parameter annotation - does it work?

Hello everyone,

after some analyzing I realized that the MojoRule is trying to read the plug-in description. This file is created during the build process by the maven-plugin-plugin and is located:
target\classes\META-INF\maven\plugin.xml
If I only execute the test via JUnit in Eclipse that files - of course - isn't created.
So I let the build run one time.
Now I have the information of the @Parameter annotation there.
And somehow I'm sure that annotation won't be touched at any other time than when that maven-plugin-plugin is creating the plugin.xml...

The file is now present and I also saw that MojoRule is reading it.
But it seems it isn't using it as the error is still there.

Any ideas?


Regards,
Gerrit

-----Ursprüngliche Nachricht-----
Von: g.h...@aurenz.de [mailto:g.h...@aurenz.de]
Gesendet: Freitag, 13. April 2018 15:02
An: users@maven.apache.org
Betreff: Writing own plugin: The parameter annotation - does it work?

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



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to