The import io.restassured.RestAssured cannot be resolved

While consuming restassured maven dependencies it has been observed that even after downloading the dependencies eclipse is not able to resolve io.restassured package.

Maven repository (https://mvnrepository.com/artifact/io.rest-assured/rest-assured) has the scope set to test in the dependency tag. 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/, ${project.dir}/test/.

Mostly that is not the intended use case, so just remove the scope attribute.

<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
<dependency>
    <groupId>io.rest-assured</groupId>
    <artifactId>rest-assured</artifactId>
    <version>4.3.2</version>
    <!-- <scope>test</scope> -->
</dependency>

Leave a Reply

Your email address will not be published. Required fields are marked *