简体   繁体   English

Cordova 3.5.0 如何使用 CLI 添加自定义插件?

[英]Cordova 3.5.0 how to add Custom plugin Using CLI?

我正在使用 cordova3.5.0,我想使用 CLI 将我的自定义插件添加到我的项目中。我不知道将自己的插件添加到我的项目的过程是什么。虽然我可以添加他们的原生插件,但只需键入 cordova add plugin org .apache.cordova.camera。

You can just type cordova plugin add你可以输入cordova plugin add

Just point it to an directory with a valid plugin.xml.只需将其指向具有有效 plugin.xml 的目录即可。 See documentation for the plugin.xml here: http://docs.phonegap.com/en/3.5.0/guide_hybrid_plugins_index.md.html#Plugin%20Development%20Guide在此处查看 plugin.xml 的文档: http : //docs.phonegap.com/en/3.5.0/guide_hybrid_plugins_index.md.html#Plugin%20Development%20Guide

Cordova help says the following: plugin add [ ...] .......... SPEC can be a plugin ID, a local path, or a git URL. Cordova 帮助说明如下: plugin add [ ...] .......... SPEC 可以是插件 ID、本地路径或 git URL。

经过大量的研发,我发现只有解决方案,我们只能手动添加自定义插件而不使用 CLI。

To install custom plugin through CLI use below command要通过CLI安装自定义插件,请使用以下命令

cordova plugin add (Add your plugin path here)

Eg.例如。

cordova plugin add C:\Users\project\custom_camera_plugin

try using GIT Url.尝试使用 GIT Url。 example : $ cordova plugin add https://github.com/apache/cordova-plugin-console.git示例:$cordova 插件添加https://github.com/apache/cordova-plugin-console.git

You should use plugman to manage custom plugins.您应该使用plugman来管理自定义插件。

To install:安装:

$ plugman install --platform <ios|android|blackberry10|wp8> --project <directory> --plugin <name|url|path> [--plugins_dir <directory>] [--www <directory>] [--variable <name>=<value> [--variable <name>=<value> ...]]

you can find good documentation in this link您可以在此链接中找到好的文档

https://taco.visualstudio.com/en-us/docs/createplugintutorial/ https://taco.visualstudio.com/en-us/docs/createplugintutorial/

however after making your own plugin you can edit your java and javascript file and publish it to npm again by updating version in npm using npm version patch and npm publish .但是,在制作您自己的插件之后,您可以编辑您的 java 和 javascript 文件,并通过使用 npm version patch 和 npm publish 更新 npm 中的版本再次将其发布到 npm。

and hence by this you can use it因此,您可以使用它

however if you want to make it without publishing it on npm then i also dont know that if you find then please tell?但是,如果您想在不将其发布到 npm 上的情况下制作它,那么我也不知道如果您找到了,请告诉? (Respond back in case of any questions) (有任何问题随时回复)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM