OK, I'm answering my own question. Found the maven code that evaluates the expressions, and it seems that the string "plugin" does not get evaluated, but strings starting with "plugin." such as "plugin.version" DO get evaluated. The eBook "Better Builds With Maven" indicates (in A.2.1) that ${plugin} should work. Is this a bug?
On 1/11/07, Thierry Lach <[EMAIL PROTECTED]> wrote:
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?