NoClassDefFoundError与Spring 3.1控制器单元测试
我有一个简单的NoClassDefFoundError与Spring 3.1控制器单元测试,spring,model-view-controller,junit4,noclassdeffounderror,Spring,Model View Controller,Junit4,Noclassdeffounderror,我有一个简单的自动连线的控制器和一个测试。当使用mvn和代码覆盖率目标emma:emma和emma:check构建项目时,测试用例失败,并出现以下错误 简单的“mvn测试”命令成功。 “mvn测试emma:emma emma:check”失败 尝试使用cobertura,将其添加到报告部分: <reporting> <plugins> <plugin> <groupId>org.codehaus.mo
自动连线的控制器和一个测试。当使用mvn和代码覆盖率目标emma:emma和emma:check构建项目时,测试用例失败,并出现以下错误
简单的“mvn测试”命令成功。
“mvn测试emma:emma emma:check”失败
尝试使用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>
然后在浏览器中打开:
target/site/index.html
您将在那里看到cobertura报告。
最好将这些插件添加到您的父pom中。您在测试中对SpringWeb有依赖性吗。如果没有,则尝试在org.springframework:springweb
mvn site
target/site/index.html