Create a New Doxia Macro
A macro is a JSR-330 component named after the macro. Set up the project that contains it as described in How to use JSR-330: a javax.inject dependency and the sisu-maven-plugin index.
You should implement the AbstractMacro class:
import javax.inject.Named;
import javax.inject.Singleton;
import org.apache.maven.doxia.macro.AbstractMacro;
import org.apache.maven.doxia.macro.MacroExecutionException;
import org.apache.maven.doxia.macro.MacroRequest;
import org.apache.maven.doxia.sink.Sink;
@Singleton
@Named("my")
public class MyMacro
extends AbstractMacro
{
...
public void execute( Sink sink, MacroRequest request )
throws MacroExecutionException
{
String myValue = (String) request.getParameter( "myParam" );
...
}
...
}
To use it, you need to write the following markups:
-
APT
%{my|myParam=myValue} <!-- my is the macro name set by @Named --> -
XDoc
<macro name="my"> <!-- my is the required macro name set by @Named --> <param name="myParam" value="myValue"/> </macro>

