eclipse maven程序包org.junit不存在

今天使用maven打包项目的时候出现下面的错误,提示org.junit不存在。

错误信息内容如下:

[ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[8,16] 错误: 程序包org.junit不存在  
[ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[9,23] 错误: 程序包org.junit.runner不存在  
[ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[18,1] 错误: 找不到符号  
[ERROR]  类 RunWith  
/Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[37,2] 错误: 找不到符号  
[INFO] 4 errors   
[INFO] -------------------------------------------------------------  
[INFO] ------------------------------------------------------------------------  
[INFO] BUILD FAILURE  
[INFO] ------------------------------------------------------------------------  
[INFO] Total time: 15.024 s  
[INFO] Finished at: 2017-04-14T13:34:37+08:00  
[INFO] Final Memory: 31M/280M  
[INFO] ------------------------------------------------------------------------  
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (default-testCompile) on project share: Compilation failure: Compilation failure:  
[ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[8,16] 错误: 程序包org.junit不存在  
[ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[9,23] 错误: 程序包org.junit.runner不存在  
[ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[18,1] 错误: 找不到符号  
[ERROR] 类 RunWith  
[ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[37,2] 错误: 找不到符号  
[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

但是程序测试的时候是没有问题的,这也就说明junit的依赖是引入了的。

修改方法:修改下面的代码

最开始的如下:

修改后的代码:

然后发现进入可以达成了jar包,具体为什么还不清楚。

 

posted @ 2018-03-29 11:32  Jepson6669  阅读(2880)  评论(0编辑  收藏  举报