1

私は単純なautowiredコントローラーとテストを持っています。mvn とコード カバレッジの目標 emma:emma および emma:check を使用してプロジェクトをビルドすると、テスト ケースは次のエラーで失敗します。

単純な「mvn test」コマンドは成功します。「mvn test emma:emma emma:check」は失敗します。

java.lang.NoClassDefFoundError: org/springframework/web/bind/support/WebDataBinderFactory
4

2 に答える 2

0

cobertura を使用してみてください。これをレポート セクションに追加してください。

<reporting>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
            <version>2.5.1</version>
            <configuration>
              <check>
                <lineRate>120</lineRate>
              </check>
            </configuration>
        </plugin>
    </plugins>
</reporting>

次に、次のようにします。

mvn site

次にブラウザで開きます。

target/site/index.html

そこに cobertura レポートが表示されます。この種のプラグインを親 pom に追加することをお勧めします。

于 2012-09-18T01:31:24.703 に答える
0

テストで spring-web の依存関係がありますか。そうでない場合は、依存関係を追加してみてくださいorg.springframework:spring-web

于 2012-09-24T15:28:58.560 に答える