简体   繁体   中英

Gradle - Generating serializable classes with jaxb

I'm using gradle as build tool and configuring jaxb plugin jacobono. Have the below entry in build.gradle file:

jaxb {
  bindingsDir = "src/main/resources/xjb"
  xjc {
   xsdDir = "src/main/resources/xsd"
   generatePackage = "some.package"
  }
}

under xjb directory, have binding.xml with the below content:

<?xml version="1.0" encoding="UTF-8"?>
<bindings xmlns="http://java.sun.com/xml/ns/jaxb"
        xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
        xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
        xsi:schemaLocation="
 http://java.sun.com/xml/ns/jaxb      
 http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
 version="2.1">
   <globalBindings>
     <serializable uid="1" />
   </globalBindings>
 </bindings>

Although the files are getting generated, none of them implements serializable interface as i have defined in binding xml. I doubt on the binding dir configurations.

Any advice will be much helpful.

Moved the binding information to xsds, and it worked.

Not sure whether the plugin works properly with binging dir paramter as it didnt work even with absolute path.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM