satvaimal / optimus

Grails Optimus Plugin
Apache License 2.0
4 stars 2 forks source link

Optimus in a grails plugin #5

Open vmptk opened 10 years ago

vmptk commented 10 years ago

Is it suppose to run optimus in a grails plugin?

if no, skip the rest of the content :)

If yes, how to solve the follow issue: optimus-all SignUp --stacktrace | Error Error running script optimus-all SignUp --stacktrace: startup failed: _OptimusUtils_groovy: 2: unable to resolve class org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder @ line 2, column 1. _OptimusUtils_groovy: 1: unable to resolve class org.codehaus.groovy.grails.orm.hibernate.cfg.CompositeIdentity @ line 1, column 1. 2 errors (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.) org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: _OptimusUtils_groovy: 2: unable to resolve class org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder @ line 2, column 1. _OptimusUtils_groovy: 1: unable to resolve class org.codehaus.groovy.grails.orm.hibernate.cfg.CompositeIdentity @ line 1, column 1. 2 errors

at gant.Gant.compileScript(Gant.groovy:631)
at gant.Gant.this$2$compileScript(Gant.groovy)
at gant.Gant$_closure1.doCall(Gant.groovy:129)
at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:57)
at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
at CreatePropertiesFile_groovy.run(CreatePropertiesFile_groovy:1)
at CreatePropertiesFile_groovy$run.call(Unknown Source)
at CreateConfig_groovy$run.call(Unknown Source)
at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:59)
at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
at CreateConfig_groovy.run(CreateConfig_groovy:1)
at CreateConfig_groovy$run.call(Unknown Source)
at CreatePropertiesFile_groovy$run.call(Unknown Source)
at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:59)
at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
at OptimusAll.run(OptimusAll:1)
at OptimusAll$run.call(Unknown Source)
at gant.Gant.prepareTargets(Gant.groovy:607)

| Error Error running script optimus-all SignUp --stacktrace: startup failed: _OptimusUtils_groovy: 2: unable to resolve class org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder @ line 2, column 1. _OptimusUtils_groovy: 1: unable to resolve class org.codehaus.groovy.grails.orm.hibernate.cfg.CompositeIdentity @ line 1, column 1. 2 errors

satvaimal commented 10 years ago

http://grails.org/doc/2.0.2/guide/plugins.html#creatingAndInstallingPlugins

Since Grails 2.0.2, The Grails Hibernate plugin is not included by default in a Grails plugin project. You need to include the Grails Hibernate Plugin by hand.

Hope this helps.

vmptk commented 10 years ago

Thanks for the response. It seems to fix it, but now I am facing the follow one:

grails> optimus-all SignUp --stacktrace --verbose | Finished generation of 'config.properties' file | Error 'SignUp' IS NOT A DOMAIN CLASS!!! | Finished generation of 'DataSource.groovy' file | Finished generation of config artifacts | Error 'SignUp' IS NOT A DOMAIN CLASS!!! ......

satvaimal commented 10 years ago

It seems that the plugin doesn't find your "SingUp" domain class. I have tested the Optimus plugin within another plugin and it works. Please send me more information about your plugin and your environment.

vmptk commented 10 years ago

Back to the grid.

The setup is fairly simple, I have just create a brand new plugin, then add hibernate to the plugin list (thanks for that, btw), then simple use the plugin in an grails app. Nothing special I would say. Grails version 2.3.0, Oracle JDK 1.7_15, Ubuntu 13.04.

satvaimal commented 10 years ago

I was trying to reproduce the problem you are facing, but I cannot get it. First, I create a new plugin (call it "newPlugin"), I install optimus and hibernate via BuildConfig.groovy, I create a domain class INSIDE newPlugin and I run optimus-all. Everything is OK.

Now, the second scenario: Create a new plugin (newPlugin), install optimus and hibernate via BuildConfig.groovy, create new Grails App, install newPlugin via BuildConfig.groovy and run optimus-all. The command is not recognized.

Did I understand you or am I wrong?

vmptk commented 10 years ago

1) Create grails app (APP) 2) Create grails plugin (PLUGIN) 3) Create domain class in Plugin 4) Add PLUGIN to APP project with local pluging configuration in BuildConfig.groovy 5) Add Optimus to APP again in BuildConfig.groovy - compile, run-app 6) Open interactive console on APP and run optimus-all for the domain class