Hi Tommy,

I've run into some problems along these lines, but in my case, it only happens 
when I build first using Maven and then try to recompile in the IDE. The 
problem appears to be that the two disagree on where the generated classes go 
(there was a change in one of the JDK releases, I believe).

I work around that by doing a clean compile in maven before starting IDE work.

Is that your problem? Or are you only seeing this by only doing repeated Maven 
builds? I don't have that problem.

- Russ

On Jul 19, 2013, at 11:22 AM, Tommy Svensson <to...@natusoft.se> wrote:

> Hello,
> 
> I have found a problem when using auto triggered annotation processors 
> (META-INF/services/javax.annotation.Processor) with maven builds! The problem 
> occurs when the code have been built once and the annotation processors have 
> been triggered and generated code.  If I then build again without doing a 
> clean in between then I get a duplicate class exception for each generated 
> class. I suspect this is because maven have already build the previous 
> versions before annotation processing is triggered and when the newly 
> updated/generated sources  are compiled it conflicts the the previous built 
> classes. 
> 
> This problem does not occur when I build in the IDE not using maven. Then the 
> annotation processing behaves as expected. I suspect that if the processor 
> weren't specified in META-INF/services/javax.annotation.Processor, and was 
> run manually with apt-maven-plugin it would work better, but that is not an 
> option. I wan't my processor to be able to be used the standard Java way, and 
> with maven, without having 2 versions of it. I have found a way to identify 
> in the processor when there already are old sources available and don't 
> regenerate then, which will make it run in maven, but will then not update 
> the generated sources without first doing a clean when annotations are 
> updated. This is of course not a good solution. 
> 
> Is there any other known way to solve this problem with maven ? I'm using 
> version 3.1 of the maven-compiler-plugin.
> 
> Any help is appreciated.
> 
> Best Regards,
> Tommy Svensson
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
> 

-----------------
Come read my webnovel, Take a Lemon <http://www.takealemon.com>, 
and listen to the Misfile radio play 
<http://www.gold-family.us/audio/misfile.html>!




Reply via email to