Hybrid UI5 App – Cordova plugin version management in WebIDE
I’ve been working on a Hybrid Mobile App based on Cordova. Therefore I’ve used the WebIDE and the Hybrid App Toolkit for my developments.
During the developments I had the need to use a cordova plugin, “cordova-sqlite-storage”:
I didn’t just need this plugin, I needed a specific version.
On your local pc it’s easy to add a version when you’re adding a plugin to your cordova project. You can use the following command:
cordova plugin add <plugin[@<version>]
I’m using the SAP WebIDE which executes all the commands for you. This makes it all very easy to generate your cordova project with all the required plugins. But it also makes it difficult to manipulate and control the cordova project. This is how I was able to add the version to a cordova plugin from in the SAP Web IDE.
Add a cordova plugin
Go to the “Project Settings”:
“Device Configuration” (Only available if it’s a mobile project) ==> Plugins ==> Custom ==> Add or Remove
Search for your plugin. The first thing I’ve tried was adding the version at this point. But as you can see… Error, not possible.
Because that didn’t work out, I just added the plugin without a version:
Plugin name ==> “+” ==> “OK” ==> You’ll see the plugin in the list of custom Cordova plugins
Add the version to the cordova plugin
For adding the version to the cordova plugin go to the “.project.json” file:
Search for your plugin and add “@” behind the name of the plugin together with the version number:
==> “registry”: “<plugin name>@<version number>”
The next time that you deploy the Hybrid app to the “Hybrid App Toolkit” it will use the version that you’ve defined in the configuration.
Hope it can help you and save some research 🙂