Maven Annotation API @Parameter.name() method seems to not work

232 views Asked by At

I'm developing a Maven 3 plugin by using Groovy together with Maven Annotation Support. In a Mojo class, it seems that name or alias of @Parameter aren't reflected during the runtime:

@Parameter(required = true, name = "pathAsAName", alias = "pathAsAnAlias")
File pathAsAField

The only way to set the field from the Maven XML configuration is by using

<configuration>
      <pathAsAField>/tmp</pathAsAField>
</configuration>

and not by using <pathAsAName> (or <pathAsAnAlias> which I'm not sure what it is exactly for) regardless of the fact that plugin.xml contains

<parameter>
      <name>pathAsAName</name>
      <alias>pathAsAnAlias</alias>
      <type>java.io.File</type>
      <required>true</required>
      <editable>true</editable>
      <description></description>
</parameter>

When I use <pathAsAName>/tmp</pathAsAName> I get an error:

[ERROR] Failed to execute goal ... on project ...: Unable to parse configuration of mojo ...:...:...:... for parameter pathAsAName: Cannot find 'pathAsAName' in class ... -> [Help 1]

I'm using maven-core:3.3.3 and maven-plugin-annotations:3.4. And execute it with Maven 3.3.3.

0

There are 0 answers