Maven 错误:无法访问BlockJUnit4ClassRunner
当我运行mvn安装时,我能够找到上面的错误 这是我配置JUnit的POM.xmlMaven 错误:无法访问BlockJUnit4ClassRunner,maven,junit4,Maven,Junit4,当我运行mvn安装时,我能够找到上面的错误 这是我配置JUnit的POM.xml <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.4</version> <scope>test</scope&g
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
<scope>test</scope>
</dependency>
在编译上面的错误时,我得到了。
我在src/Test/java中创建的这个测试类
有谁能推荐一下吗。如何解决这个问题
当我删除@Test不可识别时,我得到了错误。好的,解决方案可能非常简单:更新到JUnit 4.5(或更高版本) BlockJUnit4Runner(您正在使用的SpringJUnit4ClassRunner的超类)的javadoc声明: @从4.5开始
…但由于您只使用
4.4
,这可能就是全部问题所在。刚刚检查过,该类在JUnit4.4中根本不存在,因此您必须升级JUnit版本以解决该问题。您的测试驻留在哪个目录中?通常情况下,测试应该在src/test/java/…
中。Hi@FlorianSchaetz我已经提到我的测试类在src/test/java文件夹中。抱歉,没有提到这一点。无论如何,解决办法是另一回事;-)对于Spring4.1,它需要JUnit4.9+。
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class ServiceTestCase {
protected static final Logger LOG = Logger.getLogger(ServiceTestCase.class);
@Configuration
static class AccountServiceTestContextConfiguration {
....
....
....
}