问题描述
我为两个grails应用程序共享的域对象创建了一个专用插件。我能够在我的本地环境中成功使用插件,因为我已经通过BuildConfig文件设置了它的路径。例如,我有以下目录:
appOne /
myPlugin / grails-my-plugin-0.1.zip (myPlugin是一个Grails插件项目目录)
在: appOne / grails-app / conf /BuildConfig.groovy:
grails.plugin.location.compileMyPlugin =../myPlugin
我的问题是,使用我的应用程序版本处理打包这个插件的正确/最佳方式是什么,所以我可以将其部署到云服务中,无法下载?我想有一种方法可以让Grails为你做这件事,但我不确定。 (我对grails非常陌生)
我最终在Grails 2.1.0中做了以下工作来解决这个问题: / p>
在Grails插件项目中:
grails package-plugin
生成grails-myplugin-0.1.zip文件
$ b 2)将插件复制到我的应用程序的lib目录(appOne / lib / grails-myplugin-0.1 .zip)
$ b 在BuildConfig.groovy中
-
删除: grails.plugin.location.compilemyPlugin =../myPlugin
这在开发过程中用于防止重建 - 重新安装过程
更新插件中包含的文件。 plugins {
.....
compile':grails-myPlugin:0.1'
}
4)通过清理appOne进行测试并重新运行,这将通过lib目录安装/重新安装插件。
5)提交所有更改并将插件zip文件添加到appOne并推送。在这种情况下,云提供程序
Heroku可以解析依赖关系。
I've created a private plugin for domain objects that are shared between two grails applications. I'm able to use the plugin successfully in my local environment as I've set the path to it via the BuildConfig file. For example, I have the following directories:
appOne/
myPlugin/grails-my-plugin-0.1.zip (myPlugin is a grails plugin project dir)
In: appOne/grails-app/conf/BuildConfig.groovy:
grails.plugin.location.compileMyPlugin = "../myPlugin"
My question is, what is the proper/best way to handle "packaging" this plugin with my app release so I can deploy it to a cloud service where it won't be available for download? I imagine there is a way to have grails do this for you but I'm unsure. (I'm very new to grails)
I ended up doing the following to resolve this in Grails 2.1.0:
1) In the Grails Plugin Project:grails package-plugin
Produces the grails-myplugin-0.1.zip file
2) Copy plugin to my application's lib directory (appOne/lib/grails-myplugin-0.1.zip)
3) In BuildConfig.groovy
Remove: grails.plugin.location.compilemyPlugin = "../myPlugin"
This was/is used during development to prevent the rebuild-reinstall process
when updating files included in the plugin.Add:
plugins {
.....
compile ':grails-myPlugin:0.1'
}
4) Test by cleaning appOne and re-run which will install/re-install the plugin via the lib directory
5) Commit all changes and add the plugin zip file to appOne and push. The cloud provider,
Heroku in this case, can then resolve the dependency.
这篇关于如何将私有插件的grails应用程序部署到云中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!