XmlJavaTypeAdapter和enunciate?

时间:2011-06-30 20:38:45

标签: java jax-rs enunciate

我很难在我的项目上运行Enunciate。该项目是一个多模块maven项目,可从https://svn.opentripplanner.org/trunk获得。我想要的只是API文档。没有其他的。我们过去常常通过Maven和Hudson工作,但它刚刚破坏了,并且设置它的人不可用。真的,我宁愿通过命令行界面来做这件事,但如果有人有Maven解决方案,我会接受它。

我的发音命令行是:

/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/`

我的enunciate.xml看起来像这样:

<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> 

我的发音输出是:

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 适应AgencyAndId。当我运行它时,实际代码工作得很好。我尝试使用XmlAdapter构建一个小型测试用例,适应随机Java类(JPanel),它工作正常。所以我无法弄清楚如何进一步减少问题。

我不认为有关Autowire / Component / etc的错误导致这种情况,因为如果我排除所有包含这些注释的文件(| xargs grep -L'Autowire | Component | Request'就在关闭反引号之前),我仍然得到错误的剩余部分。不过,修理这些也是件好事。

1 个答案:

答案 0 :(得分:1)

相关问题