我正在使用 maven 插件 avro-maven-plugin (1.9.2) 从 AVRO-schema-file (avsc) 生成 Java 类。我正在定义一个日期字段,如下所示:
{
"name": "inceptionDate",
"type": "int",
"logicalType": "date"
}
我面临的问题是,它生成一个int而不是Date或LocalDate。
private int inceptionDate;
pom.xml 配置定义如下:
<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>1.9.2</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>schema</goal>
</goals>
<configuration>
<dateTimeLogicalTypeImplementation>JSR310</dateTimeLogicalTypeImplementation>
<sourceDirectory>${project.basedir}/src/main/resources/schema/</sourceDirectory>
<outputDirectory>${project.build.directory}/generated-sources/main/java/</outputDirectory>
<stringType>String</stringType>
<fieldVisibility>PRIVATE</fieldVisibility>
</configuration>
</execution>
</executions>
</plugin>
任何想法,有什么问题?