-----Original Message-----
From: devs-bounces(a)xwiki.org [mailto:devs-bounces@xwiki.org] On Behalf
Of Vincent Massol
Sent: Wednesday, May 13, 2009 1:54 PM
To: XWiki Developers
Subject: Re: [xwiki-devs] Creating a macro component
On May 13, 2009, at 10:52 PM, <glenn_engel(a)agilent.com>
<glenn_engel(a)agilent.com
wrote:
> -----Original Message-----
> From: devs-bounces(a)xwiki.org [mailto:devs-bounces@xwiki.org] On
> Behalf
> Of Vincent Massol
> Sent: Wednesday, May 13, 2009 1:33 PM
> To: XWiki Developers
> Subject: Re: [xwiki-devs] Creating a macro component
>
> Hi Glenn,
>
> On May 13, 2009, at 10:22 PM, <glenn_engel(a)agilent.com>
> <glenn_engel(a)agilent.com
>> wrote:
>
>> I'm having a difficult time adding a java macro and getting it to
>> get invoked.
>>
>>
>>
>> I first found this page and created my class and created a META-
INF/
>> plexus/components.xml per the
'tutorial' here:
>
http://dev.xwiki.org/xwiki/bin/view/Drafts/Tutorial+to+Write+a+Macro+in
+the+new+rendering+engine
I then found this tutorial for components
(
http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingComponents
) and created a META-INF/components.txt file and
added an
@Component("mymacro") annotation to the macro implementation.
Both ways are correct. The annotation way is the newer way of doing
it
though.
However, I am unable to get my macro code to get
called when pages
are rendered.
What version of XE are you using?
I'm using XE 1.8.2
What error do you get?
I don't get any error at all. The macro just shows up on the page as
I spelled it: {mymacro}
Are you using xwiki syntax 2.0 for that page?
If so the syntax is {{mymacro/}}
Yes, I tried that form as well. Is the 2.0 syntax automatically recognized or is there a
switch somewhere?
It must be something simple but I just can't see where it's going wrong. Is there
an example zip of a java macro I could build to test with?
Is there an easy way to list recognized
components?
From java yes, from velocity no. From java just implement Composable
and call lookupList(Macro.ROLE) on the component manager.