我很難在我的項目上運行Enunciate。該項目是一個多模塊maven項目,可從https://svn.opentripplanner.org/trunk獲得。我想要發表的所有內容都是API文檔。沒有其他的。我們過去曾經通過Maven和Hudson進行這項工作,但之前它已經破產了,並且設置它的人不可用。真的,我寧願通過命令行界面來做到這一點,但如果有人有Maven解決方案,我會接受。XmlJavaTypeAdapter並聲明?
我字正腔圓的命令行是:
/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。當我運行它時,實際的代碼工作得很好。我已經嘗試用適應隨機Java類(JPanel)的XmlAdapter構建一個小測試用例,並且它工作正常。所以我無法弄清楚如何進一步減少問題。
我不認爲有關Autowire/Component/etc的錯誤會導致這種情況,因爲如果我排除包含這些註釋的所有文件(| xargs grep -L'Autowire | Component | Request'就在關閉反向符號之前) ,我仍然得到錯誤的其餘部分。不過,解決這些問題也很好。
我問在郵件列表上,顯然補丁正在開發中。 – novalis