Allow invalid package name in Eclipse

I have some classes in my current project that have the wrong package declaration (they are in the wrong folder for the declared package.)

Unfortunately, fixing the problem by moving the class is not an option. Is there a way to make eclipse ignore the error?

+3
source share
3 answers

You can play with the Eclipse display in the Errors / Warnings section, but Java requires that the files in the correct folder match their package, so it cannot build

+7
source

, , ? , - Eclipse , Java.

+6

Do you have the source folder for Eclipse at the right level? The source folder for Eclipse should be at the level where the package folders begin. If there are several folders with separate package structures, each of them will be its own source folder.

-1
source

Source: https://habr.com/ru/post/1742311/


All Articles