Invalid duplicate class definition of class when creating a groovy class

Hi,

I create a new groovy class using intellij idea 10.5 I get an error if I build the project saying I have a duplicate class definition.

As an example if I create a new project called testing and add a new groovy class, called test and build I get the following error:

Invalid duplicate class definition of class Test : The source D:\SourceCode\Groovy\Testing\src\Test.groovy contains at least two definitions of the class Test.
One of the classes is a explicit generated class using the class statement, the other is a class generated from the script body based on the file name. Solutions are to change the file name or to change the class name.

Can someone tell me why this happens and how I prevent it from happening?

Please sign in to leave a comment.