Question

A grails application I work with has two ways to include plugins:

first in the application.properties file:

plugins.cache-headers=1.0.4
plugins.cached-resources=1.1
plugins.database-migration=1.1
plugins.export=1.5
plugins.font-awesome-resources=3.2.1.2

and in the BuildConfig.groovy file:

runtime ":resources:1.1.6"
compile ":database-migration:1.3.6"
compile ":quartz:0.4.2"
compile ":export:1.5"
compile ":font-awesome-resources:3.2.1.2"

It seems confusing that the database migration plugin is version 1.1 in application resources and 1.3.6 in BuildConfig.

Why are there two ways to configure plugins for grails?

Was it helpful?

Solution

Yes there are two ways of installing plugins.

The old way of declaring dependencies, using the command install-plugin. This will work with application.properties.

In Grails 2.x the preferred way is to use BuildConfig.groovy since this is more flexible, you can exclude jars/dependencies, define the scope and config the dependency to not be exported.

plugins {
  test() //test scoped plugin
  compile("group:name:version") {
    excludes "some-dependency" //install the plugin, but not his dependency
  }
  compile("...") {
    export = false //use this dependency, but not export.
  }
}

With install-plugin, all your dependencies will be compile scoped.

More about in this discussion.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top