Disable or suppress "Duplicate class found" warnings/errors

Answered

There's a project, which is normally built with ant, that has several source folders with the same class, which get conditionally compiled for different platforms with different SDK-s with the usual ant build. Is it possible to suppress the warnings in IntelliJ IDEA?

2
2 comments

IDE reports the error in this case because having duplicated source files in compiler path will lead to not-compilable code. To fix this you can exclude all duplicated sources by marking folders as excluded.

If you are using Maven in project then also make sure the option Keep source and test folders on re-import is enabled in Settings(Preferences) | Build, Execution, Deployment | Build Tools | Maven | Importing. Otherwise IDE will reset folder categories on re-import from Maven pom.xml.

0
Avatar
Permanently deleted user

I still edit the code via IDE, removing the "use as code root" flag means that code completion will not work.

It is tolerable to just switch this feature on for the folder I want to edit and switch it off once done, but would love to have a way to declare all folders as source folder, but ignore the IDE warning.

 

2

Please sign in to leave a comment.