rharter / auto-value-gson

AutoValue Extension to add Gson De/Serializer support
Apache License 2.0
603 stars 103 forks source link

Compilation error in Eclipse/maven #265

Open frankbenoit opened 2 years ago

frankbenoit commented 2 years ago

I have a setup, where I use auto-value-gson in an Eclipse plugin project and with a maven build. From Eclipse, the normal internal JDT build works. On Jenkins, without Eclipse running parallel, this work. But when i try to run the maven build from inside Eclipse, it fails:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:2.5.0:compile (default-compile) on project xyz: 
Fatal error compiling: 1. ERROR: Failed to write external TypeAdapter for element "x.X" with reason 
"Source file already exists : x.X_GsonTypeAdapter"

In Eclipse I have a 'src' source directory with the annotated classes, and an 'apt-gen' source directory where the generated classes from auto-value and auto-value-gson are written to. In maven, the generated classes are normally written into target\generated-sources\annotations

The maven build from inside Eclipse works, when I delete the content of the apt-gen directory. This is not necessary for plugins, that use auto-value classes only.

It seems to me, that auto-value-gson somehow conflicts with the apt-gen directory. Can this be fixed please?