Grails 3.2.x with Flyway - grails

I'm finding the available information about using Flyway with later (3.2.9) versions of Grails somewhat confusing.
There is a grails-flyway plugin that was around in Grails 2 days. It has been migrated to Grails 3. The Grails Documentation 4.4.2 Automatic Database Migration has a Flyway link to org.grails.plugins:grails-flyway, the Grails Flyway plugin.
But, the Flyway documentation for Grails 3 says "Grails 3.x is based on Spring Boot comes with out-of-the-box integration for Flyway." All we have to do is include a reference to Flyway in build.gradle.
And there is an article Flyway with Grails 3 by Kris Richardson that describes how to use Flyway with Grails 3 and no mention of the grails-flyway plugin in sight. Kris does describe that it isn't quite so simple and we need to define a bean in spring resources.groovy, but I think that's more to do with automatic DB migration.
Can someone clarify the current state of play regarding using Flyway with the later (3.2+) versions of Grails? Do I need the plugin, or not?
How can I make change the automatic migration behaviour different per environment?

Related

is latest spring security version compatible in grails 2 app?

is it possible to use the latest spring security plugin in grails 2 app?
http://plugins.grails.org/plugin/grails/spring-security-core
If, by latest, you mean the current Grails 3 version of the Spring Security Plugin, then I'd say the quick answer is "no", it's not compatible with a Grails 2 application.
Plugins in Grails 2 and Grails 3 differ in form, installation scripts, etc. For instance, in Grails 2 you have to install the plugin, whereas in Grails 3 you just depend on the plugin.
That said, Grails 3 plugins are basically just zip/jar files, and you could try just depending on the Grails 3 plugin, which would get you the classes on your classpath at least, but none of the setup that Spring Boot performs when using that plugin in Grails 3. Furthermore, the plugin assumes Spring Boot and newer Spring libraries exist in your application (as they would in a Grails 3 app). You'd be buying a big chuck of dependency hell.
I'm not sure why you're trying to do this, but I don't recommend it.

Grails 3.0.1 - Folders missing?

I downloaded Grails 2.4.4 and created a test project (using NetBeans) and it was successful.
I downloaded Grails 3.0.1 and created a test project (using NetBeans) NetBeans says project created successfully but it did not load the project in to project explorer.
I compared Groovy folders of 2.4.4 and 3.0.1 and noticed that few folders are missing in the installation.
I confirmed that I downloaded the correct package.
These are the folders/files missing in Grails 3.0.1
folders
conf,
doc,
plugins,
script
files
build.properties,
readme
Grails 3.0 was a complete re-write of Grails and lots of things have changed. Not the least of which is the folder and file structure. Since Grails 3.0 is based on Spring Boot and Gradle a lot of what was very Grails specific has been removed and replaced with both of these.
This blog entry gives a good amount of detail on what has changed in Grails 3.0. It even talks about directory/file structures.

Effective grails plugin development

This has been very upsetting for me up till now. Here is what I am trying to do:
IDE I'm using is Intellij IDEA.
Building a grails application.
Grails application specifies two dependencies on in house grails plugins also being developed in IntelliJ as separate grails plugin projects.
Now to make any changes to plugins, I update the source code in plugin projects and use mavan-install (Maven Publisher plugin) to deploy to local Maven repository.
I have to uninstall the plugin in core grails project. Delete the plugin cache from ivy and then run the core grails project which gets the latest copy of plugin from local maven repository.
What's the effective and ideal way to achieve this? A single change makes me do some 5 minutes of labour work to even test and run core application.
Any recommendations/ best practices?
Use inline plugins for this - see section "Specifying Plugin Locations" in http://grails.org/doc/latest/guide/12.%20Plug-ins.html#12.1%20Creating%20and%20Installing%20Plug-ins
By specifying the plugin project directory with grails.plugin.location.<plugin-name> as the location of the installed plugin, you can edit the real files and the changes will affect the test application, and there's no need to sync anything up.

Is it possible to have a grails app choose between hibernate and mongodb at runtime

I'm trying to build a Grails App. I want the user who installs this grails app on their tomcat instance be able to choose whether they want to use hibernate with an rdbms or mongodb while deploying the app.
Is it possible to have both plugins hibernate and mongodb and pick one based on a config file?
Alternately is it possible to create two builds of the grails app with exactly same code, but different a plugin, so that the user can pick either build?
The second option is your best bet. If both plugins are installed you need to use the mapWith attribute to indicate which to use, and that's a static field in your domain classes.
But if you don't install the Mongo plugin all domain classes will use Hibernate, and if you uninstall the Hibernate plugin and install the Mongo plugin, all domain classes will use Mongo. That would be very easy to script - either run grails war (for Hibernate) or grails uninstall-plugin hibernate, grails install-plugin mongodb, and grails war (for Mongo).

What are the steps to upgrade maven/grails from 1.2.0 to 1.2.1?

I have recently started a new project using the maven grails archetype - at the time, (a few weeks ago), Grails 1.2.0 was the most recent release. Now that there's a newer release, what are the steps to upgrade? I would assume that since Grails dependencies are defined in the POM, that the POM will need to be updated? Are there any instructions on doing this? Does the maven-grails-plugin handle this? Is this documented anywhere?
Appreciate any pointers. Thanks!
According to this thread:
The recommended way of upgrading grails is simply "grails upgrade" in the project dir when you have downloaded the new version of Grails and set up your paths etc...
Note that I've seen at least one person reporting problems with version 1.2.1 (and the Hibernate plugin), see this thread. There is a workaround in the thread but maybe have a look at the Grails Jira first to see if there are any blocking issues with 1.2.1.
There is no "upgrade" target in the maven grails
plugin, so I'm still looking for information on doing this upgrade with maven.

Resources