执行org.mule.munit.tools时缺少必需的类:org / codehaus / jackson / annotate / JsonClass

时间:2013-12-28 02:12:52

标签: maven mule

当我运行mav测试目标时出现以下错误:

        A required class was missing while executing org.mule.munit.tools:
                munit-maven-plugin:3.4-M4-SNAPSHOT:test: org/codehaus/jackson/annotate/JsonClass
            ...
            [ERROR] Number of foreign imports: 1
            [ERROR] import: Entry[import  from realm ClassRealm[project>com.sfdc.it.ei.esb.service:
    workday-employee-target-adapter:
        1.0.1-SNAPSHOT, parent: ClassRealm[maven.api, parent: null]]]
            [ERROR] 
            [ERROR] -----------------------------------------------------: org.codehaus.jackson.annotate.JsonClass
            [ERROR] -> [Help 1]
...
Caused by: java.lang.NoClassDefFoundError: org/codehaus/jackson/annotate/JsonClass

的pom.xml:

 <munit.version>3.4-M4-SNAPSHOT</munit.version> 

    <testResources>
        <testResource>
            <directory>src/test/munit</directory>
        </testResource>
        <testResource>
            <directory>src/test/resources</directory>
        </testResource>     
    </testResources>

    <dependency>
        <groupId>org.mule.tests</groupId>
        <artifactId>mule-tests-functional</artifactId>
        <version>${mule.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
       <groupId>commons-cli</groupId>
       <artifactId>commons-cli</artifactId>
       <version>1.1</version>
    </dependency>
    <dependency>
       <groupId>org.mule.munit</groupId>
       <artifactId>munit-runner</artifactId>
       <version>${munit.version}</version>
       <scope>test</scope>
    </dependency>
    <dependency>
   <groupId>org.codehaus.jackson</groupId>
   <artifactId>jackson-core-asl</artifactId>
   <version>1.9.13</version>
</dependency>
<dependency>
       <groupId>org.codehaus.jackson</groupId>
       <artifactId>jackson-core-lgpl</artifactId>
       <version>1.9.7</version>
       <scope>runtime</scope>
    </dependency>

我是否需要为JsonClass包含任何依赖项?

我有两个项目,mule-tests-functional,包含在这个项目中。如果我单独运行两个项目(即没有这种依赖)maven工作正常。

2 个答案:

答案 0 :(得分:7)

使用jackson-mapper-asl的最新版本(编写1.9.13时)为我解决了这个问题:

<dependency>
    <groupId>org.codehaus.jackson</groupId>
    <artifactId>jackson-mapper-asl</artifactId>
    <version>1.9.13</version>
</dependency>

答案 1 :(得分:2)

它说:

java.lang.NoClassDefFoundError:org / codehaus / jackson / annotate / JsonClass

这个类仅在版本1.7.0之前的jackson-core-asl工件中。它在以后的版本中删除了:

请参阅: http://mavenhub.com/c/org/codehaus/jackson/annotate/JsonClass/dependency