How to install grails project - grails

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.

Related

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

Grails Paypal plugin with Netbeans

I downloaded and installed the paypal plugin http://www.grails.org/PayPal+Plugin using netbeans. Though the website mentioned there will be a controller and domain class created. However, I don't see it. Can someone advice if I installed correctly?
The Controller and domain class are located within the plugin itself. Browse the source of the plugin to see them.
The plugin is probably located in a hidden directory under your profile. Not the Netbeans project folder. For instance on grails 2.0 on Linux:
/home/user/.grails/2.0.0.M2/projects/testapp/plugins/paypal-0.6.4.
Each plugin is like a complete project with directory structure.
Your project has use of the plugin when it's installed, and includes it when you build it.

Effective grails plugin development

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.

Is it possible to have a grails app choose between hibernate and mongodb at runtime

I'm trying to build a Grails App. I want the user who installs this grails app on their tomcat instance be able to choose whether they want to use hibernate with an rdbms or mongodb while deploying the app.
Is it possible to have both plugins hibernate and mongodb and pick one based on a config file?
Alternately is it possible to create two builds of the grails app with exactly same code, but different a plugin, so that the user can pick either build?
The second option is your best bet. If both plugins are installed you need to use the mapWith attribute to indicate which to use, and that's a static field in your domain classes.
But if you don't install the Mongo plugin all domain classes will use Hibernate, and if you uninstall the Hibernate plugin and install the Mongo plugin, all domain classes will use Mongo. That would be very easy to script - either run grails war (for Hibernate) or grails uninstall-plugin hibernate, grails install-plugin mongodb, and grails war (for Mongo).

Resources