2
我正在使用JiBX进行XML-Java数据绑定。当前的配置生成的类很好,但我希望这些生成的类实现java.io.Serializable。使数据模型类可串行化
这里是maven插件配置从给定模式生成java类。
<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>
This link建议使用org.jibx.schema.codegen.extend.SerializableDecorator
为了实现java.io.Serializable所有生成的类。但我不知道如何编写自定义文件并配置jibx-maven-plugin。
任何人都可以请指导我做到这一点?
您也可以选择将serial-version属性添加到class-decorator元素。它会像 –