简体   繁体   中英

XmlJavaTypeAdapter and enunciate?

I'm having a hard time running Enunciate on my project. The project is a multi-module maven project, available from https://svn.opentripplanner.org/trunk . All I want out of enunciate is API docs. Nothing else. We used to have this working via Maven and Hudson, but it broke a while ago, and the person who set it up isn't available. Really, I would prefer to do this via the command-line interface, but if someone has a Maven solution, I'll take it.

My enunciate command-line is:

/home/novalis/otp/enunciate-1.23/bin/enunciate -v -f /home/novalis/otp/workspace/opentripplanner/opentripplanner-api-webapp/enunciate.xml `find /home/novalis/otp/workspace/opentripplanner/ -name *.java -type f |grep -v /test/`

My enunciate.xml looks like this:

<enunciate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.17.xsd"> 
  <services> 
    <rest> 
      <content-types> 
        <content-type type="text/plain" id="txt"/> 
      </content-types> 
    </rest> 
  </services> 
  <modules> 
    <c disabled="true"/> 
    <obj-c disabled="true"/> 
    <csharp disabled="true"/> 
    <jaxws-client disabled="true"/> 
    <docs title="OpenTripPlanner API"
          base="src/main/resources/docs-theme"/>
  </modules> 
</enunciate> 

And my enunciate output is:

initializing enunciate.
invoking enunciate:generate step...
error: Could not create declaration for annotation type Autowire
error: Could not create declaration for annotation type Component
error: Could not create declaration for annotation type Autowired
error: Could not create declaration for annotation type Required
4 errors
Exception in thread "main" org.codehaus.enunciate.contract.validation.ValidationException: /home/novalis/otp/workspace/opentripplanner/opentripplanner-routing/src/main/java/org/opentripplanner/routing/patch/StopNotePatch.java:58: stop: adapter org.opentripplanner.routing.patch.AgencyAndIdAdapter does not adapt AgencyAndId
    at org.codehaus.enunciate.contract.jaxb.adapters.AdapterUtil.findAdapterType(AdapterUtil.java:134)
    at org.codehaus.enunciate.contract.jaxb.adapters.AdapterUtil.findAdapterType(AdapterUtil.java:57)
[more traceback snipped]

AgencyAndIdAdapter does adapt AgencyAndId. The actual code works just fine when I run it. I've tried building a tiny test case with XmlAdapter adapting a random Java class (JPanel), and it works fine. So I can't figure out how to reduce the problem further.

I don't think the errors about Autowire/Component/etc are causing this, because if I exclude all files that contain those annotations (|xargs grep -L 'Autowire|Component|Request' just before the closing backtick), I still get the remainder of the error. Still, it would be good to fix those, too.

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