I have a maven java project in eclipse. I added a groovy file in the project having a public variable. I access the groovy variable in another java class but i get compilation error (see below). I have the GRECLIPSE plugin installed. Also via command line when I build the project using mvn it compiles successfully.
How do I resolve this?
Groovy class -
package com.impl
class UserConstants {
public static final String USER_PREFERENCES =
"""Some value"""
}
Java class in the same package. At the import line I get error "The import cannot be resolved" and due to that I get error at the Sysout line also "USER_PREFERENCES cannot be resolved to a variable"
package com.impl
import static com.impl.UserConstants.USER_PREFERENCES;
public class UserPreferences {
public UserPreferences() {
System.out.println(USER_PREFERENCES);
}
}