Effective grails plugin development - grails

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.

Related

Grails project with several inline plugins. How to run tests on the whole app at once?

I have a project with several inline plugin dependencies.
Is it possible to run tests that cover the whole app (including the plugins) from the project?
I am looking for a solution that doesn't involve publishing the plugins to a repository.
The end goal is to be able to get coverage (clover) on the whole app.
Right now I can do that using a gradle script which runs test-app on each inline plugin and afterwards in the project and in the end merges the coverage reports.
The problem with this approach is that one of the plugins is compiled many times, because it is a dependency of some of the other plugins and of the project.
Any ideas on how to improve the situation above?

Why is the Grails-Gradle plugin necessary?

I am building my first Grails app and would like the build to be managed by Gradle. I see that there is a Grails-Gradle plugin and many online searches indicate that it is not possible to build a Grails app using Gradle without this plugin.
My question is: why? Why (specifically) is this plugin necessary in order for Gradle to be able to build a Grails app? What functionality does this plugin provide that is otherwise missing?
I don't know why you think it's impossible to build a Grails app without the plugin. It's possible to issue commands to the grails shell from Gradle without the plugin, but it's not very clean.
That's what this plugin does. It cleans up that process, and makes it much Groovier with a DSL. It also makes your Gradle script more portable to other projects and persons.
If you browse the source code you will see all the inner workings of the plugin and realize what it's setting up in your Gradle script. What it offers is a lot of access to Grails in a very standard and portable manner.

How to install grails project

I've created new grails plugin with this quick start reference.
How could I install it to local and remote repository to make it available for other plugins to depend on.
Thanks.
If you are creating a grails "plugin", you should be referring to this information instead. The one you are referring is for creating a Grails Application.
Gist:
Grails app (one you are referring to) creates a deployable component which can be deploed to any container and accessed. On the other hand, grails plugins are extension/modules that are created and maintained separately. packaged as zip and are plugged to any Grails Application when required.
If you are creating a grails plugin and want to push it to local/remote repositories, you need to use the release plugin which comes inside a plugin by default.
grails maven-install
The command is taken from release plugin to push your plugin to local maven repositories, if you have any.

Grails plugin embeded in application

I'm developing grails application and I also created a plugin and packaged it as zip.
I develop on two computers - one at work, one at home. I'd like to embed this plugin somehow in project (lib folder maybe?), so I could commit it with application to repo and then on another machine during dependecy refresh grails could install this plugin.
Is it possible?

STS / Grails: Workspace dependency resolution

My environment is STS 2.8.0-M2 with Grails 1.3.7. I have a Grails project and a plain Java/Maven project in my workspace.
I am used to M2Eclipse workspace dependency resolution for plain Java/Maven projects and I'd love to see something similar working with Grails. According to the docs it appears like Maven dependencies can only be pulled from a repository or a flat directory but NOT from another plain Java/Maven project in the same workspace. As far as I know, that's a feature coming from M2Eclipse, but enabling this one on the Grails project just causes STS to crash and I assume that it would still conflict with Grails even if I would use the Grails Maven plugin.
Do you guys have any advice or practical experience how to enable workspace dependency resolution with Grails in STS 2.8? I want to avoid having to rebuild a dependent project during development over and over.
Thanks!
For Beta/UAT releases I use artifactory to deploy my jars and grails picks up from the local artifactory with the mavenRepo variable in BuildConfig.groovy pointing to the local artifactory.
eg
mavenRepo "http://maya:8081/artifactory/plugins-release-local/"
Development environment:
1)For plugins I use the line
grails.plugin.location.'plugin-name'="../PluginProject"
2) For normal java project I reference it directly using the build properties of the java project.
BuildConfig.groovy fulfills all my requirements and I never used maven in grails projects

Resources