maven - cannot access org.hamcrest.Matcher class file for org.hamcrest.Matcher not found in Eclipse and Rest Assured
问题描述
Hi I'm a newbie for rest assured and trying to do it in BDD, For that I have written a script while trying to run , I got below mentioned Error
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/akrishnan/eclipse-workspace/BehavDD/src/Test/behaviourDrivenTest.java:[4,27] package org.hamcrest does not exist
[ERROR] /C:/Users/akrishnan/eclipse-workspace/BehavDD/src/Test/behaviourDrivenTest.java:[5,27] package org.hamcrest does not exist
[ERROR] /C:/Users/akrishnan/eclipse-workspace/BehavDD/src/Test/behaviourDrivenTest.java:[23,63] cannot find symbol
symbol: method hasSize(int)
location: class Test.behaviourDrivenTest
[ERROR] /C:/Users/akrishnan/eclipse-workspace/BehavDD/src/Test/behaviourDrivenTest.java:[22,29] cannot access org.hamcrest.Matcher
class file for org.hamcrest.Matcher not found
[ERROR] /C:/Users/akrishnan/eclipse-workspace/BehavDD/src/Test/behaviourDrivenTest.java:[38,41] cannot find symbol
symbol: method equalTo(java.lang.String)
location: class Test.behaviourDrivenTest
[ERROR] /C:/Users/akrishnan/eclipse-workspace/BehavDD/src/Test/behaviourDrivenTest.java:[53,28] cannot find symbol
symbol: method equalTo(java.lang.String)
location: class Test.behaviourDrivenTest
[ERROR] /C:/Users/akrishnan/eclipse-workspace/BehavDD/src/Test/behaviourDrivenTest.java:[68,63] cannot find symbol
symbol: method hasSize(int)
location: class Test.behaviourDrivenTest
[ERROR] /C:/Users/akrishnan/eclipse-workspace/BehavDD/src/Test/behaviourDrivenTest.java:[80,63] cannot find symbol
symbol: method hasSize(int)
location: class Test.behaviourDrivenTest
[ERROR] /C:/Users/akrishnan/eclipse-workspace/BehavDD/src/Test/behaviourDrivenTest.java:[128,73] cannot find symbol
symbol: method equalTo(java.lang.String)
location: class Test.behaviourDrivenTest
[ERROR] /C:/Users/akrishnan/eclipse-workspace/BehavDD/src/Test/behaviourDrivenTest.java:[149,63] cannot find symbol
symbol: method hasSize(int)
location: class Test.behaviourDrivenTest
[INFO] 10 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
I have added the maven dependencies too
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
I dont know what I'm missing here. even I tried to set Build path with external jars, still no use.
解决方案
在我的情况下,我不得不删除范围,因为我也在 scope 测试中使用它。
推荐阅读
- sql - 使用三个 case 表达式运行更新?
- javascript - 过滤标签以显示来自 Chart.js 的用户
- python - 获取功能创建的 enum.Enum 类的名称
- scala - 依赖注入模块初始化顺序中 Dev 和 Prod 模式的区别
- r - 如何在 tibble 列中找到最长的重复序列?
- java - 错误:“系统服务在 onCreate() 之前对活动不可用”,即使我有一个 onCreate() 函数
- parse-platform - Parse... UIImages 中什么更具成本效益?
- bash - libpqxx 配置找不到用于本地安装 PostgreSQL 的 libpq-fe.h
- html - Chrome 扩展选项页面:
- android - -Werror,-Wundefined-inline 是什么意思?