Search code examples
eclipsejavadocm2eclipse

Eclipse javadoc: The type package-info is already defined


OS: Windows 7 x64

Eclipse Platform: 3.7.2.M20120208

m2e: 1.0.200.20111228-1245

Have similar problem as in this bug. There is a bunch of package-info.java files in /src and /test folders, so they have same package. Eclipse show error:

"The type **package-info** is already defined"

I can delete package-info.java files either in /test or /src to avoid problem indication. But this workaround is not very comfort since I am using SCM and need to delete this files all time after update. Same for Eclipse Platform 4.2.0.I20120608-1400


Solution

  • There are a few options to solve this:

    1. Move away from package-info.java files, and replace them with package.html files.
    2. Only have package-info.java files in the src/ tree, as the same-named packages in the test/ tree will "overlap" the src/ tree.
    3. Generate javadoc separately for the src/ and test/ trees, as they are probably for different audiences.