Java Mailing List Archive

http://www.gg3721.com/

Home » user.groovy »

[groovy-user] Groovy variable not accessible in java class of same project in
eclipse

bbhangale

2012-01-27


Author LoginPost Reply
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);
  }
}

--
Sent from the groovy - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.