Friday, April 26, 2013

Recommended scope for grails plugins

Recommended scope for grails plugins


  • build scope: for plugins that are available to the build system only.
  • test scope: for things that should be available to tests but not to application code
  • runtime scope: for plugins (or JAR dependencies) available to the application at runtime but not at compile time.
  • compile scope: available to the application at compile time.
  • provided scope: available at development time but not included in the WAR file.
     
If in doubt, compile will definitely work, as plugins in application.properties are treated as if they were declared in compile scope.

The best way to get the plugin scope, search plugin on http://grails.org/plugin and click on the search result, then find the recommend scope. 

e.g build ":tomcat:7.0.39" http://grails.org/plugin/tomcat
Do not use $grails install-plugin to install plugins, due to it will add a line to application.properties and by default the scope is compile.

The property way to add dependencies/install plugins is:
  1. Go to the Grails plugin page and find the right version for your Grails version.
  2. Copy something like: compile ":build-test-data:2.0.5" to your BuildConfig.groovy

No comments:

Post a Comment