[Bug]: Duplicate classes when trying to compile in IntelliJ
- Dominant language
- Java
- Stars
- 2k
- Forks
- 392
- Avg merge
- 11h 24m
- Merged PRs (30d)
- 36
Description
### Describe the bug
If you use the `spoon-maven-plugin` in your project, it then seems that you can no longer compile the project in IntelliJ as you get errors about `java: duplicate class: MyClass` for every class that is processed by spoon.
I believe that this is because `src/main/java` contains a copy of the class (.java) file, and then also `target/generated-sources/spoon` contains another (processed) copy of the class (.java) file.
IntelliJ doesn't seem to understand that the original copy in `src/main/java` should be ignored, and there seems to be no easy way to configure this (e.g. remove `src/main/java` as a source root) without breaking many things.
NOTE - the build still works fine outside of IntelliJ when using `mvn` from the CLI; but IntelliJ is probably the most popular IDE, and we need to use it here.
Any ideas?
### Source code you are trying to analyze/transform
Example Maven plugin config from `pom.xml`:
```xml
fr.inria.gforge.spoon
spoon-maven-plugin
3.8.0
spoonify
generate-sources
generate
21
true
xyz.elemental.build.tools.spoon.processors.PermissionRequiredProcessor
fr.inria.gforge.spoon
spoon-core
11.2.1
xyz.elemental
exist-core-build-tools
${project.version}
```
### Spoon Version
spoon: 11.8.2
spoon-maven-plugin: 3.8.0
IntelliJ: 2025.2.1
### JVM Version
21
### What operating system are you using?
macOS
Contributor guide
Assessment
This issue has not been assessed yet.