Hi John,
Thanks for your reply. I figured out that the actual reference is
injected by org.codehaus.plexus.component.factory.ant.AntScriptInvoker
into the ant project with
references.put(rd.getRole() + "_" + rd.getRoleHint(), rv);
In my case getRoleHint returns null, so the ant project reference is
getProject().getReference("org.apache.maven.project.MavenProjectHelper_null");
I could not find out how to set the rolehint in my <mojo>.mojo.xml file.
I tried:
...
<components>
<component>
<role>org.apache.maven.project.MavenProjectHelper</role>
<hint>projectHelper</hint>
</component>
</components>
...
But this seemed not to be picked up.
I got the impression that the component setting was not used at all.
What helped me was to define a parameter as in
...
<parameter>
<name>projectHelper</name>
<property>projectHelper</property>
<required>true</required>
<readonly>true</readonly>
<expression>${component.org.apache.maven.project.MavenProjectHelper}</expression>
<type>org.apache.maven.project.ProjectHelper</type>
<description>maven project helper object</description>
</parameter>
...
The latter was translated into an requirement section in
classes/META-INF/maven/plugin.xml:
...
<requirements>
<requirement>
<role>org.apache.maven.project.MavenProjectHelper</role>
<field-name>projectHelper</field-name>
</requirement>
</requirements>
...
Can you help me out here?
Thanks.
Martin
John Casey wrote:
Inside your task, you'll need to use
getProject().getReference("org.apache.maven.project.MavenProjectHelper")
IIRC.
If that doesn't work, let me know, and I'll dig around in the code.
-john
Martin van der Plas wrote:
Hi,
According to
http://maven.apache.org/guides/plugin/guide-ant-plugin-development.html
it is possible to define plexus components.
The hint does not describe how the component needs to be refered to.
I would like to use the maven ProjectHelper in an anttask. How can I
pass the ProjectHelper object to my task?
Thanks.
Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]