I need to use custom type, e.g., LunarDate
, in my Mojo object:
class MyMojo extends AbstractMojo {
/** @parameter */
LunarDate lunarDate;
For newer Maven (tested with Maven 3.3.1) you can now subclass BasicComponentConfigurator
to access the DefaultConverterLookup
as a member variable:
@Component(role = ComponentConfigurator.class, hint = "basic")
public class ExtendedComponentRegistrator
extends BasicComponentConfigurator
implements Initializable {
@Override
public void initialize() throws InitializationException {
converterLookup.registerConverter(new MyCustomConverter());
}
}
Then in the pom.xml enable the generation of plexus meta data:
org.codehaus.plexus
plexus-component-metadata
generate-metadata