Rest assured 3.0.3 maven dependency in IntelliJ IDEA not working

3.7k views Asked by At

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.

7

There are 7 answers

0
Furkan On

You should rebuild or clean and restart your project. Make sure it will work.

1
Deepak raj On

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.

0
Nafeez Quraishi On

Adding the lib to classpath can be tried, like below. It resolved issue i had with the import after Maven dependency addition.

enter image description here

0
Sanja Paskova On

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

0
Dhruv Singh Kushwah On

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>
0
Suraj On

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>
0
Erol On

I also had the same issue on IntelliJ while I was using Maven/Gradle. You have to refresh maven/gradle dependencies to let system recognize new extensions

You should just click to refresh maveh/gradle which you should see the button at the right corner of the screen.