0

I have a Java/Maven project in intellij with the following file structure :

My directory structure

And the following line get me the error " Package name 'test.java.princ' does not correspond to the file path 'princ'"

Line with the error

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.

2
  • 5
    You are using maven - at least I can deduce it from having target directory. main and java directories are just a way Maven organizes project files and those directories are not part of packaging system. In your case you should just use princ as package name. Commented Jun 9, 2022 at 15:41
  • @MichałKrzywański You can put your comment as an answer for me to accept it, as it is more detailed than the current accepted answer. Thanks ! Commented Jun 9, 2022 at 16:13

1 Answer 1

1

you should not need the main.java just do package princ... for example: Model.test for this project layout: Project Structure. this gives me no errors.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.