I need to use custom type, e.g., LunarDate
, in my Mojo object:
class MyMojo extends AbstractMojo {
/** @parameter */
LunarDate lunarDate;
DefaultBeanConfigurator
is responsible for using DefaultConverterLookup
, and it instantiates it directly without using the Plexus Container.
You could I suppose copy and modify it in a build extension, but registering your copy via @Component(role=BeanConfigurator.class)
will likely have no effect; I have tried replacing standard Maven components in the past from build extensions and been told on maven-dev that it is not possible.
You could look up the default BeanConfigurator
and use reflection to get its ConverterLookup converterLookup
field, then call registerConverter
with your custom convertor, but this would be fragile.
Probably best is to just give up, declare your Mojo parameter to be of type String
, and do the conversion explicitly in execute
.