18

This is my first time using IntelliJ so this is probably just a basic question but alas I have it anyways.

I have cloned a github project into IntelliJ that uses gradle. I import and first thing it says is that gradle is not set up right, so I set it up according to the following: gradle prefrences Java version 14.0.1. Then it said the SDK was still not set up so I again set that up for again version even though I am not using Android.

I can successfully run a few of the grade tests but all of my java code no longer links methods and when I run the tests (directly from github without any changes yet) I get an error: cannot find symbol @javax.annotation.Generated(

Also all of the methods in my example seem to no longer link. I have a screenshot of this too.

Any guidance is appreciated, probably a problem in the set up? I found this symbol error a few times but no resolution that helped. I tried invalidating caches and restarting a few times. I deleted the .idea files a few times. tried a different repository in git and still having the same errors.

Thanks!

Community
  • 1
  • 1
Amanda
  • 181
  • 1
  • 1
  • 3

2 Answers2

12

Simply add the javax annotation dependency into your build.gradle.

dependencies {
  //...
  implementation 'javax.annotation:javax.annotation-api:1.3.2' 
  //...
}

like so.

Dávid Tóth
  • 1,873
  • 16
  • 36
10

Add javax.annotation-api dependency to your Maven pom.xml

<dependency>
    <groupId>javax.annotation</groupId>
    <artifactId>javax.annotation-api</artifactId>
    <version>1.3.2</version>
</dependency>
Vijay Nandwana
  • 2,328
  • 3
  • 23
  • 38
Saurabh Verma
  • 1,110
  • 1
  • 17
  • 30