Jenkinsfile/Groovy: Cannot resolve symbol [...] error when attempting to use an enum in another class

Viewed 371

I have an enum defined top-level inside a Groovy class which I want to use in another class that is located in another source file:

// File: A.groovy

package com.example.pkg

class A {
    static enum E {
        VALUE
    }
}
// File: B.groovy

package com.example.pkg

import package com.example.pkg.A

class B {
    void example() {
        final enumValue = A.E.VALUE
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^ <- unable to resolve class 'A.E'
    }
}

Whenever I try to access the enum the Java-way, I get an 'unable to resolve class A.E' error.

Am I doing something wrong? I cannot find any useful information online.

Thanks in advance!

0 Answers
Related