intellij can't resolve grails.plugin - grails

I am using Grails 2.3.3 and IntelliJ ultimate 12.1.6 on my Vista 32 machine.
I used grails command line to create a new app and then added spring security and spring security ui. My BuildConfig.groovy plugins section contains
compile ":spring-security-core:2.0-RC2"
compile ":spring-security-ui:1.0-RC1"
I ran
grails s2-quickstart
grails s2ui-override auth
grails s2ui-override register
My generated RegisterController looks like this:
class RegisterController extends grails.plugin.springsecurity.ui.RegisterController {
}
the grails.plugin is red and unresolved and no matter what I try I can't get IntelliJ to resolve grails.plugin
Grails compiles and runs the app without issue, and if I override methods I find in the source code for the spring ui RegisterController they are correctly wired in to the app, but I can't even compile from intell and I can't get intellij to help me override code.
I thought maybe creating the project outside of IntelliJ was an issue so I created a new Grails project using the IntelliJ interface, the plugins still do not resolve.
I tried adding the plugins as runtime with no success.
I have spent the afternoon and evening researching this with no success. There are questions similar to this with major versions 10 and 11 of IntelliJ but nothing current, so I am resolved to asking for help to get IntelliJ to recognize the Grails plugin classes. I can post an entire small sample project if necessary.
Thanks.
Dave

I often have this issue when I place a new plugin into my BuildConfig.groovy, but not typically when I add a jar dependency.
I resolve it by doing the following in the menu: Tools > Grails > Synchronize Grails Settings
You can tell whether or not a plugin is synchronized in IDEA by navigating in the Project view to grails-app > target > work > plugins. Each synchronized plugin with have a tiny blue square over the bottom right corner of the directory icon. If it doesn't have that icon, it isn't synchronized with IDEA properly.

Using IntelliJ 13.1.5 and Grails 2.4.3 with Maven there is an issue with 2 different groovy-all jars being pulled in by the IDE.
The way to resolve it is to go to Module Settings and under both the project and projectGrialsPlugins modules modify the User Grails library entry. Click the edit button(pencil) and remove the groovy-all.2.3.3.jar from the project.
Remember if you close the project and reopen it those settings may need to be reapplied.

Related

Is Netbeans 14 still not supporting Grails project?

Netbeans 8 works quite well with Grails. I can click New Project to create a new Grails project. Netbeans 8 can show the project with Domain, Controller, Views folders on the left nicely. I can even debug the project with breakpoint. Netbeans 8 only works well with Grails 2. But at lease it can show the project folder structures nicely with newer versions of Grails like 4 and 5.
Netbeans 14 is missing all of these with/without the default Groovy plugin. It can't even open a simple Helloworld Grails project I create using the grails create-app helloworld command.
I googled Netbeans and Grails but the posts were quite outdated from many years ago. They said to use the Netbeans 8 Groovy plugin.
Is there any updated way to setup Netbeans 14 to work with Grails?
I attached 2 pictures. One is how it looks with 14. The other is how it looks with 8.
Unfortunately, I think the answer to your question is that Netbeans 14 does not support Grails. It's tough to prove a negative, but there is very strong circumstantial evidence of that being the case:
If you go to the homepage for Apache NetBeans there is a Plugins menu entry,and clicking that yields a list of the 62 available plugins. If you search that list list for "Grails" nothing is returned, so there is no "official" plugin for Grails.
Within NetBeans 14, if you select Tools > Plugins and search the Installed and Available Plugins tabs for "Grails", nothing is returned.
If you review the "What's Changed" entries for NetBeans 14 there is no mention of Grails.
Note this comment from GeertJan Wielenga, Release Manager for Apache NetBeans in 2019 (emphasis mine): "I would recommend to keep the name at Groovy, because otherwise when we re-add support for Grails, we’ll need to call it ‘Groovy, Gradle, and Grails’. And anyway both Gradle and Grails derive from Groovy, so keeping the name Groovy makes sense."
Notes:
For some releases since NetBeans 8.2 it has been possible to add Grails support using the old 8.2 plugin (e.g. this answer), but the approaches were brittle, and did not offer any functionality beyond that available in NetBeans 8.2. I suppose you could try a similar workaround to get Grails running on NetBeans 14, as described in SO answers for other NetBeans releases, but stability might be an issue.
For what it's worth, Intellij IDEA provides a Grails plugin, though I haven't tried it.
Finally, Grails not working in NetBeans 14 should not be viewed as a NetBeans issue. Instead, it's a third-party plugin issue, and as far as I know there has been no development on the 8.2 plugin you are currently using for years. (That said, it would be helpful if the NetBeans documentation for each release formally stated any new functionality, and any functionality that was no longer supported, or no longer worked.)

