Hello,

I've been investigating why mvn install without clean doesn't work for my 
project. I've traced it down to using Dagger, though I think most (all?) 
code-generating annotation processors will be affected.


I've created a simple project that reproduces the problem: 
https://github.com/marquiswang/incremental-compile-dagger-test


The README describes exactly how it goes wrong. It basically means that if you 
are using Dagger, you always need to do a mvn clean install in order to 
successfully compile your code.


I've got a slightly-hacky patch for 
IncrementalBuildHelper<https://github.com/apache/maven-shared-incremental/blob/master/src/main/java/org/apache/maven/shared/incremental/IncrementalBuildHelper.java>
 that I think is a pretty good way to solve the problem. Basically, we need to 
treat the generatedSourcesDirectory (by default 
target/generated-sources/annotations) the same as the outputDirectory and 
delete files from it when re-compiling during an incremental build. I'll share 
the patch as soon as I get permission from my employer, but it is pretty 
straightforward.


Does this make sense? If so I can clean up the patch and convert it to a PR.


Thanks,

Marquis Wong

Marquis Wong
Software Engineer
T +13122443368
E [email protected]<mailto:[email protected]>
233 South Wacker Drive # 4300,
Chicago, Illinois 60606, US
[IMC Logo]<https://www.imc.com/us/>

[F]<https://www.facebook.com/IMCTrading>


[t]<http://twitter.com/IMCTrading>


[I]<https://www.instagram.com/imctrading/>


[in]<https://www.linkedin.com/company/imc-financial-markets>


imc.com<https://www.imc.com/us/>



________________________________

The information in this e-mail is intended only for the person or entity to 
which it is addressed.

It may contain confidential and /or privileged material, the disclosure of 
which is prohibited. Any unauthorized copying, disclosure or distribution of 
the information in this email outside your company is strictly forbidden.

If you are not the intended recipient (or have received this email in error), 
please contact the sender immediately and permanently delete all copies of this 
email and any attachments from your computer system and destroy any hard 
copies. Although the information in this email has been compiled with great 
care, neither IMC nor any of its related entities shall accept any 
responsibility for any errors, omissions or other inaccuracies in this 
information or for the consequences thereof, nor shall it be bound in any way 
by the contents of this e-mail or its attachments.

Messages and attachments are scanned for all known viruses. Always scan 
attachments before opening them.

Reply via email to