Where are Grails 2.4.2 installed plugin files? - grails

I installed Spring Security Core plugin for my Grails project and it works just fine. The problem is that I can't locate the actual plugin files. I can't find any of my projects inside .grails/2.4.2/projects where according to my understanding Grails is suppose to store all the plugins. The directors exists but there are no projects in this folder.If I want to edit grails.plugin.springsecurity.LoginController where do I go to find this controller? I am on OS X 10.9.3

By default the plugins are in .grails/<version>/<project>/plugins. You can change it by setting grails.project.plugins.dir (setting it to 'plugins' will create a plugins folder in your project source directory) in BuildConfig.groovy.
then copy the LoginController to your own source tree (to the same location) to override and edit the plugin version.

Just in case someone else runs into this.
In 2.4.4 you would put the theme into
/<project>/target/work/plugins/jquery-ui-<version>/web-app/jquery-ui/themes/<themename>/

Related

Grails 2.3.x lib directory with customized plugins

I'm not sure how to ask this question, but I'll try anyway. I found different people having some kind of similar problem. But none with the exact same issue.
I have a grails 2.3.x application, it uses a customized version of a plugin. I'm use to old versions of Grails (pre-Maven dependency resolution), when we were able to include the customized version of the plugin into the /lib folder. I'm doing the same thing, but I am not able to solve anything. :(
Is there a way to tell grails, that lib directory (or some other, into the project folder) have the plugin zip file on it as we were use to?
UPDATE
Just to clarify. I want the packaged plugin into the project directory, not the source code.
UPDATE 2
Try to add the packaged plugin into plugins folder inside project root without any luck. While BuildConfig.groovy have the dependency declared or not.
Not sure if I have understood your question correctly. It seems you want to use a customized version of a plugin in your grails-app. You can do so by creating a "custom-plugins" folder in the root of the application and placing the custom version of the plugin inside this folder. Then in the BuildConfig we can specify the plugin location at the beginning of the file like this:
Assuming I have
myGrailsApp/custom-plugins/custom-plugin-1
grails.plugin.location."custom-plugin-1"="custom-plugins/custom-plugin-1"
That is it.
If you package the plugin as a .zip file and put it in a plugins directory in the root of your application, it will be loaded from there. You might also need to remove the plugin dependency declaration from BuildConfig.groovy before this will work.

Using Grails 2.4.3 in IntelliJ

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

Grails/GGTS 2.4.2 not putting plugins on classpath?

I am trying to update an older 1.3 Grails project to the latest Grails/Groovy/etc. So I downloaded Grails 2.4.2, Groovy 2.3, and Java 1.7.0_65. Then I imported the project via Import->Grails. I found out that plugins are now configured via the BuildConfig.groovy file, so I edited that with the plugins section and ran Grails Tools -> Update Dependencies. None of my plugins appear on the classpath? However, if I startup the plugin manager (which I'm not fully clear on why it is in the product as it states it won't do much after version 2.3...), it does list:
Plug-ins you currently have installed are listed below:
-------------------------------------------------------------
mail 1.0.6 -- Provides Mail support to a
running Grails application
routing 1.2.0 -- Routing capabilities using
Apache Camel
routing-jms 1.2.0 -- JMS integration for the
grails-routing plugin
shiro 1.2.1 -- Apache Shiro Integration for Grails
So SOME part of Grails seems to know about the plugins. Also, if I delete the plugins from my $HOME/.grails/projects/myProject/plugins directory and re-run the Grails Tools -> refresh dependencies, I get both text on the console saying they are being installed and they come back to that directory.
The ONLY thing that seems abnormal, is that during the second set of files compiled (my project files) there ARE compile errors. I expected these (for instances of grailsApplication / etc). To fix them, I wanted to use GGTS - however, there are SO many compile errors in there from the plugins not being on the classpath it is not very feasible.
If anyone has ideas or suggestions for me to try that would be greatly appreciated!
I think it's a problem with GGTS not knowing what your grails work directory is.
You can check you .project file to see if the .link_to_grails_plugins resource is defined correctly.
GGTS may have created the .project like this
<linkedResources>
<link>
<name>.link_to_grails_plugins</name>
<type>2</type>
<locationURI>GRAILS_ROOT/projects/myProject/plugins</locationURI>
</link>
</linkedResources>
GRAILS_ROOT is a variable defined in your GGTS Preferences under General -> Workspace -> Linked Resources
You might have to add the variable if it's not there.
Set the value to the absolute path for $HOME/.grails and then try to refresh your dependencies.

What's the correct way to install a grails plugin from a zip file?

In recent versions of Grails install-plugin command has been deprecated. What is now the recommended way of installing a plugin that is not available via some repository. Assume the plugin is only available locally as zip file, e.g. after running grails package-plugin?
I think the easiest approach is to place the zip file in the project's lib folder and then add an entry in the BuildConfig.groovy. For example:
1. 'grails-image-tools-1.0.5.zip' placed in lib.
2. runtime ":grails-image-tools:1.0.5" added to BuildConfig.groovy
Since the dependency manager looks inside the project's lib folder as well, I don't have to worry about setting any paths etc.
EDIT:
The latest Grails version that I worked on was 2.1.1. I'm unable to check but according to #Saurabh's comment below this isn't applicable for Grails 2.4.3
EDIT2:
But #Jay says that it works with 2.4.5
I don't know if it is the correct way but we get it working:
Download and unzip the plugin in a directory within your project
Change your BuildConfig.groovy file to point to the new plugin
Example: Download webflow.zip plugin and unzip it into a plugins directory within your project. Add this line at end of your BuildConfig file
grails.plugin.location."webflow" = "plugins/webflow"

How can I easily link sources for dependencies in Grails project in IntelliJ IDEA?

Is there any way to get IDEA to automatically download sources for Grails, my plugins and all the dependencies? Alternately, is there an easy way to get IDEA to pickup sources downloaded by this plugin?
http://www.grails.org/plugin/eclipse-scripts
It puts them under ~/.ivy2/...
IDEA should automatically load all plugins for a Grails project, if the Grails/Griffon plugin is being used.
I see all the Grails plugins for a given project in my Grails View, under Plugins.
If you aren't seeing the files, try right-clicking on the project's name in the Grails View, and choosing Grails > Synchronize Grails settings.
Please note that if you are using the free (community) version of IntelliJ IDEA, it does not include the necessary plugins for working with Grails directly. You must pay for the full version to get it.

Resources