“Class already exists” error on Groovy class, repeatedly rewriting module settings from mvn pom
Followed by 2 people
I can't work out how to permanently get rid of the "class already exists" error in the groovy editor on my groovy class declaration.
I have a multi-module project with many Java projects, and this one maven plugin project with a groovy class.
When I go into the module settings and remove the "target/generated-sources" from the Sources settings, IntelliJ will be happy for a while.
Then at some point, probably after editing the pom, IntelliJ resets the settings and I saw a message saying it's read them all from the pom.
How can I either configure IntelliJ just to stick with my version of the module settings, or how can I configure the maven pom to make the IntelliJ module settings ignore the generated-sources so I don't get that error?
Or is there a different approach? I seriously doubt I have found a bug (in 2018.1.6) but I can't find any solution on the rest of the web.
Please sign in to leave a comment.
Does it help if you exclude generated source folder? https://www.jetbrains.com/help/idea/creating-and-managing-modules.html#configuring-content-roots
Yes, temporarily, but then IntelliJ and Maven will collaborate to break it again when I next edit the pom. This is what happens in the module settings - my original one where I removed the generated-sources dir is backed-up or something similar to "gem-groovy-maven-plugin(1)", to make way for a new one which doesn't seem happy - I've just noticed today that it says it's still loading the gem-groovy-maven-plugin:
In case of maven project, you should exclude it in pom.xml using <exclude> tag.
Well, I have added an excludes element to the maven-compiler-plugin configuration, assuming that is what you meant. I now have this (using polyglott yaml):