Does Spock plugin support in grails 3.0.5 - grails

I am new to use this spock plugin.So want to know about spock which version is supported by Grails 3.0.5. Actually using groovy 2.4.4 version.
Please help me out.

Why you want to know spock version? It is bundled in the grails so no need to configure it. Just create new test using some of grails commands like grails create-unit-test or create domain or controller and test for it will be created.
Basic dependencies for spock tests are added when creating new application/plugin (testCompile "org.grails:grails-plugin-testing"). In your case grails will use this spock: org.spockframework:spock-core:1.0-groovy-2.4 but again you don't need to worry about.

Related

Grails 3.1.0.M2 Database Reverse Engineering

Need of help.
I am new to Grails,
My question is How to do db-reverse-engineer.?
I did it in Grails 2.5.1 but I am struggling with Grails 3.1.0.M2 version.
Thanks in advance.
There's no plugin for Grails 3. I started to convert the older one but it's more work than I was expecting because it has to work with Hibernate 4, and the old plugin only works with Hibernate 3.
But the generated files wouldn't be any different in Grails 3 than in Grails 2 since GORM has stayed rather consistent. Since the plugin is only used at build time, and often only once or at most a few times, I recommend that you configure a Grails 2 app with the same database config settings and using the plugin there, then moving the generated files to your Grails 3 app.

Grails 3 and Spring Security Plugin

I've just recently started working with Grails, and I'd like to test out the Spring Security Plugin. I'm using Grails v3.0.0RC2, and I'm finding it difficult to come across accurate documentation for it with a lot of things.
I'm looking at the Grails page for the Spring Security Plugin, located at http://grails.org/plugin/spring-security-core, and it tells me to add the following to grails-app/conf/BuildConfig
plugins {
…
compile ':spring-security-core:2.0-RC4'
…
}
Now, Grails 3 has done away with the BuildConfig, and moved over to using Gradle. So I figured I could just that compile line to my "dependencies" section in build.gradle and it would work, like so:
dependencies{
...
compile:":spring-security-core:2.0-RC4"
}
However, that did not work. I get the error "Could not find :spring-security-core:2.0-RC4...".
Then I figured, 'Hey, it's a plugin, let me try prefacing it with "org.grails.plugins" like I see elsewhere in the build.gradle file:
dependencies{
...
compile:"org.grails.plugins:spring-security-core:2.0-RC4"
}
And still no go.
I have gotten it to compile by adding the dependency found on search.maven.org, like so:
dependencies{
...
compile 'org.springframework.security:spring-security-core:4.0.0.RELEASE'
}
But I don't think thats the proper way to do, because Grails documentation says I should have access to the command
grails s2-quickstart
once the plugin is installed, which I do not when I do it using the Maven repo.
I'm sure there's a simple configuration error I'm making, as I'm very new to both Grails, Spring, and Gradle, so I appreciate any help that can be provided.
The Spring Secuirty core plugin for Grails is not Grails 3 compatible. However, since Grails 3 is based on Spring Boot you can use the Spring Security Starter for Spring Boot instead.
This has been discussed on the Grails developers mailing list and going forward many Grails plugins will not be moved to Grails 3 and instead will be replaced by pure Spring solutions.
Update
Since this question was originally asked there has been a Spring Security plugin created for Grails 3.x. It can be found here: https://bintray.com/grails/plugins/spring-security-core/view
The "Spring Security Starter for Spring Boot" is a good starting point, but if you want to save yourself some time trying to figure out how to get it to work with Grails, check out this helpful blog post.
I wrote the blog post #Jamie referenced in his answer and I added a new blog post describing how to use the Gorm domain classes from Spring-Security-Core plugin from Grails 2.
dependencies {
...
compile 'org.grails.plugins:spring-security-core:3.0.4'
...
}
This is what I used and it worked for me

Grails 3 does not have wrapper?

Does Grails 3.0.x no longer have the ability to create wrappers anymore?
The documentation doesn't seem to have the Grails wrapper section anymore.
Is there an alternative way which we can use the gradle wrapper to execute grails commands such as create-controller?
Does Grails 3.0.x no longer have the ability to create wrappers
anymore?
No.
Is there an alternative way which we can use the gradle wrapper to
execute grails commands such as create-controller?
Not for commands like create-controller, no.
We may re-introduce grailsw. File a feature request at https://github.com/grails/grails-core/issues if you would like to track that.
The Grails wrapper is back as of Grails 3.2.3:
http://docs.grails.org/3.2.x/guide/introduction.html#whatsNewGrailsWrapper
I have an app created with Grails 3.1.x, then upgraded to Grails 3.2.6, but the files such as 'grailsw' did not appear in my project root, and I'm not sure how to get them added via some command in the project.
When I create a new app using Grails 3.2.6, the new files are in the project root (grailsw, grailsw.bat, grails-wrapper.jar). I assume they can be copied over to an app like mine: a quick test of this worked for me.

Grails without gorm

I'm trying to create a grails app that has no database/hibernate/gorm/datasource configuration. In Rails, I can create a new app with the '--skip-active-record' command which will let me create controllers/models/etc without any database concerns.
I'm needing this because my controller just makes a couple rest calls and returns a result so there's no need for the database.
Is this possible? I saw Can I configure Grails with no datasource? but it seems to not work with Grails 2.3. I get this message: "To remove a plugin, delete it from BuildConfig.groovy and/or application.properties."
Is this possible? Thanks
The uninstall-plugin and install-plugin commands were deprecated in 2.2 and removed in 2.3.
To remove a plugin, delete it from BuildConfig.groovy and/or application.properties.
So you can just remove the hibernate plugin entry from BuildConfig.groovy. You probably also need to remove the cache plugin, and you should remove the database-migration plugin since you won't need it.

Grails + Gpars.memoize().. how to do memoization?

I can't seem to figure out how to do memoization in Grails. According to the GPars docs it should be as simple as
def c = { x -> x*2 }.memoize() or ... .gmemoize()
But all i seem to get is compilation errors and stacktraces thrown. Has anyone successfully used gpars with grails?
Grails up until 1.4.0m1 bundled an old version of gpars (0.9) that didn't include memoization. Since Grails preferes the bundled libs to the user-specified ones, you never get a chance to see the memoization methods.
To my best knowledge the Grails master branch has already fixed that and gives users the freedom to choose a GPars version they like.
We are currently successfully using GPars data flow concurrency in a Grails 1.3.7 application. GPars is defined as a basic jar dependency in BuildConfig.groovy, we are not using the GPars Grails plugin.

Resources