org.junit.Test 注解失效的问题The import org.junit cannot be resolved

Posted zyf-yxm

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了org.junit.Test 注解失效的问题The import org.junit cannot be resolved相关的知识,希望对你有一定的参考价值。

检查pom依赖后确认junit的jar包,技术图片

尽管查看maven依赖里面有jar包,但是,jar包的颜色是灰色的,并且编译时报错:The import org.junit cannot be resolved

原因是<scope>test</scope>
含义是依赖项目仅仅参与测试相关的工作,包括测试代码的编译,执行,不能在src/main/java包下面使用,只能在src/test/java下使用

以上是关于org.junit.Test 注解失效的问题The import org.junit cannot be resolved的主要内容,如果未能解决你的问题,请参考以下文章