maven引入junit 4.12,项目import org.junit.Test 还是报错.

问题在与scope,  加上sope ,  应用范围限于\src\test\java\   ,  而\src\main\java\将不能用junit.   所以去掉scope

       <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <!-- 去掉scope作用域,使用默认的compile,编译、测试、运行都有效的作用域 -->
            <!--<scope>test</scope>-->
        </dependency>

猜你喜欢

转载自blog.csdn.net/kaige8312/article/details/84870208