如何从源代码安装 Grails 插件? [英] How to install Grails plugin from source code?

查看:23
本文介绍了如何从源代码安装 Grails 插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从朋友那里得到了该插件的源代码,但仍然不知道如何将其安装到我的项目中.是的,有 install-plugin 命令,但是这个插件不允许上传到根 grails 插件目录.

I got a source code of the plugin from a friend, but still don't know how to install it into my project. Yes, there's install-plugin command, but this plugin isn't allowed to upload to the root grails plugin directory.

如何从源代码安装 grails 插件?

How can I install grails plugin from the source code?

更新:该插件是为 Grails 1.1 开发的,但我当前的项目是 Grails 1.3.它会导致任何问题吗?

UPDATE: the plugin is developed for Grails 1.1, but my current project is Grails 1.3. Can it cause any problem?

推荐答案

您可以将插件打包成 zip,然后从中安装.

You can package the plugin into a zip, and install from that.

在包含插件源的根目录中打开命令提示符并运行 grails package-plugin,将 GRAILS_HOME 设置为 1.1 Grails 安装,并在您的 PATH 中设置 $GRAILS_HOME/bin.这将创建一个 zip 文件,例如grails-myplugin-0.1.zip.要安装它,请在包含的应用程序中运行 grails install-plugin/path/to/grails-myplugin-0.1.zip(使用 1.3).

Open a command prompt in the root directory containing the plugin source and run grails package-plugin with GRAILS_HOME set to a 1.1 Grails installation and $GRAILS_HOME/bin in your PATH. This will create a zip file, e.g. grails-myplugin-0.1.zip. To install it, run grails install-plugin /path/to/grails-myplugin-0.1.zip in the containing application (using 1.3).

在 1.3 应用程序中安装 1.1 插件可能不会有任何问题,但如果出现问题,您可能需要升级,或者利用最新版本的 Groovy 和 Grails 的功能.

You will probably not have any issues installing a 1.1 plugin in a 1.3 application, but you might want to upgrade if there are issues, or to take advantage of the features of the more recent versions of Groovy and Grails.

我的升级插件或应用程序的过程与这样的版本有很大差距是不运行 grails upgrade - 这最适合较小的版本增量,例如从 1.3.1 升级到 1.3.5.

My process for upgrading plugins or applications with a large gap in versions like this is to not run grails upgrade - that's best for smaller version deltas, e.g. to upgrade from 1.3.1 to 1.3.5.

相反,我建议在 1.1 中创建一个新的空插件.手动或使用目录差异工具,通过将当前插件与空插件进行比较,找到插件中所有已删除、添加和修改的文件.然后使用 Grails 1.3.x 创建一个新的空插件.移动新文件,删除删除的文件,并在编辑过的文件中进行相应的更改.

Instead what I suggest is to create a new empty plugin in 1.1. Either manually or using a directory-diff tool, find all of the deleted, added, and modified files in the plugin by diffing the current plugin with the empty one. Then create a new empty plugin using Grails 1.3.x. Move over the new files, delete the deleted files, and make the corresponding changes in the edited files.

编辑过的文件大部分都在 grails-app/conf 下,所以你需要在那里小心一点,因为有些东西已经改变了.但总的来说,应用大部分或全部更改应该是安全的.

The edited files will mostly be under grails-app/conf, so you need to be a little careful there since some things have changed. But in general it should be safe to apply most or all of the changes.

这篇关于如何从源代码安装 Grails 插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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