0

Trying to help my colleague set up and we're stumped why IntelliJ cannot find packages it clearly downloaded and sees (according to External Libraries).

enter image description here

Things he's tried:

  • File > Invalidate Caches > Invalidate and Restart
  • Right click on root pom.xml > Maven > Reload project
  • mvn clean compile
  • mvn clean install
  • Switching Maven home path to bundled Maven (and back)
  • Reload All Maven Projects on Maven tab

What else can we check or try?

Andrew Cheong
  • 29,362
  • 15
  • 90
  • 145
  • 1
    Do these libraries belong to the module where you see the problem? What's the scope of these dependencies? Can you browse the jar files to see the actual classes that can't be imported (possible jar corruption)? Does the project build outside of the IDE using `mvn clean package`? Does it help if you delete `.idea` directory and [perform the clean import](https://www.jetbrains.com/help/idea/maven-support.html#maven_import_project_start)? Are there any errors in [idea.log](https://intellij-support.jetbrains.com/hc/en-us/articles/207241085) after importing the project? – CrazyCoder Oct 13 '22 at 21:21
  • Does Build | Sync tool window report any problems? Make sure `.class`/`.jar` and other important extensions were not remapped, inspect `options/filetypes.xml` file under the configuration directory, [see this answer](https://stackoverflow.com/a/13374653/104891) for more details. Check that `.class`/`.jar` extensions are not ignored at File | Settings (Preferences on macOS) | Editor | File Types, [Ignore files and folders](https://i.imgur.com/gwoSwTT.png). – CrazyCoder Oct 13 '22 at 21:21
  • Comment out lines in build gradle/pom xml, rebuild project and remove comments, rebuild again. If it helps, please, let me know. – invzbl3 Oct 22 '22 at 16:46

1 Answers1

0

There is something called scope in pom.xml . By default the scope for the code we write in java files is considered as compile. Hence by modifying that scope in pom.xml dependencies are accessible now. scope tag in pom