zoukankan      html  css  js  c++  java
  • 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包,具体为什么还不清楚。

  • 相关阅读:
    iOS: 复选框使用---第三方框架SSCheckBoxView-master
    iOS: 使用故事板和xib设置按钮圆角方法
    iOS:详解MJRefresh刷新加载更多数据的第三方库
    万不要忽视身体发出的九大求救讯号
    MapX小试
    Nginx -HTTP和反向代理服务器简单配置
    Mapinfo修改道路方向
    This version of the rendering library is more recent than your version of ADT plug-in. Please update ADT plug-in问题
    世界上超难找的药方
    合并apk和odex 为完整的apk安装文件
  • 原文地址:https://www.cnblogs.com/jepson6669/p/8668793.html
Copyright © 2011-2022 走看看