I am using the rest-assured library to automate API's.
I was struggling from yesterday.
I was getting error with clean install like below:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project rest-assuredProject: Compilation failure: Compilation failure: [ERROR] /D:/Workspace/rest-assuredMaven/src/basics/twitterAPI.java:[12,22] package io.restassured does not exist [ERROR] /D:/Workspace/rest-assuredMaven/src/basics/twitterAPI.java:[14,31] package io.restassured.response does not exist [ERROR] /D:/Workspace/rest-assuredMaven/src/basics/twitterAPI.java:[16,29] cannot find symbol [ERROR] symbol: class RestAssured
Today I refer a below stack thread
Maven Compilation error [package org.testng.annotations does not exist]
one of the answers said to use compile test instead of clean install. And guess what it started working. even just test is working fine. Now I have query that why it is happening
I have observed that their are some static import present in the script. Example:
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;
Is it due to same?
Also, Let me know if I need to improvise it further more