Rohit Mehlawat
Rohit Mehlawat

Reputation: 121

package org.jetbrains.annotations does not exist

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?

Upvotes: 9

Views: 28562

Answers (5)

karthikairam
karthikairam

Reputation: 345

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.

Upvotes: 5

Stevo Glizzy
Stevo Glizzy

Reputation: 21

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

implementation 'org.jetbrains:annotations:16.0.2'

Upvotes: 2

CodeWithVikas
CodeWithVikas

Reputation: 1443

For me adding jetbrains dependency worked fine.

Provide dependency something like this.

For Gradle:

implementation 'org.jetbrains:annotations:16.0.2'

Upvotes: 5

Ben
Ben

Reputation: 761

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.

Upvotes: 0

Jonathan Schoreels
Jonathan Schoreels

Reputation: 1730

If you really need them, add the dependency in your pom.xml :

<!-- https://mvnrepository.com/artifact/org.jetbrains/annotations -->
<dependency>
    <groupId>org.jetbrains</groupId>
    <artifactId>annotations</artifactId>
    <version>16.0.1</version>
</dependency>

( https://mvnrepository.com/artifact/org.jetbrains/annotations/16.0.1 )

Upvotes: 4

Related Questions