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

  • 相关阅读:
    团队作业(9)
    团队作业(8)
    团队作业(7)
    团队作业(6)
    团队作业(5)
    团队作业(4)
    团队作业(3)
    05数据爬去
    02周总结
    04结对开发
  • 原文地址:https://www.cnblogs.com/jepson6669/p/8668793.html
Copyright © 2020-2023  润新知