Enunciate Issue =组装发音应用程序。 com.sun.tools.apt.mirror.type.ClassTypeImpl无法强制转换为com.sun.mirror.type.AnnotationType

时间:2015-06-05 14:24:39

标签: java maven enunciate

我希望我的Enunciate报告包含所有模型类的Json示例,测试它我修改了enunciate配置以包含json示例并更改了我的模型类

    @XmlRootElement(name = "member-response")
    public class MemberResponse

    @JsonRootType
    @JsonName("MemberResponse")
    @XmlRootElement
    public class MemberResponse

然后构建了maven项目并运行

mvn -o clean pre-site site:site site:stage -Prest-reports -PskipQuality -DskipTests=true -U 

获取以下类强制转换异常

  

(com.sun.tools.apt.mirror.type.ClassTypeImpl无法强制转换为com.sun.mirror.type.AnnotationType) -

为什么@JsonRootType不被enunicate识别。?请建议

[ERROR] Failed to execute goal org.codehaus.enunciate:maven-enunciate-plugin:1.27:docs (default) on project endeavour-application-resource: Problem assembling the enunciate app. com.sun.tools.apt.mirror.type.ClassTypeImpl cannot be cast to com.sun.mirror.type.AnnotationType -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.enunciate:maven-enunciate-plugin:1.27:docs (default) on project XXXXXXX-application-resource: Problem assembling the enunciate app.

Caused by: java.lang.ClassCastException: com.sun.tools.apt.mirror.type.ClassTypeImpl cannot be cast to com.sun.mirror.type.AnnotationType
    at com.sun.tools.apt.mirror.declaration.AnnotationMirrorImpl.getAnnotationType(AnnotationMirrorImpl.java:100)
    at net.sf.jelly.apt.decorations.declaration.DecoratedAnnotationMirror.<init>(DecoratedAnnotationMirror.java:49)
    at net.sf.jelly.apt.decorations.DeclarationDecorator.decorate(DeclarationDecorator.java:362)
    at net.sf.jelly.apt.decorations.DeclarationDecorator.decorateAnnotationMirrors(DeclarationDecorator.java:113)
    at net.sf.jelly.apt.decorations.declaration.DecoratedDeclaration.getAnnotationMirrors(DecoratedDeclaration.java:213)

1 个答案:

答案 0 :(得分:0)

一旦我从发誓依赖的排除列表中移除杰克逊罐子,上述错误就会停止。

        <dependency>
        <groupId>org.codehaus.enunciate</groupId>
        <artifactId>enunciate-rt</artifactId>
        <exclusions>
            <!--For Enunciate Reporting to Include Json Examples - Commenting this
            <exclusion>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-jaxrs</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-core-asl</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-mapper-asl</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-xc</artifactId>
            </exclusion>-->