Warning - m2 programming noobie here.

I'm trying to write a very simple mojo to display a message which will
include the version number of the plugin.

I use the following annotations to access the plugin:

   /**
   * Plugin descriptor.
   * @parameter default-value="${plugin}"
   * @required
   * @readonly
   */
   private PluginDescriptor plugin;

and I do get a PluginDescriptor, but I find that it is completely empty.

       getLog().info("Plugin: " +
ReflectionToStringBuilder.reflectionToString(plugin,
ToStringStyle.MULTI_LINE_STYLE));

displays

[INFO] Plugin: [EMAIL PROTECTED]
 groupId=<null>
 artifactId=<null>
 version=<null>
 goalPrefix=<null>
 source=<null>
 inheritedByDefault=true
 artifacts=<null>
 lifecycleMappings=<null>
 classRealm=<null>
 artifactMap=<null>
 introducedDependencyArtifacts=<null>
 name=<null>
 description=<null>
 components=<null>
 dependencies=<null>
 isolatedRealm=false
 id=<null>
]

Am I trying the wrong approach?

Reply via email to