I got to work with an existing java code base which uses gradle. I had to create a new class and import it in an existing class. When I run gradle build
or gradle bootRun
it gives the following error and build fails.
error: cannot find symbol
import com.someservice.generic.model.SomeNewClass;
^
symbol: class SomeNewClass
location: package com.someservice.generic.model
Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error FAILED
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':compileJava'.
Compilation failed; see the compiler error output for details.
My new class looks like as follow,
package com.someservice.generic.model;
public class SomeNewClass {
}
And I import it as
import com.someservice.generic.model.RUnregPatient;
I have referred following questions
Getting "cannot find Symbol" in Java project in Intellij
Can't compile java class in Intellij Idea due to "cannot find symbol class X" error
and tried reimporting, invalidatite cache and restarting, rebuilding as suggested. None of them worked for me.