maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tommy Svensson <>
Subject Maven bug in conjunction with annotation processing ?
Date Fri, 19 Jul 2013 15:22:50 GMT

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

Any help is appreciated.

Best Regards,
Tommy Svensson

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message