问题描述
在使用放心的4.1.1时,我无法解决该错误.我的Eclipse IDE中的库.我已在我的pom.xml文件中添加了放心的库,但该错误仍未解决.
Hi I am not able to resolve the error while using rest assured 4.1.1. library in my Eclipse IDE.I have added the rest assured library in my pom.xml file still the error is not resolved.
我尝试从 https:重新导入可放心的库://mvnrepository.com/artifact/io.rest-assured/rest-assured/4.1.1 但是还是不行
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>RestAssuredTutorial</groupId>
<artifactId>RestAssuredTutorial</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>4.1.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-
simple -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
</dependencies>
</project>
导入io无法解析
推荐答案
添加上述依赖项时,您已将 scope
设置为 test
.这限制了您的代码无法访问源代码中该依赖项的类.也就是说,您只能在测试源中访问这些类(例如: $ {project.dir}/src/test/java/< package>
, $ {project.dir}/test/< package>
.
You have the scope
set to test
when you are adding the mentioned dependency. This limits your code from accessing that dependency's classes within your source code. That is, you can access those classes only within your test sources (ex: ${project.dir}/src/test/java/<package>
, ${project.dir}/test/<package>
.
如果这不是您想要的用例,只需删除 scope
属性.
If that is not your intended use case, just remove the scope
attribute.
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>4.1.1</version>
</dependency>
这篇关于无法解析导入io.restassured.RestAssured的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!