the import org.springframewok.test cannot be resolved
在写Spring的单元测试时遇见了问题,注解@ContextConfiguration和SpringJUnit4ClassRunner.class无法导包。手动导包后错误为“the import org.springframewok.test cannot be resolved”。

首先检查是否在maven的POM.xml文件添加了相应的依赖,添加了。然后检查spring相关的jar包的版本是否一致,也是一致的。最后发现,是在导入spring test 和Junit的jar包时多了<scope>test</scope>。

删除这两句就可以了。
原因:scope为test表示依赖项目仅仅参与测试相关的工作,包括测试代码的编译,执行。在maven的目录结构下,测试类一般是放在src/test/java,而不是放在src/main/java下。我的测试类是在src/main/java下的,所以maven在编译的时候,因为<scope>test</scope>的限制而不引用jar包,因此将这两句删掉不要限制就好了。
the import org.springframewok.test cannot be resolved的更多相关文章
- 解决报错:The import javax.servlet.annotation cannot be resolved
maven项目,引入javax.servlet.annotation.WebServlet的jar包,使用@WebServlet注解来实现对传统web.xml中servlet和url的映射 报错:Th ...
- import android.provider.Telephony cannot be resolved
android.provider.Telephony is hidden. http://androidxref.com/4.0.3_r1/xref/frameworks/base/core/java ...
- 导入javax.servlet。伺服登记无法解决:The import javax.servlet.MultipartConfigElement cannot be resolved
解决办法:
- ActionBarActivity: cannot be resolved to a type
"the import android.support.v7 cannot be resolved " or "ActionBarActivity: cannot be ...
- HttpServletRequest cannot be resolved to a type。
问题描述:HttpServletRequest cannot be resolved to a type.Multiple markers at this line - The import java ...
- cocos2dx 3.x(在Mac平台下利用Eclipse打包安卓apk安装包详细教程)
最近在学习cocos2dx在MAC上如何打包apk,今天先把安装JDK和ANT的过程记来. 首先,打开终端,输入"java -version" 点击回车后,出现如下提示: 我们的M ...
- 从0开始学java——JUnit4 复习,其实基本思想还是那些,不过采用了新的注释格式的语法
看了深入探索 JUnit 4(http://www.ibm.com/developerworks/cn/education/java/j-junit4/index.html ) 主要是讲了新的基于注 ...
- cocos2dx 搭建 android 平台
Mac OS X下配置Cocos2d-x for Android(Eclipse)&IOS(Xcode)开发环境 前面一段时间只用Cocos2d-x在IOS平台下开发, 学习Cocos2d-x ...
- 对于eclipse新建maven工程需要注意的地方。
新建项目的时候,如果想配置默认的maven的jre为1.6或者别的. http://hi.baidu.com/hi_hi/item/765ec8bbc49880d384dd79d1 1.cmd命令建立 ...
随机推荐
- Bootstrap历练实例:表单控件大小
表单控件大小 您可以分别使用 class .input-lg 和 .col-lg-* 来设置表单的高度和宽度. 实例: <!DOCTYPE html><html><hea ...
- React初识整理(四)--React Router(路由)
官网:https://reacttraining.com/react-router 后端路由:主要做路径和方法的匹配,从而从后台获取相应的数据 前端路由:用于路径和组件的匹配,从而实现组件的切换. 如 ...
- asyn_fifo
//Module Name:afifo_ctrl //Description:parameterized afifo module afifo_ctrl( clk_push, rst_push_n, ...
- 又面试了Python爬虫工程师,碰到这么几道面试题,Python面试题No9
第1题:动态加载又对及时性要求很高怎么处理? 如何知道一个网站是动态加载的数据? 用火狐或者谷歌浏览器 打开你网页,右键查看页面源代码,ctrl +F 查询输入内容,源代码里面并没有这个值,说明是动态 ...
- Processed foods make us fatter easily
From Business Insider Here's an experiment: sit alone in a hospital room for two weeks and eat nothi ...
- pyhton链式赋值在可变类型/不可变类型上的区别以及其本质
关于链式赋值的一些注意点: a=[]b=[]x=y=[]print(a==b) #Trueprint(x==y) #Trueprint(a is b) #Falseprint(x is y) #Tru ...
- cs229_part7
PCA 问题背景 回顾一下我们特征选择中的问题.如果特征非常多,而且有一些特征是重复的,那么我们可以想办法剔除掉一些无用的特征.那里我们提到一个计算互信息的方法.那么这里换一种降维方法. 比如说这样的 ...
- thymeleaf和artTemplate
Company最近项目中使用了两个模板引擎,分别是Java服务器端的模板引擎Thymeleaf和前端的模板引擎artTemplate, 其实对于这两个模板引擎 理论上应该是不应该放在一起记录的,但是b ...
- swift写一个简单的列表unable to dequeue a cell with identifier reuseIdentifier - must register a nib or a cla
报错:unable to dequeue a cell with identifier reuseIdentifier - must register a nib or a class for the ...
- PHP 判断表单提交的file是否为空
echo '<pre>'; var_dump($product_attach_files); echo "</pre>"; echo ];