I have a Java/Maven project in intellij with the following file structure :
And the following line get me the error " Package name 'test.java.princ' does not correspond to the file path 'princ'"
In fact, it does this with every files in my project.
What I've tried :
- Rebuilding with maven
- Deleting project and importing it again
- Unmarking src/resources folder and marking them again
- supervision.iml has the correct folders as src and resources
Building works fine, with intellij or mvn command.


maven- at least I can deduce it from havingtargetdirectory.mainandjavadirectories are just a way Maven organizes project files and those directories are not part of packaging system. In your case you should just useprincas package name.