Android 将特定版本 Github 项目中的插件添加到 Cordova 项目

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25140383/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 09:08:29  来源:igfitidea点击:

Adding plugins from specific revision Github project to the Cordova project

androidgitcordova

提问by M.S.Naidu

I have setup the android project using cordova command-line-interface with the help of node.js. I have added the required plugin from Github to our project by the following command:

我已经在 node.js 的帮助下使用cordova命令行界面设置了android项目。我已经通过以下命令从 Github 添加了所需的插件到我们的项目中:

C:Users/Admin/>cordova plugin add https://github.com/phonegap-build/PushPlugin.git

C:Users/Admin/>cordova 插件添加https://github.com/phonegap-build/PushPlugin.git

For now it is working fine, but what if they suddenly changes the plugin.So I want to stick with the specific revision of plugin. So how can i get the plugin which is specific to particular revision. Shall i add the revision number or commit number to the above url?

现在它工作正常,但是如果他们突然更改插件怎么办。所以我想坚持插件的特定版本。那么我怎样才能获得特定于特定版本的插件。我应该将修订号或提交号添加到上述网址吗?

回答by M.S.Naidu

I got the answer finally, I could get the plugin code upto particular commit:

我终于得到了答案,我可以将插件代码提升到特定的提交:

The following command is what I used to get the latest plugin code:

以下命令是我用来获取最新插件代码的命令:

D:sampleproject/>

cordova plugin add https://github.com/phonegap-build/PushPlugin#2345fd8fe48572eae3df631cf8fb262ef2804779

回答by Dick van den Brink

I don't know a way to stick to a particular revision (other than cloning it first and after the clone add it with a file path) but I know it is possible to install from a specific git tag which might be sufficient in most cases.

我不知道坚持特定修订版的方法(除了先克隆它,然后在克隆后用文件路径添加它)但我知道可以从特定的 git 标签安装,这在大多数情况下可能就足够了.

Command to install from a specific git tag

从特定 git 标签安装的命令

cordova plugin add https://github.com/phonegap-build/PushPlugin.git#1.3.4

cordova plugin add https://github.com/phonegap-build/PushPlugin.git#1.3.4

If you want to install from a tag and a specified sub directory (maybe because plugin.xml isn't a top-level file) you can install it with this command: cordova plugin add https://github.com/phonegap-build/PushPlugin.git#1.3.4:/plugin/sub/dir

如果要从标记和指定的子目录安装(可能是因为 plugin.xml 不是顶级文件),可以使用以下命令进行安装: cordova plugin add https://github.com/phonegap-build/PushPlugin.git#1.3.4:/plugin/sub/dir