I am new to using IntelliJ. I setup the project structure to level 8 and added the SDK and required fields. Now in the POM I have the maven dependency for RESTAssured 3.0.3 I can see the dependency jar but it is not working in the project. The import itself is failing. Please help.
Rest assured 3.0.3 maven dependency in IntelliJ IDEA not working
3.7k Views Asked by AudioBubble AtThere are 7 best solutions below

I had the same issue while adding the dependency for the first time in the IntelliJ after closing and opening again the project the dependency started downloading and after few mins all the dependencies of the RestAssured(4.3.0) got downloaded and resolved.

I had the same issues in eclipse when first time installed it. Clean up worked for me and closing and opening it again.

Worked for me. In the dependency, I had the scope tag with the value "test". Add the same dependency and add the scope as "compile."
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>4.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.4.0</version>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>4.3.0</version>
<scope>compile</scope>
</dependency>

First of all clear all the dependancy present in .m2>repository> io folder. io folder store rest assured all dependancy. Enable auto import, if still not able to import then right click on project>maven> reimport . Add following code in pom.xml for dependancy download. This will resolve your problem.
<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>
You should rebuild or clean and restart your project. Make sure it will work.