Replicating an Eclipse Update Site for Offline Usage

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:

Online Update Site

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 (download.gna.org/eclox/update) and a zip archive of the update site for offline usage (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 to freescale.com/lgfiles/updates/Eclipse/MCU10_6/com.freescale.mcu.updatesite

  • KDS update site:
    http://nxp.com/lgfiles/updates/Eclipse/KDS
  • CodeWarrrior updated site:
    http to nxp.com/lgfiles/updates/Eclipse/MCU10_6/com.freescale.mcu.updatesite
  • Driver Suite update site:
    http to nxp.com/lgfiles/updates/Eclipse/PExDrv10_4/com.freescale.pexdrv.updatesite

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:

  1. The metadata: this is information in an XML file describing the content and dependency of the plugin.
  2. 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:

  1. org.eclipse.equinox.p2.metadata.repository.mirrorApplication to mirror the metadata.
  2. 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

c:\temp\Mirror_Eclox

Then I download first the metadata with

eclipsec.exe -application org.eclipse.equinox.p2.metadata.repository.mirrorApplication -source download.gna.org/eclox/update -destination c:\temp\Mirror_Eclox

This downloads the metadata as content.jar:

Metadata with content.jar

Metadata with content.jar

Next, I’m downloading the artifact(s):

eclipsec.exe -application org.eclipse.equinox.p2.artifact.repository.mirrorApplication -source download.gna.org/eclox/update -destination c:\temp\Mirror_Eclox
command line commands to mirror repository

command line commands to mirror repository

This downloads all the artifact files (java, source files, etc):

Artifacts downloaded

Artifacts downloaded

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 Local Repositor

Installing from Local Repositor

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:

Created Archive File of Local Repository

Created Archive File of Local Repository

Then I can use it as an Archive repository to update from:

Added Archive Repository File

Added Archive Repository File

Summary

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 🙂

13 thoughts on “Replicating an Eclipse Update Site for Offline Usage

  1. Very helpful!

    With KDS_2.0.0 I get “provisioning Exception – Unable to read repository at http://nxp.com/lgfiles/updates/Eclipse/KDS/content.jar.”

    I was able to use this as a work around.
    With my PExDrv v10.4 eclipse install, I created a local mirror.
    (I was not able to create a local mirror from the KDS_2.0.0 eclipse install.)

    From KDS_2.0.0 I was able to install “MQX Task Aware Debugger for GDB” from the local mirror.

    I wonder, is there something wrong with the KDS_2.0.0 eclipse install?

    Thank you!

    Like

    • Hi Jeff,
      I just checked it on my side, and it works as expected. However, I know that if I am on a very slow network, then I encounter such kind of things. And yes, in that case, I typically use an offline installer/download. It might be helpful if you do not install too many plugins at the same time: try to minimize the amount of download and install only one plugin after each other (if this is possible).
      Erich

      Like

        • hmm, yes, that corporate network might slow down things. Although the protocol only uses normal ports, that indeed could have an impact. Glad that you have at least a workaround. Or download the update site locally if you can.

          Like

  2. Pingback: Revert an Eclipse Update Installation | MCU on Eclipse

  3. Pingback: Going to Mars: Building a DIY Eclipse IDE for ARM Embedded Microcontrollers | MCU on Eclipse

  4. Hi,

    Thanks for sharing your experience. I tried exactly that and created a mirror of the Eclipse Luna P2 Repository with two commands like this:

    ./eclipse -nosplash -verbose -application org.eclipse.equinox.p2.metadata.repository.mirrorApplication -source http://download.eclipse.org/releases/luna/201502271000 -destination eclipse-luna-201502271000

    ./eclipse -nosplash -verbose -application org.eclipse.equinox.p2.artifact.repository.mirrorApplication -source http://download.eclipse.org/releases/luna/201502271000 -destination eclipse-luna-201502271000

    But when I used this mirror as a location in my target platform, still remote URLs are being accessed. I suspect that some metadata files inside of the mirror still point into the Internet… Is it possible to create a fully standalone p2 mirror with all necessary dependencies included? Or did I misunderstand something…?

    Regards,
    Dominik

    Like

    • Hi Dominik,
      it worked fine for me for several plugins/repositories, so I would have thought it should work for any repository. But I have not such a large repository. So it could be that this repository still has some other dependencies?

      Like

  5. Pingback: Breathing with Oxygen: DIY ARM Cortex-M C/C++ IDE and Toolchain with Eclipse Oxygen | MCU on Eclipse

  6. Pingback: EmbSysRegView 0.2.6 for NXP Kinetis Design Studio V3.2.0 | MCU on Eclipse

  7. I know it’s an old one but I only came across it recently. What I do is simply use download the repo contents locally and then zip at the relevant folder level to create an offline zip. E.g.:

    wget -e robots=off –recursive –no-parent

    Hope this helps.

    Liked by 1 person

  8. Typo because yet again wordpress loses content that it doesn’t like…

    wget -e robots=off –recursive –no-parent [insert-update-site-url-here]

    Like

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.