maven 运行package 命令是报 错误: 程序包org.junit不存在

错误信息:

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /D:/study/workspace-lej/a/src/test/java/com/lejpro/test/EmpDaoTest.java:[6,17] 程序包org.junit不存在
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.387 s
[INFO] Finished at: 2018-05-11T17:39:17+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project a: Compilation failure
[ERROR] /D:/study/workspace-lej/a/src/test/java/com/lejpro/test/EmpDaoTest.java:[6,17] 程序包org.junit不存在
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

解决办法:

<juit.version>3.8.1</juit.version>修改成<juit.version>4.12</juit.version>

如果还是不行

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

猜你喜欢

转载自blog.csdn.net/u012129030/article/details/80285265