What is currently a good way to develop a Vaadin 8 project with Eclipse?

Yesterday I tried to create a Vaadin project as described under https://vaadin.com/framework/get-started
I did it that way because the current eclipse plugin doesn't support greating Vaadin 8 projects.
Then I imported the project using Eclipse Import->Existing Maven Projects.
THis worked almost fine - only when starting the project using "Debug on Server" the Browser cannot connect to the application, although the application seems to be loaded.
When using mvn clean install and deploying the war manually this works.
What is missing there? Is there currently a good way of using Vaadin 8 with Eclipse?
Apparently this is more of an eclipse configuration question.
The context root can be changed using the projects Properties->Web Project Settings.
I would already use Vaadin together with spring-boot. On spring site they do have also a nice initializer tool to create your project: https://start.spring.io/ (Vaadin 8 is already used)
Also very helpful: http://vaadin.github.io/spring-tutorial/
The big advantage of using spring for me is the dependency injection, which simplifies the project setup.

Referencing other grails projects

I am trying to use domain classes of one grails project in other grails projects. I am using GGTS as IDE.
I imported grails project containing domain classes and added it to the build path of my second project.
When I try to reference any of domain classes in second project I get no errors in GGTS but when I run app i get:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
unable to resolve class domainClass
A better solution is to create a Grails plugin, add the domain classses to the plugin (and anything else that should be shared by the 2 applications), and install the plugin in the 2 applications.
that is definite that you should create the other project as plugin.
Please , consult this documentation and let me know any thing ,if u want help.

Creating Grails shared libraries

I'm working on a multi-module project right now, where most of the modules are designed to have their own Web interface (REST API, Web pages, etc.) done using Grails. There are a few classes that I want to be utilized by different (all) modules. If this were a straightforward Java project, I would just create a new Maven project (using archetype:generate), deploy/install, and just import it on the modules accordingly. How do I do this with Grails? Is this one of the things Grails plugins are meant to address?
Since you are talking about a jar/lib artifact it would be best to use a local Maven repository where you build your maven project to then resolve it as a dependency for your modules within your BuildConfig.groovy.
Nothing is stopping you from using a Grails plugin to provide this resource, but that seems a bit overkill since Grails plugins are intended to do so much more.
It looks to me that you want to have a multi-project build or a Mavenized Grails project or separate plugins.
Use a Grails multi-project-build
Guide: http://grails.org/doc/2.1.0/ref/Command%20Line/create-multi-project-build.html
Straight Maven integration
Guide : http://grails.org/doc/latest/guide/commandLine.html#antAndMaven
I have a basic introduction video here: https://www.youtube.com/watch?v=tqGN61hiciE
Separate Grails plugins
You could still use separate Grails plugins and reference them in your main application.

intellij 11.1.4 ultimate grails setup

I have intellij 11.1.4 ultimate and I'm trying to create a Grails project. I can't select a Grails SDK when creating a project. I have looked around and can't find a clear solution on how to set this up step by step.
Can anyone help?
download Grails version you want to use
extract it somewhere on disk
start IntelliJ IDEA
File / Settings / Plugins, check if Grails plugin is installed
File / New Project / Create project from scratch , click Next
fill out the form and make sure to select Select type: Grails Module, click Next
select Grails version in Use library
if there is no library in combobox
click on button Create...
select folder where you extracted Grails SDK (point 1 and 2)
click Finish
If this will not help you, there is JetBrains is having superior support, I always got answer to my questions.

Resources