user4971722
user4971722

Reputation:

Rest assured 3.0.3 maven dependency in IntelliJ IDEA not working

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.

Upvotes: 2

Views: 4178

Answers (7)

Erol
Erol

Reputation: 144

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.

Upvotes: 0

Dhruv Singh Kushwah
Dhruv Singh Kushwah

Reputation: 11

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>

Upvotes: 0

Furkan
Furkan

Reputation: 11

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

Upvotes: 0

Deepak raj
Deepak raj

Reputation: 59

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.

Upvotes: 2

Suraj
Suraj

Reputation: 327

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>

Upvotes: 0

Nafeez Quraishi
Nafeez Quraishi

Reputation: 6178

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

Upvotes: 0

Sanja Paskova
Sanja Paskova

Reputation: 1110

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

Upvotes: 0

Related Questions