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

  • 相关阅读:
    A1082 Read Number in Chinese [汉字读数字]
    A1077 Kuchiguse [字符串找相同后缀]
    A1035 Password [修改字符]
    A1001 A+B Format [字符串处理]
    django文档总结之会话保持、视图、中间件(2)
    django文档总结之基本操作(1)
    VSCode常用命令快捷键
    vscode配置远程免密
    linux下deb包的管理及制作 | 一次成功
    shell脚本之sed详解(1)
  • 原文地址:https://www.cnblogs.com/jepson6669/p/8668793.html
Copyright © 2011-2022 走看看