Question

after some refactorings, grails does not find classes from a gant script.

The gant script is located in a plugin (as ZIP in /lib) and uses several groovy classes. Those classes could not be resolved by the script.

I already tried: grails refresh-dependencies, grails clean-all, deleting the {home}/.grails directory, starting a new project and include the plugin there, add it to maven and reference it as dependency...

i do not have any clue now... i need help on this one.

The exception is:

| Error Error executing script GenerateMyDomain: startup failed:
GenerateMyDomain: 1: unable to resolve class de.company.my.mybackend.scaffolding.GenerateMyDomainClass
 @ line 1, column 1.
GenerateMyDomain: 2: unable to resolve class de.company.my.mybackend.scaffolding.JavaParser
 @ line 2, column 1.
2 errors

in BuildConfig.groovy:

compile 'de.company:my:0.1'

does anyone have another idea? Thanks!

edit: the missing classes of the plugin are located in src/groovy originally. They are included in the .zip package too.

Was it helpful?

Solution

It seems that it is not possible to instanciate classes directly from Gant scripts. I dont know why, but it worked before.

The solution is to instanciate the classes by reflection.

mcLoader = classLoader.loadClass('plugin.ui.scaffold.UserInterfaceTemplateGenerator')
def instanciatedClass = mcLoader.newInstance(classLoader)

From: NoClassDefFoundError GANT script on Grails

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top