On 23.03.2016 10:01, DECLOEDT Loic EVADERIS wrote:
Hi,

I have a problem starting up a groovy project structured like this:

project/

  classes/

    person/

       C1.groovy

   scripts

    run.groovy

The C1.groovy file contains the following code:

package person

import groovy.transform.ToString

@ToString

class C1 {

   enum Gender { M, F}

   String name

   Sex gender

}
[...]
   public C1 addC1(String name, person.C1.Gender g) {
[...]
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
failed:

/home/ldecloed/Groovy/workspace/issueImportEnum/scripts/run.groovy: 13:
unable to resolve class person.C1.Sex

  @ line 13, column 32.

      public C1 addC1(String name, person.C1.Sex g) {

                                   ^

the code you show here and the code the error marks are clearly different ones. The class Sex is missing in C1 and the add method you showed uses Gender instead of Sex. If you compiled against an old version with partial changes such an error would not be surprising at all.

And actually that can be more than just differing version in source, it can also be caused by old class files. So did you ensure that there are no .class files of the classes you want to execute in the directories you include in the class path? Because if there are class files laying around it is very possible groovy will pick them up instead of the source. Normally this is controlled by the modification date of the files, but I don't know if that information is reliable on your system.

bye Jochen

Reply via email to