【发布时间】:2021-02-12 14:42:37
【问题描述】:
我的 Maven MOJO 插件中有以下属性:
@Mojo(name = "generate", defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true)
public class GraphQLCodegenMojo extends AbstractMojo {
@Parameter
private Map<String, String> customTypesMapping;
}
我一般是这样设置的(基于Maven guide):
<customTypesMapping>
<DateTime>java.util.Date</DateTime>
</customTypesMapping>
现在我想允许插件用户提供特殊字符作为地图key。
我尝试了不同的方法,但它们都不起作用:
<customTypesMapping>
<DateTime!>java.util.Date</DateTime!>
<DateTime!>java.util.Date</DateTime!>
<customTypeMapping>
<name>DateTime</key>
<value>java.util.Date</value>
</customTypeMapping>
</customTypeMapping>
是否有向后兼容的方式来更改我的 maven 插件(不破坏现有客户端)?
【问题讨论】:
标签: xml maven pom.xml maven-plugin maven-mojo