Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ error: cannot find symbol @javax.annotation.Generated [duplicate]

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!

like image 556
Amanda Avatar asked Aug 30 '25 15:08

Amanda


1 Answers

Simply add the annotation dependency into your build.gradle.

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

Jakarta EE

Obtain the modern Jakarta EE edition from a Maven repository such as this.

<!-- https://mvnrepository.com/artifact/jakarta.annotation/jakarta.annotation-api -->
<dependency>
    <groupId>jakarta.annotation</groupId>
    <artifactId>jakarta.annotation-api</artifactId>
    <version>3.0.0</version>
</dependency>

javax.*

The previous generation of javax.* versions were found at a Maven repository such as this.

<!-- https://mvnrepository.com/artifact/javax.annotation/javax.annotation-api -->
<dependency>
    <groupId>javax.annotation</groupId>
    <artifactId>javax.annotation-api</artifactId>
    <version>1.3.2</version>
</dependency>
like image 79
Dávid Tóth Avatar answered Sep 14 '25 18:09

Dávid Tóth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!