Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse javadoc: The type package-info is already defined

Tags:

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

like image 711
vacuum Avatar asked Jun 28 '12 13:06

vacuum


People also ask

What is Package-info Java in JAXB?

package-info. java is a way to apply java annotations at the package level. In this case Jaxb is using package-level annotations to indicate the namespace, and to specify namespace qualification for attributes (source). Follow this answer to receive notifications.

What is Packageinfo?

The package-info. java is a Java file that can be added to any Java source package. Its purpose is to provide a home for package level documentation and package level annotations.

How do you create a package-info class?

In IntelliJ IDEA, we can right-click on the package and select New-> package-info. java: Eclipse's New Java Package option allows us to generate a package-info.


1 Answers

You can do this -->

Go to Build path -> configure build path -->

in Source tab -->

select the package (in which you have these problematic package-info.java file) for eg. project-name/src/test/java

click on exclude -> and in exclusion pattern add "**/package-info.java"

this should solve the problem, as plainly you are asking eclipse to exclude these files, and thus you wouldn't have to delete those files and solving your SCM related issues

like image 160
Amit Avatar answered Sep 21 '22 18:09

Amit