package org.jetbrains.annotations does not exist

Viewed 12170

I am facing an issue in IntelliJ when I tried to build my project through maven using

mvn clean install

I have tried different ways like changing the path of my JDK but nothing worked. Can someone help me out with this issue?

5 Answers

If anyone is using a plain Kotlin project (without any build tool such as maven or gradle) in IntelliJ IDEA, then you can add the jetbrain's jetbrains.annotations library by following the steps given below:

  1. Right click on the module in the Project panel on your left hand side, and select the Open module settings
  2. Select Libraries under Project settings
  3. Click the + symbol on the top of the library area and select the From Maven...
  4. Enter org.jetbrains:annotations, and hit the search icon at the end of it. Then, wait for the dropdown to list the available versions of it.
  5. Select the latest or appropriate version you need and also enable the Download to: option.
  6. Then, click OK and you are done.

For me adding jetbrains dependency worked fine.

Provide dependency something like this.

For Gradle:

implementation 'org.jetbrains:annotations:16.0.2'

just put this code in the build gradle and it will work.

implementation 'org.jetbrains:annotations:16.0.2'

I had the same issue and arrived here looking for solutions, but I couldn't find the aforementioned pom.xml. Maybe because I'm not using Maven in my project. But I solved it by editing the MyProject.iml file. I've added the following code inside the <component> tags.

<orderEntry type="module-library">
  <library>
    <CLASSES>
      <root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/20.1.0/annotations-20.1.0.jar!/" />
    </CLASSES>
    <JAVADOC />
    <SOURCES />
  </library>
</orderEntry>

Now I can use the annotations in my project.

Related