grails database-migration plugin: is jndi support on its way? - grails

I have 1.3.2 installed. My investigations found this in scripts/DbmDiff.groovy:
// TODO this will fail with JNDI or encryption codec
buildOtherDatabase = { String otherEnv ->
Searching the web lead me to this:
https://github.com/grails-plugins/grails-database-migration/commit/ac38a7310fe48ba7b5c4dda4d6e30dd8040dbeb6
which is code for DbmDiff.groovy, but in spite of the same TODO comment, appears to handle jndi.
Does this mean that a 1.3.3 is coming soon with jndi support? If so, then I can work around for a while using a temporary env using urls etc.
Regards, John

I'm not sure when 1.3.3 will be released since this is the only fix so far. It shouldn't be too soon though. Until then you can copy the current script to your application's scripts folder. Then you run grails dbm-diff Grails will ask you which of the two scripts to run.

Related

How to change per-plugin codec in Grails 3?

While I understand that it is not "best practice", I have a lot of legacy plugins that I am upgrading to Grails 3, and I need to set their GSP encoding back to the old default of "none" (because everything is already encoded where it needs to be, and we expect non-encoded data elsewhere.) Unfortunately, this appears to not work per the documentation.
The Grails 3.2.11 docs say:
Per Plugin Encoding
Grails also features the ability to control the codecs used on a per plugin basis. For example if you have a plugin named foo installed, then placing the following configuration in your application.groovy will disable encoding for only the foo plugin
foo.grails.views.gsp.codecs.expression = "none"
This did not work, using Grails 3.2.11. Encoding is still "html".
Other things I tried, that also did not work:
Just changing the plugin's application.yml from the default values (this seems like it would be ideal to me, and was what I originally expected would control the plugin encoding)
Same line, in runtime.groovy
Same line, in the plugin's plugin.groovy
Same concept with the prefix, in both the application's and the plugin's application.yml
Changes per suggestions in How can I exclude a plugin from grails default gsp encoding?
I'm perfectly willing to write this up as a Grails bug, but figured I would ask here first in case somebody else has already solved this!
Thanks in advance!
See linked grails issue for answer; short version is that:
all codecs must be valid, or defaults are used due to exception thrown in codec processing
plugins should be cleaned before publishing, or precompiled gsps may still use previous codecs

What happened to »grails doc« in grails3?

The grails 2.x doc feature looks really helpful/promising:
http://grails.github.io/grails-doc/2.5.3/ref/Command%20Line/doc.html
It says that the command »grails doc« - »Generates a user guide and Javadoc + Groovydoc API documentation for the current Grails project.
However, this section of the manual is gone in Grails 3.0.10. I could not find related info in the changelog and the grails interactive console does not know anything about a doc command. I used google but could not find anything about this. (I know about groovydoc and I use it now, but it does not know about the grails innards out-of-the-box, so my question stands)
Where did it go? Why was it removed? Will it come back?
I know this is old but... You now use gradle groovydoc to generate documentation..
You can also config it in your build.gradle
groovydoc {
destinationDir = new File("${project.docsDir}${File.separator}javadoc")
}
check out more here:
https://docs.gradle.org/current/dsl/org.gradle.api.tasks.javadoc.Groovydoc.html

Running grails test-app command from grails web console plugin

I have installed the grails web plugin. I can now browse to :
localhost:8080/myappname/console
And I can see the console displayed over there. I have bunch of test-cases written for application. I wish I can test my app from this web console.
Is it possible to do so? I'm very new to grails.
Thanks in advance.
Short answer no. The grails console is meant to write groovy code that interacts with your running application. Your running application does not include your test cases or the grails command line by default.
Long answer sort of. Provided you have all of your projects source code available somewhere in the file system where your application is running, you could call an external process to run test-app and return the result to the user. Here are some docs on running external processes in groovy: http://groovy.codehaus.org/Executing+External+Processes+From+Groovy. I suppose you could also package you application somehow to make this work, but I think doing that would be fairly complex.
I am not sure this is a good use case for the console plugin over all. Hope this helps

Spring Roo RooEntity and RooJpaActiveRecord

I am a novice with Spring.
I am looking to resolve conflicts between #RooEntity and #RooJpaActiveRecord. I have used the typicalsecurity addon to an existing project which used more recent versions of Roo (#RooJpaActiveRecord). I was wondering if there's a workaround or a specific way to address this issue. I am not able to run the project on the internal web browser. I receive the HTTP Status 404 error.
Any help or suggestions would be greatly appreciated!
#RooEntity is no longer the annotation that you have to use.
Replace it with #RooJpaActiveRecord and run the Roo shell again.
Regarding the web project, the annotations belongs to the spring-roo-annotations.jar (or something like that) that maven puts in your WEB-INF/lib folder when deploying the war application.
You need to have the appropriate jar dependency (I mean, the correct version) depending on the annotation that you have in your code.
In order to see more explanation, maybe you can provide your server stack trace.

Modify Id generation for a Grails Plugin

I am using a plugin for Grails - the Amazon S3 plugin - and the domain object provided by the plugin doesn't specify the Id Generator. I am using Postgresql and require the id genrator to be identity.
I could copy the plugin in my plugins directory and mess with the domain object provided but that doesn't sound like a clean approach.Could I add the correct id generation at runtime? Or maybe there is a better way.
If you are using 1.2, you could provide a default mapping for all your GORM classes, including generator.
grails.gorm.default.mapping = {
id generator:'sequence'
}
See more in 1.2 release notes.
I think you could copy just the S3Asset.groovy into src/groovy/. From memory, your class should override the one provided by the plugin. I've used this technique to tweak a couple of plugins until bugs were fixed. But I haven't tried it with domain classes only *GrailsPlugin.groovy files.
Also, Jean's suggestion above is a good one!
cheers
Lee

Resources