-
2022-07-05 15:21:18
报错信息
关键信息:程序包 org.junit 不存在
原因分析
在 mvn clean install 时,弹出该错误,可能的情况
1、junit 版本处于 3.x(默认的版本为3.8.1,修改为4.x,因为3.x使用的为编程的方式,4.x为注解的形式)
2、scope 处于 test
解决方案
修改 <scope> 为 compile 或者直接删除,以及升级版本为 4.x
<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> </dependency>
更多相关内容 -
程序包org.junit不存在
2020-08-04 15:08:31在idea中启动一个springboot项目测试类时,出现了程序包org.junit不存在错误 如下: 检查maven配置导入等没有发现问题 解决方案: 1.依次点击File-Settings-Build, Execution, Deployment-Build Tools-Maven-Runner...在idea中启动一个springboot项目测试类时,出现了程序包org.junit不存在错误
如下:
检查maven配置导入等没有发现问题解决方案:
1.依次点击File-Settings-Build, Execution, Deployment-Build Tools-Maven-Runner之后勾选右侧红色框条目,勾选后点击下方apply-ok保存设置
2.回到出问题的测试类中debug启动,追踪错误原因为junit包版本问题
3.修改为推荐的4.12后再次启动成功 -
~项目导入时报错:程序包org.junit不存在
2021-03-24 00:20:15求助~项目导入时报错:程序包org.junit不存在网上下载下来的例子导入的时候报错:程序包org.junit不存在可是我看到pom.xml已经有:junitjunit4.12testmavendependency里面也看到junit的jar包了错误代码:[ERROR]...求助~项目导入时报错:程序包org.junit不存在
网上下载下来的例子导入的时候报错:程序包org.junit不存在
可是我看到pom.xml已经有:
junit
junit
4.12
test
maven dependency里面也看到junit的jar包了
错误代码:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /E:/download from the net/gomeTest/src/main/java/com/ruishenh/redis/example/JedisUtilTest.java:[3,17] 程序包org.junit不存在
[ERROR] /E:/download from the net/gomeTest/src/main/java/com/ruishenh/redis/example/JedisUtilTest.java:[4,17] 程序包org.junit不存在
[ERROR] /E:/download from the net/gomeTest/src/main/java/com/ruishenh/redis/example/JedisUtilTest.java:[19,10] 找不到符号
符号: 类 Before
位置: 类 com.ruishenh.redis.example.JedisUtilTest
[ERROR] /E:/download from the net/gomeTest/src/main/java/com/ruishenh/redis/example/JedisUtilTest.java:[28,10] 找不到符号
符号: 类 Test
位置: 类 com.ruishenh.redis.example.JedisUtilTest
[ERROR] /E:/download from the net/gomeTest/src/main/java/com/ruishenh/redis/example/JedisUtilTest.java:[36,10] 找不到符号
符号: 类 Test
位置: 类 com.ruishenh.redis.example.JedisUtilTest
[ERROR] /E:/download from the net/gomeTest/src/main/java/com/ruishenh/redis/example/JedisUtilTest.java:[67,10] 找不到符号
符号: 类 Test
位置: 类 com.ruishenh.redis.example.JedisUtilTest
[ERROR] /E:/download from the net/gomeTest/src/main/java/com/ruishenh/redis/example/JedisUtilTest.java:[98,10] 找不到符号
符号: 类 Test
位置: 类 com.ruishenh.redis.example.JedisUtilTest
[ERROR] /E:/download from the net/gomeTest/src/main/java/com/ruishenh/redis/example/JedisUtilTest.java:[115,10] 找不到符号
符号: 类 Test
位置: 类 com.ruishenh.redis.example.JedisUtilTest
[ERROR] /E:/download from the net/gomeTest/src/main/java/com/ruishenh/redis/example/JedisUtilTest.java:[131,10] 找不到符号
符号: 类 Test
位置: 类 com.ruishenh.redis.example.JedisUtilTest
[INFO] 9 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.101 s
[INFO] Finished at: 2015-09-18T10:01:05+08:00
[INFO] Final Memory: 15M/196M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project gomeTest: Compilation failure: Compilation failure:
[ERROR] /E:/download from the net/gomeTest/src/main/java/com/ruishenh/redis/example/JedisUtilTest.java:[3,17] 程序包org.junit不存在
[ERROR] /E:/download from the net/gomeTest/src/main/java/com/ruishenh/redis/example/JedisUtilTest.java:[4,17] 程序包org.junit不存在
[ERROR] /E:/download from the net/gomeTest/src/main/java/com/ruishenh/redis/example/JedisUtilTest.java:[19,10] 找不到符号
[ERROR] 符号: 类 Before
[ERROR] 位置: 类 com.ruishenh.redis.example.JedisUtilTest
[ERROR] /E:/download from the net/gomeTest/src/main/java/com/ruishenh/redis/example/JedisUtilTest.java:[28,10] 找不到符号
[ERROR] 符号: 类 Test
[ERROR] 位置: 类 com.ruishenh.redis.example.JedisUtilTest
[ERROR] /E:/download from the net/gomeTest/src/main/java/com/ruishenh/redis/example/JedisUtilTest.java:[36,10] 找不到符号
[ERROR] 符号: 类 Test
[ERROR] 位置: 类 com.ruishenh.redis.example.JedisUtilTest
[ERROR] /E:/download from the net/gomeTest/src/main/java/com/ruishenh/redis/example/JedisUtilTest.java:[67,10] 找不到符号
[ERROR] 符号: 类 Test
[ERROR] 位置: 类 com.ruishenh.redis.example.JedisUtilTest
[ERROR] /E:/download from the net/gomeTest/src/main/java/com/ruishenh/redis/example/JedisUtilTest.java:[98,10] 找不到符号
[ERROR] 符号: 类 Test
[ERROR] 位置: 类 com.ruishenh.redis.example.JedisUtilTest
[ERROR] /E:/download from the net/gomeTest/src/main/java/com/ruishenh/redis/example/JedisUtilTest.java:[115,10] 找不到符号
[ERROR] 符号: 类 Test
[ERROR] 位置: 类 com.ruishenh.redis.example.JedisUtilTest
[ERROR] /E:/download from the net/gomeTest/src/main/java/com/ruishenh/redis/example/JedisUtilTest.java:[131,10] 找不到符号
[ERROR] 符号: 类 Test
[ERROR] 位置: 类 com.ruishenh.redis.example.JedisUtilTest
[ERROR] -> [Help 1]
------解决思路----------------------
你们你看下这个 jar 下载下来了没有
------解决思路----------------------
右键项目--》Build Path--》Add Libraries--》JUnit--》Next--》Finish
-
maven 程序包org.junit不存在
2020-06-14 20:47:32[19,17] 程序包org.junit不存在 [ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/EntitiesHelper.java:[3,17] 程序包org.junit不存在 [ERROR] /D:/use_soft/eclipse/workspace...[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building user-core 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ user-core ---
[INFO] Deleting D:\use_soft\eclipse\workspace\user-core\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ user-core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ user-core ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 7 source files to D:\use_soft\eclipse\workspace\user-core\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/AbstractDbUnitTestCase.java:[17,17] 程序包org.junit不存在
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/AbstractDbUnitTestCase.java:[18,17] 程序包org.junit不存在
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/AbstractDbUnitTestCase.java:[19,17] 程序包org.junit不存在
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/EntitiesHelper.java:[3,17] 程序包org.junit不存在
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/AbstractDbUnitTestCase.java:[25,12] 找不到符号
符号: 类 BeforeClass
位置: 类 zttc.itat.user.util.AbstractDbUnitTestCase
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/AbstractDbUnitTestCase.java:[63,12] 找不到符号
符号: 类 AfterClass
位置: 类 zttc.itat.user.util.AbstractDbUnitTestCase
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/AbstractDbUnitTestCase.java:[32,13] 找不到符号
符号: 变量 Assert
位置: 类 zttc.itat.user.util.AbstractDbUnitTestCase
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/EntitiesHelper.java:[11,13] 找不到符号
符号: 变量 Assert
位置: 类 zttc.itat.user.util.EntitiesHelper
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/EntitiesHelper.java:[12,13] 找不到符号
符号: 变量 Assert
位置: 类 zttc.itat.user.util.EntitiesHelper
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/EntitiesHelper.java:[13,13] 找不到符号
符号: 变量 Assert
位置: 类 zttc.itat.user.util.EntitiesHelper
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/EntitiesHelper.java:[14,13] 找不到符号
符号: 变量 Assert
位置: 类 zttc.itat.user.util.EntitiesHelper
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/EntitiesHelper.java:[15,13] 找不到符号
符号: 变量 Assert
位置: 类 zttc.itat.user.util.EntitiesHelper
[INFO] 12 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.003 s
[INFO] Finished at: 2015-10-23T15:32:32+08:00
[INFO] Final Memory: 17M/179M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project user-core: Compilation failure: Compilation failure:
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/AbstractDbUnitTestCase.java:[17,17] 程序包org.junit不存在
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/AbstractDbUnitTestCase.java:[18,17] 程序包org.junit不存在
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/AbstractDbUnitTestCase.java:[19,17] 程序包org.junit不存在
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/EntitiesHelper.java:[3,17] 程序包org.junit不存在
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/AbstractDbUnitTestCase.java:[25,12] 找不到符号
[ERROR] 符号: 类 BeforeClass
[ERROR] 位置: 类 zttc.itat.user.util.AbstractDbUnitTestCase
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/AbstractDbUnitTestCase.java:[63,12] 找不到符号
[ERROR] 符号: 类 AfterClass
[ERROR] 位置: 类 zttc.itat.user.util.AbstractDbUnitTestCase
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/AbstractDbUnitTestCase.java:[32,13] 找不到符号
[ERROR] 符号: 变量 Assert
[ERROR] 位置: 类 zttc.itat.user.util.AbstractDbUnitTestCase
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/EntitiesHelper.java:[11,13] 找不到符号
[ERROR] 符号: 变量 Assert
[ERROR] 位置: 类 zttc.itat.user.util.EntitiesHelper
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/EntitiesHelper.java:[12,13] 找不到符号
[ERROR] 符号: 变量 Assert
[ERROR] 位置: 类 zttc.itat.user.util.EntitiesHelper
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/EntitiesHelper.java:[13,13] 找不到符号
[ERROR] 符号: 变量 Assert
[ERROR] 位置: 类 zttc.itat.user.util.EntitiesHelper
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/EntitiesHelper.java:[14,13] 找不到符号
[ERROR] 符号: 变量 Assert
[ERROR] 位置: 类 zttc.itat.user.util.EntitiesHelper
[ERROR] /D:/use_soft/eclipse/workspace/user-core/src/main/java/zttc/itat/user/util/EntitiesHelper.java:[15,13] 找不到符号
[ERROR] 符号: 变量 Assert
[ERROR] 位置: 类 zttc.itat.user.util.EntitiesHelper
[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
解决:<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>改成
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
</dependency>
————————————————
版权声明:本文为CSDN博主「Ethan_Fu」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/ethan_fu/article/details/49450083 -
Eclipse开发Maven项目提示:程序包org.junit不存在解决方案
2021-03-08 01:47:191、产生的问题:maven项目执行单元测试可以正常执行,但是执行maven命令test,则报一下异常:org.apache.maven.plugins:maven-compiler-plugin:2.5.1:testCompile (default-testCompile) on project support: ... -
ideaSpringBoot报错:java: 程序包org.junit不存在解决方法
2022-04-25 18:09:23写一个测试项目,在pom引入junit的情况下,执行报junit不存在 ... -
IDEA Error: java: 程序包org.junit不存在,无法通过Test测试
2022-03-04 17:37:37IDEA Error: java: 程序包org.junit不存在,无法通过Test测试 直奔主题,程序包org.junit不存在这个问题,在idea中是很常见的问题, 一般解决方法网上有好几种, 1.改版本号 查看自己idea安装目录中的lib文件夹,... -
java:提示程序包org.junit不存在时的解决方法
2021-12-02 18:05:23java中程序运行时提示“程序包org.junit不存在”时的解决方法 -
idea报错:程序包org.junit不存在
2021-06-01 21:45:17鼠标靠近显示:Cannot resolve symbol ‘junit’,运行项目报错: 程序包org.junit不存在 import org.junit.Test; @Test 解决方案: File->Project Stucture->Libraries->加号->Java-> -
IDEA Error: java: 程序包org.junit不存在
2021-09-27 15:20:031.错误提示 2. 问题分析 Maven 就是通过pom 导入依赖; 代码结构升级,groupId 或者 artifactId 变了, 代码内容升级,version变了;...查一下junit 发现,我的版本太低了,换个最受欢迎的高版本; 3. 解决方案 ... -
程序包org.junit不存在解决方案
2021-01-14 15:48:14前两天玩junit包的时候,运行报错org.junit不存在 怎么回事?明明我已经配置了而且是最新版本的,如下图 让我百思不得其解,于是开始面向百度编程,用了两天时间搜索尝试了各种解决方案,也依然没能解决。但是皇天... -
java: 程序包org.junit不存在 解决方法
2021-05-16 10:37:23https://blog.csdn.net/mjmaoning/article/details/107233774 https://blog.csdn.net/magcfield/article/details/107793814 -
Idea运行junit测试,报Error:[3,17] 程序包org.junit不存在解决方法
2022-02-06 06:55:44查了查,网上主流解决办法两种。 ... settings....Build, Execution, Deployment–>...该方法能解决问题(至少我行),但不推荐。每次测试都要将整个maven项目运行出来,效率极低。 2.将maven 仓库换成idea 默认仓库,即 -
【Maven】错误: 程序包org.junit不存在
2019-06-01 22:52:031、产生的问题: maven项目执行单元测试可以正常执行,但是执行maven命令test,则报一下异常: org.apache.maven.plugins:maven-compiler-plugin:2.5.1:testCompile (default-testCo... -
IDEA中Maven测试单个方法,程序包org.junit不存在
2020-12-01 15:01:20IDEA中使用Maven测试单个方法报错:程序包org.junit不存在 今天学习Maven,运行test报错找不到这个jar包,翻了网上很多博客,有让删<scope>test</scope>标签的,有让从IDEA安装目录加载lib的,都无法... -
错误: 程序包org.junit不存在
2020-02-22 11:46:33idea2017版本,gradle管理依赖,单元测试报“程序包org.junit不存在”的错误; 现象 代码没有标红,运行才报这种错误; idea配置中可以看到test模块依赖了Junit; build.gradle配置文件加上testCompile group: '... -
Error:(4, 17) java: 程序包org.junit不存在
2021-04-16 16:17:28内容:Error:(4, 17) java: 程序包org.junit不存在 场景:运行测试类的时候,IED新建一个自己的项目,并且不用maven的情况下 解决方案:File -> Project Struct... -> Libraies -> 点击绿色的加号 -> ... -
IDEA maven项目使用Junit报错 java: 程序包org.junit不存在
2020-06-24 13:54:57IDEA maven项目使用Junit报错 java: 程序包org.junit不存在 File -> Settings -> Build,Execution,Deployment -> Build Tools -> Maven -> Runner对话框下,勾选“Delegate IDE build/run actions to... -
maven打包时提示程序包org.junit不存在解决方案
2020-06-02 16:30:40第一种:将junit的版本提高到4.x,配置代码如下: 异常目录位于\src\test\java,不是\src\main\java\时 <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <... -
IDEA开发Maven项目提示:程序包org.junit不存在解决方案
2020-12-08 21:14:29junit junit 4.12 test 更改为: New: <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <!-- 默认的版本为3.8.1,修改为4.x,因为3.x使用的为编程的... -
Java程序包org.junit不存在问题
2020-04-15 14:14:03Java程序包org.junit不存在问题 https://blog.csdn.net/weixin_43681796/article/details/98033592 -
“Error:(3, 24) java: 程序包org.junit不存在”的3种解决方法
2020-08-04 18:23:33“Error:(3, 24) java: 程序包org.junit不存在”的3种解决方法 安装maven,创建maven-archtype-quickstart后,进行junit单元测试时,报出以下错误: 主要有3种解决办法: 方法一: 匹配juint的版本 进入IntelliJ ... -
Error:(3, 17) 错误: 程序包org.junit不存在
2020-07-27 17:22:31若导入之后还是不存在 则用打开命令行输入项目的路径,之后输入mvn -U idea:idea,执行完之后再重新刷新一下 再重新使用@Test 就可以了 例如我的 加载完后 再重新回到页面执行就可以了 -
使用IDEA测试代码,提示Error:(6, 17) java: 程序包org.junit不存在
2020-10-23 17:50:06IDEA2020以上版本使用junit测试时,可能会出现Error:(6, 17) java: 程序包org.junit不存在错误,各种类找不到.打开IDEA-file-setting-build,execution-build tools-maven-runner-勾选delegate ide build/run就好了 -
Eclipse,Maven项目打包时提示:Error:[3,17] 程序包org.junit不存在解决方法
2020-11-16 17:38:58写了单元测试,可以正常运行,但是在打包的时候却报了Error:[3,17] 程序包org.junit不存在的错。 解决方案: 原来的junit的scope是test,可以将它注释后作为临时的解决方案: Old: <dependency> <... -
Maven打包 错误: 程序包org.junit不存在
2017-04-15 14:13:48因此需要打个War放上去,但在打包的时候输出以下错误信息:[ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[8,16] 错误: 程序包org.junit不存在 ... -
java: 程序包org.junit.jupiter.api不存在
2022-07-19 22:46:43java:程序org.junit.jupiter.api不存在