In my post “Constructing a Classroom IDE with Eclipse for ARM” I outlined how to build a DIY Eclipse distribution. That way I can build an archive/zip and distribute to my students: it saves them a lot of time, and they do not need to download things from the internet themselves, as I can give them the thing on a memory stick. But what if I want them to give them the update site files for offline usage too? For example CodeWarrior has an online update site:
How can I make a local copy of it to use in my classroom?
Most Eclipse plugin providers offer an online update site, or an archive/zip file to download for offline usage. A good example for this is Eclox which provides both an update site (http://download.gna.org/eclox/update) and a zip archive of the update site for offline usage (http://download.gna.org/eclox/packages/eclox.update_0.8.0.zip). But not for all plugins. For example the Freescale CodeWarrior MCU10.6 Eclipse updates are available only online from a Freescale online update site, but are usually not available as separate downloads.
💡 The CodeWarrior for MCU update URL is this one (replace the version number if you use a different or earlier version): http://freescale.com/lgfiles/updates/Eclipse/MCU10_6/com.freescale.mcu.updatesite
- KDS update site:
- CodeWarrrior updated site:
- Driver Suite update site:
Eclipse P2 Mirroring
The solution is to mirror an online update site to a local folder and then distribute that folder for offline usage. This has the advantage that with this I can make a local copy of that update site and archive it. So if this site goes out of business or is not available any more, I still can update from the local mirror later on as needed.
Eclipse features a command line interface to make a mirror of an online update site, described in http://wiki.eclipse.org/Equinox_p2_Repository_Mirroring.
There are two main things in an update site:
- The metadata: this is information in an XML file describing the content and dependency of the plugin.
- The artifact: this is the plugin itself, with all the necessary files.
Both things I can downloading using the command line version of Eclipse, using the -application command line switch. With this argument I can run a plugin, and there are two different ones in this context:
- org.eclipse.equinox.p2.metadata.repository.mirrorApplication to mirror the metadata.
- org.eclipse.equinox.p2.artifact.repository.mirrorApplication to mirror the artifact.
With the -source argument I give the URL to the online repository, and with -destination I specify the path to the local folder. For more details about the options possible see http://wiki.eclipse.org/Equinox_p2_Repository_Mirroring.
On Windows I use the command line version of eclipse (eclipsec.exe), while on Linux I can use eclipse.
Example Mirror of Update Site
I’m going to show this with the Eclox plugin under Windows. First, I create a folder where I want to download the files. In my case I create a folder
Then I download first the metadata with
eclipsec.exe -application org.eclipse.equinox.p2.metadata.repository.mirrorApplication -source http://download.gna.org/eclox/update -destination c:\temp\Mirror_Eclox
This downloads the metadata as content.jar:
Next, I’m downloading the artifact(s):
eclipsec.exe -application org.eclipse.equinox.p2.artifact.repository.mirrorApplication -source http://download.gna.org/eclox/update -destination c:\temp\Mirror_Eclox
This downloads all the artifact files (java, source files, etc):
Depending on the size of the repository, this might take a while.
Installing as Local Repository
After I have the metadata and artifacts downloaded, I can specify this with a ‘local update site’ in Eclipse: Use the menu Help > Install new software and with the Add… button I specify a Local repository with the path where I have downloaded the files:
Installing from an Archive
While with a local repository things are working fine, it has one disadvantage: there might be a lot of files, and passing/copy/distributing thousands of files is simply not scalable. Instead, I can create a (compressed) zip archive. For this, I create a zip file of the local repository with the plugins/features folders on top:
Then I can use it as an Archive repository to update from:
It is possible with Eclipse to download an online repository and then use or distribute it locally, so I do not an internet connection for installation. This is very useful for classroom installation, locations with limited internet bandwidth, or to make a backup of the updates installed.
Happy Replicating 🙂