我正在使用 JiBX 进行 XML-Java 数据绑定。当前配置生成的类非常好,但我希望这些生成的类实现 java.io.Serializable。
这是从给定模式生成 java 类的 Maven 插件配置。
<plugin>
<groupId>org.jibx</groupId>
<artifactId>jibx-maven-plugin</artifactId>
<version>1.2.3</version>
<configuration>
<schemaLocation>src/main/resources</schemaLocation>
<includeSchemas>
<includeSchema>FS_OTA_VehResRS.xsd</includeSchema>
</includeSchemas>
<options>
<package>com.test.cars.model.ota2009a.vehresrs</package>
</options>
<schemaBindingDirectory>src/main/java</schemaBindingDirectory>
<includeSchemaBindings>
<includeSchemaBinding>*_binding.xml</includeSchemaBinding>
</includeSchemaBindings>
</configuration>
<executions>
<execution>
<id>generate-java-code-from-schema</id>
<goals>
<goal>schema-codegen</goal>
</goals>
</execution>
<execution>
<id>compile-the-binding-</id>
<goals>
<goal>bind</goal>
</goals>
</execution>
</executions>
</plugin>
此链接建议使用org.jibx.schema.codegen.extend.SerializableDecorator
以便对所有生成的类实现 java.io.Serializable。但我不知道如何编写自定义文件和配置 jibx-maven-plugin。
谁能指导我实现这一目标?