【问题标题】:Why are there two ways to configure plugins for grails?为什么有两种方法可以为 grails 配置插件?
【发布时间】:2013-11-05 07:05:54
【问题描述】:

我使用的一个 grails 应用程序有两种包含插件的方法:

首先在 application.properties 文件中:

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

在 BuildConfig.groovy 文件中:

运行时“:资源:1.1.6” 编译“:数据库迁移:1.3.6” 编译“:石英:0.4.2” 编译“:导出:1.5” 编译“:字体真棒资源:3.2.1.2”

数据库迁移插件在应用程序资源中是 1.1 版,而在 BuildConfig 中是 1.3.6 版,这似乎令人困惑。

为什么有两种方法可以为 grails 配置插件?

【问题讨论】:

    标签: grails configuration dry grails-plugin grails-2.2


    【解决方案1】:

    是的,有两种安装插件的方法。

    声明依赖的旧方法,使用命令install-plugin。这将适用于application.properties

    在 Grails 2.x 中,首选方式是使用 BuildConfig.groovy,因为这样更灵活,您可以排除 jars/依赖项,定义范围并配置不导出的依赖项。

    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.
      }
    }
    

    使用install-plugin,您的所有依赖项都将在编译范围内。

    更多关于in this discussion

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-10-18
      • 1970-01-01
      相关资源
      最近更新 更多