Search code examples
javaspring-bootmavencsvreader

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?


Solution

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