1

Running tests and building from Intelij works fine. But, when I try to build or test an application from the command line I'm getting this error

error: package javax.annotation does not exist
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2019-06-27T18:20:07.986+03:00")

I'm using the gradle v 6.8 wrapper. JDK is AdoptOpenJDK 1.8

dev-rifaii
  • 217
  • 2
  • 9
  • 2
    That class was removed in Java 11 so I suspect that you are not actually using Java 8 on the command line. Try running `gradlew --version` (or however you are invoking Gradle) to check the main JVM version. If it is different, you should be able to change it by setting the `JAVA_HOME` environment variable. – Bjørn Vester Dec 09 '22 at 09:13
  • @BjørnVester correct, seems like I have JDK 11 too on my machine and the PATH was set there randomly for some reason. Thanks – dev-rifaii Dec 09 '22 at 09:25
  • For Java 11 you can add this dependency: https://mvnrepository.com/artifact/javax.annotation/javax.annotation-api. The Jakarta EE version is https://mvnrepository.com/artifact/jakarta.annotation/jakarta.annotation-api. – Rob Spoor Dec 09 '22 at 10:50

0 Answers0