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

错误信息内容如下:

  1. [ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[8,16] 错误: 程序包org.junit不存在
  2. [ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[9,23] 错误: 程序包org.junit.runner不存在
  3. [ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[18,1] 错误: 找不到符号
  4. [ERROR] RunWith
  5. /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[37,2] 错误: 找不到符号
  6. [INFO] 4 errors
  7. [INFO] -------------------------------------------------------------
  8. [INFO] ------------------------------------------------------------------------
  9. [INFO] BUILD FAILURE
  10. [INFO] ------------------------------------------------------------------------
  11. [INFO] Total time: 15.024 s
  12. [INFO] Finished at: 2017-04-14T13:34:37+08:00
  13. [INFO] Final Memory: 31M/280M
  14. [INFO] ------------------------------------------------------------------------
  15. [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:
  16. [ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[8,16] 错误: 程序包org.junit不存在
  17. [ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[9,23] 错误: 程序包org.junit.runner不存在
  18. [ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[18,1] 错误: 找不到符号
  19. [ERROR] RunWith
  20. [ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[37,2] 错误: 找不到符号
  21. [ERROR] -> [Help 1]
  22. [ERROR]
  23. [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  24. [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  25. [ERROR]
  26. [ERROR] For more information about the errors and possible solutions, please read the following articles:
  27. [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

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

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

最开始的如下:

修改后的代码:

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

eclipse maven程序包org.junit不存在的更多相关文章

  1. Error:(4, 17) java: 程序包org.junit不存在

    内容:Error:(4, 17) java: 程序包org.junit不存在 场景:运行测试类的时候,IED新建一个自己的项目,并且不用maven的情况下 解决方案:File -> Projec ...

  2. Maven:程序包不存在,找不到符号

    maven build时出现了以下的错误: 程序包xx.xx不存在,xxx找不到符号 原因一:DAO层依赖Service接口层的Bean类,在pom.xml中添加了对Service的依赖,也因此引入了 ...

  3. Eclipse开发Maven项目提示:程序包org.junit不存在解决方案

    原因: 个人考虑产生此错误的原因是因为Eclipse中对于测试和开发的鉴定不明?Intellij中没有错误,因为Intellij对项目的管理就是同Maven结构的. 解决方案: 原来的junit的sc ...

  4. maven 错误: 程序包org.junit不存在

    该错误在入门例子中使用mvn clean test时出现该错误. 原因: 测试用例应该放在src/test/java/...路径下,我是放在了src/main/java/..路径下了. 因为没有遵守其 ...

  5. 程序包org.junit不存在

    三种解决方法 第一种 maven的改法 <dependency>            <groupId>junit</groupId>            &l ...

  6. 程序包org.junit不存在和编码GBK的不可映射字符问题解决

    maven项目在打包编译时提示: 解决办法: 将pom中junit依赖中的scope给注释掉 <dependency> <groupId>junit</groupId&g ...

  7. maven 程序包com.sun.image.codec.jpeg

    在 Pom.xml 增加 <build> <plugins> <plugin> <artifactId>maven-compiler-plugin< ...

  8. Eclipse+Maven+Scala Project+Spark | 编译并打包wordcount程序

    学习用Eclipse+Maven来构建并打包一个简单的单词统计的例程. 本项目源码已托管于Github –>[Spark-wordcount] 第一步 在EclipseIDE中安装Scala插件 ...

  9. idea启动java Maven项目,出现" java: 程序包xxxx不存在"

    今天运行Maven项目的时候,出现了,Error:(19, 17) java: 程序包tracetool不存在的情况 本人的解决办法: (1)首先确保maven  pom文件不能报错,即文件上面不能有 ...

随机推荐

  1. C# System.Timers.Timer定时器的使用和定时自动清理内存应用

    项目比较大有时候会比较卡,虽然有GC自动清理机制,但是还是有不尽人意的地方.所以尝试在项目启动文件中,手动写了一个定时器,定时清理内存,加快项目运行速度. public class Program { ...

  2. code manager tools myeclipse10 svn插件安装及使用

    一.下载: 1.在线安装地址:http://subclipse.tigris.org/update_1.6.x 2.安装包下载地址:http://subclipse.tigris.org/servle ...

  3. ubuntu - 14.04,安装Go语言(谷歌公司开发的一种语言)

    Go语言下载地址:https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gz 安装: 1,以root身份在shell里执行: ta ...

  4. Codeforces Round #538 (Div. 2)D(区间DP,思维)

    #include<bits/stdc++.h>using namespace std;int a[5007];int dp[5007][5007];int main(){    int n ...

  5. (原创)团体程序设计天梯赛-练习集 L1-048 矩阵A乘以B (15 分)

    给定两个矩阵A和B,要求你计算它们的乘积矩阵AB.需要注意的是,只有规模匹配的矩阵才可以相乘.即若A有R​a​​行.C​a​​列,B有R​b​​行.C​b​​列,则只有C​a​​与R​b​​相等时,两 ...

  6. kuangbin专题七 HDU3974 Assign the task (dfs时间戳建树)

    There is a company that has N employees(numbered from 1 to N),every employee in the company has a im ...

  7. django 访问静态资源

    urlpatterns = patterns('', url(r'^$', views.show, name='index'), url(r'^static/(?P<path>.*)', ...

  8. Experimental Educational Round: VolBIT Formulas Blitz K

    Description IT City company developing computer games decided to upgrade its way to reward its emplo ...

  9. lintcode - 删除数字

    class Solution { public: /* * @param A: A positive integer which has N digits, A is a string * @para ...

  10. hxml总结

    段落<p> br 换行 hr 分割线 &nbsp 空格 &gt  > &lt < &  &amp h        7级标题 <i ...