I am upgrading a project from using java 6 to java 7 and ran into this problem. This project is using spring and JPA 2.0. There are some classes that have a StaticMetaModel annotation. When I compile in java 6 there is no problem, but when I compile in java 7 I see the following error:
...\trunk\target\generated-sources\annotations\..\[SOME_NAME]Entity_.java:[8,16] error: duplicate class: [SOME_NAME]Entity_
Basically java 7 is running some kind of annotation processor that copies over these classes to the generated-sources\annotations folder and then it is trying to compile against this path. This will never work as those classes exist elsewhere and were copied over from that other location to this new location. Obviously this is why I am getting the "duplicate class error", but I am not sure how to fix this.
Java 6 seems to ignore this issue.
Here is the part of my pom file that I think might have to do with it.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
The following was commented out in this plugin, but when added it had no effect that I could recognize.
<compilerArguments>
<processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
</compilerArguments>