Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij asks for Postgresql dependency when it is there

My Ide Intellij is complaining in a class with the following message "Cannot resolve symbol PSQLException". I click on the red code and he shows this popup:

enter image description here

Now, it is strange that asks for that specific dependency. I actually have the following in my pom

<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>9.4-1206-jdbc42</version>
</dependency>

and even if I replace it with the version requested, the class PSQLException is not recognized.

Suggestion?

like image 809
mat_boy Avatar asked Dec 15 '25 00:12

mat_boy


1 Answers

The issue was due to IntelliJ 15 In the .iml file I had the following entry

<orderEntry type="library" scope="RUNTIME" name="Maven:
       org.postgresql:postgresql:9.4-1206-jdbc42" level="project" />

because the dependency in the pom was having the scope set to runtime. When I had to import the exception, I removed the runtime scope, but that wasn't removed by intellij from the .iml file.

Actually, IntelliJ has very often such an annoying behavior. I don't know why I didn't recognized this early.

like image 142
mat_boy Avatar answered Dec 16 '25 14:12

mat_boy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!