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

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

问题描述

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



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

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

解决方案

您可以将插件打包成zip文件,并从中进行安装。 b
$ b

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



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



我的升级插件或者应用程序的过程在这个版本中有很大的差距,所以不要运行 grails upgrade - 对于较小的版本增量最适合,例如从1.3.1升级到1.3.5。



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



编辑后的文件大部分都在grails-app / conf下,所以你需要小心谨慎,因为有些事情已经改变了。但总的来说,应用大部分或全部更改应该是安全的。


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.

How can I install grails plugin from the source code?

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

解决方案

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

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

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.

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.

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.

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天全站免登陆