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包,具体为什么还不清楚。

  • 相关阅读:
    【XAF】非持久化对象分组和属于不同会话
    【原创】XAF 非持久对象界面中更新xpo的状态查询
    Java字符串操作方法集
    Java易忘知识点统计
    Android常用依赖库搜集
    Android Studio报错Unable to resolve dependency for ':app@release/compileClasspath':无法引用任何外部依赖的解决办法
    Codewars练习Python
    Python学习日记之正则表达式re模块
    Linux学习日记之crontab使用notify-send实现每小时通知提醒
    Linux学习日记之Deepin下查看crontab运行日志
  • 原文地址:https://www.cnblogs.com/jepson6669/p/8668793.html
Copyright © 2011-2022 走看看