Unable to find/import 'io.rest-assured' packages even after adding to Maven Project

1k views Asked by At

I have added the below dependencies to the maven project pom.xml file and i did a mvn clean, install. I can see the dependencies added to the .m2 folder in my c-drive/users, but they are not listed under the IntelliJ "External Libraries" section. Also when i try to import them to the class i am not seeing them and i get 'Not found' error.

Dependencies added -

    <dependency>
        <groupId>io.rest-assured</groupId>
        <artifactId>json-path</artifactId>
        <version>3.3.0</version>
    </dependency>
  
    <dependency>
        <groupId>io.rest-assured</groupId>
        <artifactId>json-schema-validator</artifactId>
        <version>4.3.0</version>
    </dependency>

enter image description here

1

There are 1 answers

1
Peter Quan On

I think it might be because of the lack of <scope>. The default scope is compile, used if none is specified, but we need test here.

<dependency>
    <groupId>io.rest-assured</groupId>
    <artifactId>json-path</artifactId>
    <version>4.3.1</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>io.rest-assured</groupId>
    <artifactId>json-schema-validator</artifactId>
    <version>4.3.1</version>
    <scope>test</scope>
</dependency>