JavaDoc + Package-info.java + Eclipse + Maven + Checkstyle = ?
Posted on 2011-03-18
I am upgrading my project from using Checkstyle 4.4 to 5.3 and while I am at it, updating my packages to include Package-info.java for package annotation support. My project is built with Maven and am using M2Eclipse plugin for Eclipse. The suggested Maven project structure has my main java classes and test classes under different files but with the same package names.
Eclipse gives a compile error "The type package-info is already defined" if I add the Package-info.java to both main and test packages. And Checkstyle will complain if I do not have it in both.
What is the best practice here? I do not want to have to configure any special filters in my Eclipse build source, because we are relying on M2Eclipse to import the existing Maven projects out of the box. I do not want to disable the checkstyle rule because it needs to be checked. And I would rather not keep using the old 1.4 convention.