I am doing the tutorial in Grails A Quick Start Guide by Dave Klein published by Pragmatic Programmers. Here is the domain Class:
class TekEvent {
String city
String name
String organizer
String venue
Date startDate
Date endDate
String description
String toString(){
"$name, $city"
}
static constraints = {
name()
city()
description(maxSize:5000)
organizer()
venue()
startDate()
endDate()
}
}
And here is the BootStrap class:
class BootStrap {
def init = { servletContext ->
def event1 = new TekEvent(name: 'Gateway Code Camp',
city: 'Saint Louis, MO',
organizer: 'John Doe',
venue: 'TBD',
startDate: new Date('9/19/2009'),
endDate: new Date('9/19/2009'),
description: '''This conference will bring coders from
across platforms, languages, and industries
together for an exciting day of tips, tricks,
and tech! Stay sharp! Stay at the top of your
game! But, don't stay home! Come an join us
this fall for the first annual Gateway Code
Camp.''')
if (!event1.save()){
event1.errors.allErrors.each{error ->
println "An error occured with event1: ${error}"
}
}
def event2 = new TekEvent(name: 'Perl Before Swine',
city: 'Austin, MN',
organizer: 'John Deere',
venue: 'SPAM Museum',
startDate: new Date('9/1/2009'),
endDate: new Date('9/1/2009'),
description: '''Join the Perl programmers of the Pork Producers
of America as we hone our skills and ham it up
a bit. You can show off your programming chops
while trying to win a year's supply of pork
chops in our programming challenge.
Come and join us in historic (and aromatic),
Austin, Minnesota. You'll know when you're
there!''')
if (!event2.save()){
event2.errors.allErrors.each{error ->
println "An error occured with event2: ${error}"
}
}
}
def destroy = {
}
}
This works fine from command line. However, the Bootstrap class has the following two errors in STS 2.2.1 environment:
Groovy:unable to resolve class TekEvent - Line 4
Groovy:unable to resolve class TekEvent - Line 23.
I do a run-app from within Eclipse. It warns me that errors exist should I run it? I say yes, it runs it and everything is fine. It seems like it cannot resolve the dependency somehow.
Bharat


Reply With Quote
