java - XmlJavaTypeAdapter 并阐明?

标签 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' 就在结束反引号之前),我仍然收到错误的其余部分。不过,解决这些问题也很好。

最佳答案

关于java - XmlJavaTypeAdapter 并阐明?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6540842/

相关文章:

php - 如何记录基于 Symfony 的 REST API(类似于 enunciate 的文档功能)

java - 我应该如何在 Selenium 的一种方法中检查 5 次有效登录?

java改变变量参数值

java - CXF JAX-RS 客户端代理不维护 cookie

rest - 当我创建新的 RESTful Web 服务时,Netbeans 不会创建 ApplicationConfig.java

java - 从 enunciate doc 工具中排除一些剩余方法

java - 修改 Enunciate 生成的配置文件以使用 CXF 的最新 jackson 库

java - 如何删除 FileOutputStream 创建的文件

java - java泛型可以做我想要的吗?

java - resteasy 和 multipart/form-data 请求的最大文件大小