You need to add the following plugin configuration to generate the correct Plexus component.xml file for the project containing your macro:
<project>
...
<build>
...
<plugins>
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
...
</build>
...
</project>You should implement the AbstractMacro class:
import org.apache.maven.doxia.macro.AbstractMacro;
/**
* @plexus.component role="org.apache.maven.doxia.macro.Macro" role-hint="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:
%{my|myParam=myValue} <!-- my is the macro name defined by role-hint --><macro name="my"> <!-- my is the required macro name defined by role-hint --> <param name="myParam" value="myValue"/> </macro>