Go Down

Topic: External Library Index for Library Manager (Read 174 times) previous topic - next topic


Jul 14, 2017, 06:34 pm Last Edit: Jul 15, 2017, 04:54 pm by xardael

is it possible to set custom library index .json file for the Library Manager? I have found this thread https://forum.arduino.cc/index.php?topic=311851.0 mentioning

e.g. a bit like adding an untrusted source to a unix package manager
This would be very useful, please add this.

I have found this code https://github.com/arduino/Arduino/blob/master/arduino-core/src/cc/arduino/Constants.java#L80

and I played with setting JAVA system property LIBRARY_INDEX_URL to my URL, but it didn't work. How is it possible to achieve this? Where exactly am I supposed to set this system property?

Thanks a lot!


Why do you want to do this?

I know that Adafruit figured out how to hack Boards Manager back before it was changed to allow 3rd party Boards Manager URLs in addition to the official Arduino URL. If you can dig up the instructions for doing that you could probably use the exact same system for redirecting the IDE to your Library Manager index URL. If I remember correctly it had something to do with a proxy.


Jul 15, 2017, 05:12 pm Last Edit: Jul 15, 2017, 05:46 pm by xardael
Thank you very much pert, I want to maintain a custom library repository within my organization. The proxy solution sounds good, I have found the a git repo with the proxy.

Current working solution is that I am hacking ESP8266 board .json and also zip. In a Travis job downloading the latest ESP8266 board zip, extracting it, adding all my libraries from repos with library.properties into libraries folder, packing it to zip, uploading it to http://mydomain/arduino/esp8266.zip, then modifing checksum and size in my http://mydomain/arduino/package_esp8266_index.json which points to http://mydomain/arduino/esp8266.zip.

It works like a charm, but still there is a maintenance when the original ESP8266 zip and json change, and I can include the libraries from file menu only when ESP8266 board is chosen.  So it's not really a solution of choice.

Proxy could do the job, or I am thinking of creating a custom package manager cli utility that will just download and extract libraries into the local Arduino's lib folder directly.

But it would be great if it could work directly in IDE, so I am asking some Java experts here, is the LIBRARY_INDEX_URL used later when the json is actually fetched? How can I set this system variable, can you please point me to the right direction?



It looks like it's a bug. So I did my weekend homework and created a Pull request with the fix.

Another important thing is that you have to set _JAVA_OPTIONS system variable, not JAVA_OPTS as I did before.
If you set _JAVA_OPTIONS="-DLIBRARY_INDEX_URL=http://whatever"
and then run arduino_debug from command line you will see
Picked up _JAVA_OPTIONS: "....."
output and this is what you want.

Temporary fix (until the fix will by included in any version) could be that you will block this URL on the PC or the network where the ArduinoIDE is running. http://downloads.arduino.cc/libraries/library_index.json.gz



Thanks for the pull request and also for explaining the temporary workaround for anyone else who might want to do the same thing!

Go Up