“Class already exists” error in IntelliJ on Groovy class (that exists in module dependency also)

Answered

Hello,

in IntelliJ (2016.2 and previous) we have our Groovy source file marked red with the error "class <classname> already exists".
I think we can exclude that the cause is the stub-generation, as this is deactivated.

We have included our compiled groovy (and java) classes in a jar that is registered as dependency.

Dependency MyProduct.jar contains `com.mycompany.MyGroovyClass`

Our source contains as well `com.mycompany.MyGroovyClass`

Find below screenshots from the error as well as the module dependency configuration.

The error disappears if the dependency is registered with Runtime-Scope, in all other scopes the error appears.

However, in our structure we kinda *have* to include the compiled classes in a compile scope, as we want to avoid that each developer needs to compile all classes (I know about the compile in background ability, but we have a constellation that prevents this from working).

We have no errors in `com.mycompany.MyJavaClass` which exists as well in source and in MyProduct.jar.

Any ideas on how we can solve this?

Thx
Jan

 

 

 

Please sign in to leave a comment.