将就地插件添加到 grails 3 项目 [英] Adding in-place plugin to grails 3 project

查看:15
本文介绍了将就地插件添加到 grails 3 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 grails 2.x 中,我们可以通过在 BuildConfig.groovy 中添加以下内容来添加就地插件

In grails 2.x, we were allowed to add an in place plugin by adding following in BuildConfig.groovy

grails.plugin.location."my-plugin" = "../my-plugin"

grails.plugin.location."my-plugin" = "../my-plugin"

我的问题是,我们是否可以在 grails3.0 中同样就地添加我们的本地插件,或者在 grails 中还有其他一些方法可以做到这一点.

My question is, can we add our local plugins similarly in-place in grails3.0 as well or there is some other way to do this in grails.

实际目的是在将插件推送到 bintray 之前测试它是否正常工作.

Actual purpose is to test the plugin whether it's working properly or not before pushing it to bintray.

推荐答案

是的,有.Grails 3 基于 Gradle,因此多项目 gradle 构建可以解决您的问题.

Yes, there is. Grails 3 is based on Gradle so multi-project gradle builds solve your issue.

基本上你添加依赖为:编译项目(':../my-custom-plugin')并且必须修改 settings.gradle 以包含插件:包含'../my-custom-plugin'

Basically you add dependency as: compile project(':../my-custom-plugin') and has to modify settings.gradle to include plugin: include '../my-custom-plugin'

插件和多项目构建 的 Grails 文档"noreferrer">http://grails.github.io/grails-doc/latest/guide/plugins.html

Check Grails documentation on Plugins and Multi-Project Builds in http://grails.github.io/grails-doc/latest/guide/plugins.html

其他方法是使用 gradle publishToMavenLocal 命令在本地 Maven 存储库中安装插件,并在发布到 Bintray 或其他依赖项存储库之前从那里解决.

Other way is to install plugin in local maven repository using gradle publishToMavenLocal command and resolve if from there, before publishing to Bintray or other dependency repository.

此外,从 Grails 3.1.1 开始,内联"插件现在支持重新加载.检查 https://github.com/grails/grails-core/releases/tag/v3.1.1http://grails.io/post/138665751278/grails-3-gradle-multi-project-builds

Additionally since Grails 3.1.1, reloading is now supported for 'inline' plugins. Check https://github.com/grails/grails-core/releases/tag/v3.1.1 and http://grails.io/post/138665751278/grails-3-gradle-multi-project-builds

它是使用 grails { plugins { 语法完成的.从文档复制:

It is done using grails { plugins { syntax. Copied from docs:

grails {
    plugins {
        compile ":hibernate"
        compile project(':myplugin')
    }
}

这篇关于将就地插件添加到 grails 3 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