When I type generate-all, generate-controller or generate-vies, Grails current version (2.3.2) does not recognizes them. However, these commands remains on the Grails documentation. Does anyone knows if these commands were removed (and the docs are not up-to-date)?
Try grails compile first.
These commands are now part of the scaffolding plugin, and you might need to get grails to fetch the plugin
Related
I am using Grails 3.0.4. The fields plugin documentation states that the scaffolding templates can be installed using the command "grails install-form-fields-templates".
How ever is Grails 3.0.4 there is no install-form-field-templates command which can be used not the Grails console.
Does any one know how to install fields plugin scaffolding templates in Grails 3?
Filed an issue in Grails Fields plugin. Got a response from them that the command to use is Grails install templates. This just installs the scaffolding templates. For more info, pls browse https://github.com/grails3-plugins/fields/issues/14
It's actually grails install-templates. The hyphen is needed.
Unfortunately the command "grails install-templates" does not create the templates to be used by the fields plugin. For example: The template _wrapper.gsp (v.1.5 onwards) or _field.gsp (before v.1.5) which should be found in grails-app/views/_fields/default/_wrapper.gsp is not created. And it is up to the developer to infer how it should be structured.This is a bit inconvenient.
I'm porting an application from Grails 2.4.2 to Grails 3.0.4, and I'm having problems with some plugins that were installed previously. Specifically one that is referenced in a GSP page. The particular plugin is called google-visualizer, and I've found some info here:
https://github.com/bmuschko/grails-google-visualization/blob/master/grails-app/views/formatter/index.gsp
However, I am clueless as to how to install this. I have not found the particular jar file in any maven repo, so I can't add it as a Gradle dependency. In general, where is it documented how to install existing plugins in Grails 3.X? I've read the documentation on how to port existing plugins, but that's not what I'm trying to do. I simply want to tell Grails/Gradle that I'd like to use this particular plugin and have it resolve the dependencies for me. I've tried this syntax as shown here:
https://grails.org/plugins/tag/grails3
Example:
compile ":quartz:1.0.2"
I've put that line in the dependencies block in my build.gradle file, but it doesn't work. I get errors from Gradle. Is there a particular Maven repo that has to be added for plugins? Any help with this is appreciated. Thanks.
Grails 1.x and 2.x plugins are sadly not compatible with Grails 3.x.
You can find the plugins that already have been ported to Grails 3 at: https://bintray.com/grails/plugins/
The grails-google-visualization plugin is not released in a Grails 3 version, but from the repo, it appears that work has started on upgrading.
You can see the progress on a Grails 3 version in this issue: https://github.com/bmuschko/grails-google-visualization/issues/49
Benjamin searched for a new maintainer back some time ago, and found a volunteer - see this tread for details: https://twitter.com/bmuschko/status/498610606896066560
For those plugins that are most important, the Grails Core team maintains a list here: https://github.com/grails/grails-core/wiki/Grails-3-Priority-Upgrade-Plugins
Some of the old plugins will be replaced by their Gradle counterpart, fx. the codenarc plugin, that exist in a Gradle version already.
A simple way is to find out the JAR file for the plugin and then use them in Grails 3.0.4. In this way there is no need to change the source code of the plugin
I've been unable to create/import a Grails 2.4.3 project with IntelliJ 13.1.4. For example, when I create a new module, choose Grails, then click the create button (highlighted below) and choose the location where Grails 2.4.3 is installed, the project is not created correctly (I get a module with just a /src directory instead of a Grails project) and Grails 2.4.3 is not added to the list of Global Libraries. I don't have this problem with any earlier version of Grails.
I have used Grails 2.4.2 with Intellij 13.1.4 successfully. What I did is create the application with the grails create-app command and then do a File / Import Project in Intellij. Give that a try.
As an alternative solution to the IntelliJ 13.1.4 and Grails 2.4.3 bug you can:
grails create app <app-name>
cd app-name
grails integrate-with --intellij
This configured the project correctly for me with just minor tweaks to SDK and application server. This is a minor twist on the work around described above.
See grails doc here
I had the same problem with IntelliJ 13.1.4 and Grails 2.4.3, which i just downloaded.
After using the grails create-app command from the command line i had to import the project, by "create from existing sources" (point to the new top level folder), "Configure SDK" (to set for the Grails 2.4.3) and finally edit the run configuration. In a second test run with a new test project i did not have too configure the run config.
Then the Grails libs for the were downloaded and the basic app ran. Also the Grails specific option in the Intellij "Tools2 section were suddenly available.
So the given answer by Joe is the way to setup a new Grails project but the IDE should be fixed anyways.
It is not consistent. After several tries I can get some applications to work but it does not seem to be automatic. I think I am going to go back to Grails 2.4.2 until this is resolved within Intellij 13.1.4.
In the screenshot above, there are options for groovy/grails/griffon, and so far the alternative offered was command-line. Try choosing groovy option within intelliJ.
We are using IDEA 13.1.4 with grails 1.3.7 and grails 2.2.1(diff projects) and saw the same issue. It appears this is an intelliJ issue and not so much the grails version, so reverting your grails won't gain you anything. Choosing groovy, you should see a prompt for grails directory structure. This does work if you are presented with this option. Seeing inconsistencies here. Thanks to all for posting your workarounds; never hurts to have multiple approaches.
-Duane
I'm pretty new to the Grails Framework and I'm experiencing some strange behavior. If I use the grails commandline tool this way
grails "-DghprbPullTitle=Title with spaces" clean
grails fails with this error message
| Script 'With' not found, did you mean:
1) IntegrateWith
2) Init
3) CreateUnitTest
Starting grails this way will work
grails "-DghprbPullTitle=Title_without_spaces" clean
Ok one can now say "Then just avoid spaces" The problem is, that this occurs while I'm using Jenkins + Grails Plugin + Pull Request Builder Plugin. The Pull Request Builder Plugin generates some of these parameter with whitespaces.
Any thoughts how I can use grails with such whitespace-containing parameter. Or how I can tell the Pull Request Builder Plugin no to generate such parameter.
Maven on the other hand is able to handle such parameter.
Thanks in advance,
Marco
I ended up using shell builder with grailsw call instead of the Grails plugin.
Ok so it was a bug in the grails commandline tool. It will be fixed in grails 2.4-RC1.
See Grails Issue Tracker
The problem is that Grails Plugin + Pull Request Builder Plugin makes it pass build parameters from PR Builder plugin to grails commands. Those arguments with spaces are not required for build to happen, it's some kind of default in Grails Plugin to pass those parameters along to grails commands.
If Grails Wrapper on Grails Plugin didn't work for you, using Shell commands instead of Grails Plugin worked for me: it avoids parameters with space and makes GitHub notifications to work. It's worse for grails installations maintenance, but at least it's an alternative.
I submitted a PR https://github.com/jenkinsci/grails-plugin/pull/12 to work around this by suppressing the -D build environment variables.
I am using the Github pull request builder plugin https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin to run test-app and was running into the same issues as others. I am not using any of the variables that the ghprb plugin passes in so I added an option to suppress -D build environment variables. When this option is checked none of the -D variables are passed to grails allowing the build with grails plugin to run the targets as expected.
If you want to test it out to see if it works for you, you can download it from here http://jmoses.co/data/grails.hpi and install it manually How to install a plugin in Jenkins manually?
I'm having issues getting something which seems very basic running with Grails. I want to call grails commands from an Ant script - Grails provides a Grails task to achieve this. I have defined the Grails taskdef and classpaths as per the docs however, no matter what command I call I get the same error...
grails-compile:
[grails] Resolving dependencies...
[grails] Dependencies resolved in 1192ms.
BUILD FAILED
/java/grailstest/build.xml:22: Unable to start Grails: java.lang.reflect.InvocationTargetException
Even when I create a new Grails app using 'grails create-app' and then run the integrate ant command 'grails integrate-with --ant' to generate a default build.xml, I get the same error when running any of the tasks in the generated build.xml.
I've tested this with Grails 1.3.1, 1.3.4 and 1.3.5 and am getting the same error.
Has anyone else encountered this problem? There must be something stupid I'm doing wrong or this would never have made it out the door of the Grails factory... ;)
I forgot to mention that I am using Ant version 1.8.1. I have just discovered that switching back to Ant 1.7.1 'solves' this problem but this is not really ideal as I need 1.8.1 for other build tasks. I'll submit a bug on the Grails issue tracker as it seems a lot of people are having the same problem.
I've just found the same issue. It seems that Ant 1.8 is not supported yet (but Ant 1.7 is), see GRAILS-6897. Some users have complained that the documentation does not state it strictly.