The import io.restassured.RestAssured cannot be resolved
See original GitHub issueHi Johan,
I am getting the red squiggly lines when I use the below static imports:
import static io.restassured.RestAssured.*; import static io.restassured.matcher.RestAssuredMatchers.*;
My POM. xml has the below dependencies:
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>3.0.3</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.rest-assured/json-path -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-path</artifactId>
<version>3.0.3</version>
</dependency>
<!-- to validate that a JSON response conforms to a Json Schema -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-schema-validator</artifactId>
<version>3.0.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.rest-assured/xml-path -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>xml-path</artifactId>
<version>3.0.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.3</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>java-hamcrest</artifactId>
<version>2.0.0.0</version>
</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>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-library -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.beust/jcommander -->
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.72</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.yaml/snakeyaml -->
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.18</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.inject/guice -->
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.assertj/assertj-core -->
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.8.0</version>
<scope>test</scope>
</dependency>
And my imports for the time being are: import static io.restassured.RestAssured.; import static io.restassured.matcher.RestAssuredMatchers.; import static org.hamcrest.Matchers.; import java.io.IOException; import java.io.InputStream; import java.util.List; import static io.restassured.path.json.JsonPath.; import org.testng.annotations.Test; import io.restassured.path.json.JsonPath;
Don’t know where am I missing something. Also the given() etc (without any parameter) is not showing in the IntelliSense. Please help!!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:11
- Comments:52
Top Results From Across the Web
The import io.restassured.RestAssured cannot be resolved
1. library in my Eclipse IDE. I have added the rest assured library in my pom.xml file still the error is not resolved....
Read more >The import io.restassured.RestAssured cannot be resolved
Maven repository (https://mvnrepository.com/artifact/io.rest-assured/rest-assured) has the scope set to test in the dependency tag.
Read more >import io.restassured.restassured cannot be resolved
There are two ways to solve the issue “cannot be resolved to a type “: For non maven project, add jars manually in...
Read more >Unable To Find/Import 'Io.Rest-Assured' Packages Even After ...
RestAssured cannot be resolved. While consuming restassured maven dependencies it has been observed that even after downloading the dependencies eclipse is not ...
Read more >The import io.restassured.RestAssured cannot be resolved
RestAssured cannot be resolved. ... I am getting the red squiggly lines when I use the below static imports: import static io.restassured.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The reason is the
<scope>test</scope>
The fix for version 4.1.1 is to add some transitive dependencies:
They are now excluded in the
maven-bundle-plugin
rest-assured 4.1.1 configuration. See the negated packages in the<Export-Package>
of https://repo.maven.apache.org/maven2/io/rest-assured/rest-assured/4.1.1/rest-assured-4.1.1.pom