I have a project in Eclipse and a problem with a groovy script therein.
In the script I need to import some classes from a different package in the project. I can import things like groovy.sql.Sql
or java.sql.ResultSet
just fine.
However, when I try to import classes from the project, I get an "Unable to resolve class ..." exception on each import. All java classes can do any imports with no problems. Why won't it recognize things added to the build class in eclipse?
Anyone know how I can get this to work? Not sure if it matters but I have the most up-to-date version of the groovy-eclipse plugin.
Its not as simple as the Groovy classes your are trying to import are not among the project's Source folders, is it?
I do this all the time without issue. As long as all the source folders are in the project, "Run As Groovy Script" and "Run as Groovy Console" work like a champ.
import org.rekdev.util.*
println "Hello. It is ${new Date().format('yyyy-MM-dd hh:mm:ss zzz')}"
// this guy is in src/org/rekdev/util/Hello.java
def hello = new Hello("Bob")
println "$hello"
// this guy is in src/org/rekdev/util/World.groovy
def world = new World("Earth")
println "$world"
// this guy is in src/NoPackage.groovy
def nopkg = new NoPackage()
println "$nopkg"