maven junit.framework不存在问题解决
问题
在使用maven进行一个工程的编译,已加入junit包的依赖,编译的时候却总是报“junit.framework不存在”错误。
pom.xml中junit包加入如下:
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
- </dependency>
解决
试了N多方法,包括加入junit-dep包,依然解决不了问题,后来在加junit-dep包的时候发现,原来多了一个scope属性,将scope属性去掉后恢复正常。
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- </dependency>
原来依赖加入scope属性后,就会被约束在该生命周期内,在compile阶段不引入test阶段的依赖,也就是说编译阶段该依赖无效。
如果修改scope属性,则也可以正常运行:
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>compile</scope>
- </dependency>
maven junit.framework不存在问题解决的更多相关文章
- SPM——Using Maven+Junit to test Hello Wudi
Last week, ours teacher taught us 'Software Delivery and Build Management'. And in this class, our t ...
- [Java Web学习]junit.framework.AssertionFailedError: No tests found in {Class}
No tests found in com.XXXXX.XXX.inboundPrepService.bizLogic.prepDeterminationEngine.workers.Determin ...
- Junit测试中找不到junit.framework.testcase
在使用Junit进行测试时,出现如下问题: 找不到junit.framework.testcase 解决方法: 选中项目->属性->Java构建路径->库->添加外部jar 在 ...
- jenkins+maven+junit构建自动化测试,整合junit xml生成直观的测试报告[留存]
在自动化测试过程中,测试报告最能直观的体现测试的价值,之前一直使用maven+junit来构建我的自动化测试,但这样有几个缺点,一是,不能定时构建自动化任务(也许是我没有找到maven有没有提供这样的 ...
- eclipse 环境 JUnit 测试框架(junit.framework.* 与 org.junit.*)
如下所示,先通过 build path 导入 junit 环境依赖的 jar 包: 1. junit.framework.* junit.framework.* 主要类和函数: Test TestCa ...
- <p>在静态类junit.framework.Assert或者静态类org.junit.Assert中存在下面几个方法</p>
在静态类junit.framework.Assert或者静态类org.junit.Assert中存在下面几个方法 1.assertEquals()方法,用来查看对象中存的值是否是期待的值,与字符串比較 ...
- #測试相关#Getting “junit.framework.AssertionFailedError: Forked Java VM exited abnormally” Exception
编写Ant脚本进行持续測试的时候.出现了junit.framework.AssertionFailedError: Forked Java VM exited abnormally的报错,以此为key ...
- HTTP Status 500 - javax.servlet.ServletException: java.lang.NoClassDefFoundError: junit/framework/Test解决方法
java代码 package webViewer; import java.io.*; import junit.framework.Test; import com.aspose.words.*; ...
- [Java] Spring + SpringMVC + Maven + JUnit 搭建
示例项目下载: https://github.com/yangyxd/SpringDemo 利用前面 SpringMVC 项目的配置方式,完成初步的项目创建.下面只讲一些不同之处. 传送门: [Jav ...
随机推荐
- Unity3D学习笔记——初级知识
一:Unity欢迎窗口对于初学者来说有很多有价值的信息,值得用户关注,以下将简要介绍这个窗口中的相关内容: 1.Video Tutorials: 提供unity相关的教程 ,包括用户手册 .组件手册以 ...
- MySQL左连接查询
1.语法: select 字段列表 from table1 别名1 left join table2 别名2 on 连接条件 [where 子句]
- iOS内存管理之浅见
当我们用alloc.new.copy创建对象时,对象的应用计数为1,当把这个对象retain时.引用计数+1.当对这个对象发送release消息时,引用计数-1,当对象的引用计数为0时,系统回收这个对 ...
- okhttp 通过网关请求服务端返回数据
1.启动类代码 package com.tycoon.service; import org.springframework.boot.SpringApplication; import org.sp ...
- (转)gethostbyname() -- 用域名或主机名获取IP地址
struct hostent *gethostbyname(const char *name); 这个函数的传入值是域名或者主机名,例如"www.google.cn"等等.传出值, ...
- 自制的几个jquery插件
1.颜色插件,比用css方便些 //1.插件编写 ;(function ($) { $.fn.extend({ "color":function(value){ return th ...
- [Node.js] require背后的故事
前言 熟悉Node.js的肯定对下面的代码熟悉 var http = require('http'); 这段代码很好理解,就是加载一个http模块.但是你有没有想过为什么要这么写?这其中的缘由是什么呢 ...
- Grafana----Table Panel
新的表面板非常灵活,既支持时间序列的多模式,也支持表.注释和原始JSON数据.它还提供日期格式化和值格式化和着色选项.要查看表板动作和测试不同的配置数据,查看台面板展示在grafana操场. Opti ...
- exe4j中"this executable was created with an evaluation version of exe4j"
在使用exe4j时,如果您的exe4j没有注册,在运行有exe4j转换的*.jar为*.exe的可执行文件是会提示:"this executable was created with an ...
- [转载]移动页面所需meta元素和Viewport窗口知识点
Meta标签 vs Viewport http://www.2cto.com/kf/201409/335779.html http://blog.csdn.net/freshlover/articl ...