committedandroider
committedandroider

Reputation: 9301

How can I debug my IDE(Intellij) not resolving a dependency when maven can with the same java version?

This is a short code sample in my unit test

 if (retries >= maxRetries) {
    return InputStream.nullInputStream();
 }

I'm able to run the tests fine (w this code sample) using mvn test

However in Intellij, when I try to debug these tests(Run -> Debug), I get the error "cannot find symbol - method nullInputStream()"

Does anyone know what could be causing this?

nullInputStream looks like it was introduced in Java 11 but my Intellij IDE is set at 17(See screenshot)

My maven which recognizes this dependency is also set at Java version 17(See output below)

[email protected] .... % mvn -v  
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/apache-maven
Java version: 17.0.7, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "13.2.1", arch: "aarch64", family: "mac"

enter image description here

Upvotes: 0

Views: 48

Answers (1)

committedandroider
committedandroider

Reputation: 9301

Under project structure, the project was set at Java 17 but not all of the modules were set to that version

If you experience this, make sure all your modules are also set at the correct java version

Upvotes: 0

Related Questions