0

I have a Grails Project with name AProject and a Grails Plugin with name MyPlugin.

I integrate my MyPlugin into AProject, by adding to BuildConfig.groovy as:

plugins {
   ...
  compile ":elasticsearch:0.50" 
}

grails.plugin.location.'elasticsearch' = "../elasticsearch"

On my local computer I then do in the MyPlugin folder

grails maven-install

and in the AProject folder:

grails clean
grails refresh-dependencies
grails run-app

This is working fine on my local computer, but not on my server.

How can I integrate a Grails plugin project on my server?

  • 2
    Unless I misunderstood your question, on the webserver you will deploy your war file generated by `grails war` and that should include all the dependencies the application needs. – Alidad Aug 13 '13 at 21:03
  • Rephrase the question heading, it is bit confusing. Do you want your plugin to be deployed as a grails app? It cannot be edited more fearing modifications would change the main objective of the question. – dmahapatro Aug 13 '13 at 21:04
  • I want to compile my app on my webserver grails prod war and want to include a grails plugin project that way how to do that? –  Aug 13 '13 at 21:08

1 Answers1

1
  • grails maven-install //in plugin project if you have .m2 <local maven repo>
  • compile ':my-plugin:0.1' //in Grails app BuildConfig plugin section
  • grails war //in grails app
  • Deploy the war wherever you want.

If this is what you want then you would need nothing else.

Grails will package all compiled files into the war file. The Grails app would pull the plugin artifact from the maven repo (in this case your local maven repo) while building the war file.

If you are building the war on the same machine that you did maven install for the plugin your grails app will find it and you should be good.

dmahapatro
  • 49,365
  • 7
  • 88
  • 117
  • I do not have a local maven repo how can I do it with a jar file? –  Aug 13 '13 at 21:48
  • @stephan1001 Plugins are always packaged as `zip`. Refer excerpts from [release plugin](http://grails-plugins.github.io/grails-release/docs/manual/guide/maven.html#mavenCache) about maven integration which is available to all newly created plugins by default. – dmahapatro Aug 13 '13 at 23:05
  • I do not have a local maven repo. How should I do it in this case? –  Aug 14 '13 at 12:58
  • Download Maven. You just need to have `M2_HOME` set in classpath. I guess. Or I am not sure whether the release plugin create the repo for you when you run grails maven-install. Just run the above mentioned steps without installing Maven, otherwise follow as mentioned in this comment. @stephan1001 – dmahapatro Aug 14 '13 at 13:37
  • I am new with that sorry for the questions where is M2_HOME path set –  Aug 14 '13 at 13:42
  • @stephan1001 `M2_HOME` is set to the classpath with Maven home directory. Something like `M2_HOME=path/to/your/maven/home`. – dmahapatro Aug 14 '13 at 14:09
  • and what is the default maven path? –  Aug 14 '13 at 16:14
  • when I do grails maven-install I alway get "Script 'MavenInstall' not found, did you mean:" what should I do? –  Aug 14 '13 at 22:39
  • Before doing maven install, compile (grails compile) your plugin project once you have installed the release plugin. – dmahapatro Aug 15 '13 at 00:10
  • @stephan1001 Was the answer helpful? – dmahapatro Aug 22 '13 at 04:05