BobbKitty729
BobbKitty729

Reputation: 367

How to solve "java: package com.opencsv does not exist" in Maven with IntelliJ?

In Maven, I have quite a few dependencies that IntelliJ import. I also have the one for CSVReader

<dependency>
    <groupId>com.opencsv</groupId>
    <artifactId>opencsv</artifactId>
    <version>5.2</version>
</dependency>

In the class that uses it, I have import com.opencsv.CSVParser;. It says, "Cannot resolve symbol CSVParser". It gives me an option to add library to classpath. I'm hesitant to do this as last time I did this, it resolved the error but wouldn't allow me to run my Spring Boot application. Why can't the library just be imported like the other ones?

Upvotes: 4

Views: 11298

Answers (2)

Innomight
Innomight

Reputation: 556

Commenting out lines where you used the dependency and then building the project once and reloading helps.

Upvotes: -1

Ariye Caspi
Ariye Caspi

Reputation: 76

Had the same issue. A right-click on the project -> Maven -> 'Reload project' may probably fix it.

Upvotes: 5

Related Questions