- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在我的项目上运行 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/
有没有办法在 XmlAdapter 中抛出用户定义的异常并在 JAXB 编码/解码时捕获它们?我的意思是,我可以抛出自己的异常,但 JAXB 只是忽略此异常并抛出他自己的异常,我无法从中获取异常消息或
XmlJavaTypeAdapter 能否从 ClassA 对象编码(marshal)至 ClassB 对象?所以当: public void createClassB (ClassB b) { }
我有以下需要序列化为 XML 的类: @XmlAccessorType(XmlAccessType.FIELD) public class Position { @XmlElement(nam
我在我的项目上运行 Enunciate 时遇到了困难。该项目是一个多模块maven项目,可从https://svn.opentripplanner.org/trunk获取。我想要的只是 API 文档。
我不想在我的代码中直接对 XmlAdapter 的类使用 XmlJavaTypeAdapter 注释。所以,我写了一些包装器: class BinderWrapper extends XmlAdapt
JAXB 提示类 X“...没有无参数默认构造函数。” 在我的例子中,类 X 是数十个自动生成、最终类之一,这些类确实没有无参数默认构造函数。它还碰巧扩展了一个抽象类,如果我愿意的话,我可以对其进行修
我为异常层次结构中的每个异常定义了一个 XmlJavaTypeAdapter。我使用包装器对象来编码异常,如下所示:- @XmlRootElement public Wrapper { T e
希望对 JAXB 专家来说是一个简单的方法: 我正在尝试编码(marshal)一个不定义默认无参数构造函数的不可变类。我已经定义了一个 XmlAdapter 实现,但它似乎没有被拾取。我整理了一个简单
我一直在努力拥有 @XMLJavaTypeAdapter使其按照我的需要工作。我的理解可能有误。请帮助我更好地理解。 要求: 例如: 我有一个带有映射对象列表的传输 XML,如下所示:
我正在使用 CXF 将我的 Web 应用程序转换为 Web 服务。我的 Web 应用程序构建了作为枚举工作的类。示例: package test.javabean; import java.util.
我的package-info.java中有以下内容: @XmlJavaTypeAdapters({ @XmlJavaTypeAdapter(type=OffsetDateTime.class,
当调用 JAXB.marshal 时,我使用 AdapterDataObj 类将 DataObj 类转换为 AdaptedDataObj。 package test; import javax.xml
我有课: public class FooImpl extends Foo { @XmlJavaTypeAdapter(ListXmlAdapter.class) @Override
我正在使用 Spring Boot/JAX-WS (CXF) 创建肥皂网络服务我想加密一个字段。我为此使用 XmlJavaTypeAdapter。例如: @XmlJavaTypeAdapter(
我有一个如下所示的 xml,我需要使用此 xml 来填充下面的对象我需要日期采用所需的格式和日期的时间戳转换。我使用下面提到的代码做到了这一点。 john 10/10/18 @Xm
我有这种情况 @XmlType(name ="", propOrder={"value"}) @XmlRootElement(name = "compound") public class Compo
我研究过Blaise Doughan's answer to a question on this subject但还有一个问题。 XmlJavaTypeAdapters 允许您列出一堆 XmlJav
我正在使用 Spring REST 框架和 Jackson JSON public class JaxbJacksonObjectMapper extends ObjectMapper
我在使用 JAXB 解码时遇到一个小问题,因为我的输入 XML 可以由两个元素之一包装,例如: 1 2
我要上三门课 @XmlRootElement public class GeofenceParameter{ private GeofenceCenterAddress geofenceCen
我是一名优秀的程序员,十分优秀!