Local p2 mirrors to work offline

Working with Tycho without an internet connection?
=> Make a local mirror of the p2 repositories.

I was asked to create a maven tycho build for an existing scout application in a company where it was difficult to reach the eclipse repositories. Do not ask me why, I guess this has something to do with proxy, firewalls and so on…

This was really frustrating because I could see the plugins in my target editor, but during the maven build there was a lot of warnings that maven will contact another mirror and finally I got some timeout errors.

Fortunately there is a way to mirror a P2 repository on a local disk. Everything is explained on the eclipse wiki: Equinox_p2_Repository_Mirroring

I organized my file structure like this:


  • /eclipse_updates_38
  • /orbit_r
  • /scout_releases_39

According to the wiki page, I had to run the following commands for each repository:

To download the metadata:
eclipsec.exe -nosplash -verbose -application org.eclipse.equinox.p2.metadata.repository.mirrorApplication -source download.eclipse.org/scout/releases/3.9 -destination file://C:/p2mirrors/scout_releases_39

To download the artifacts:
eclipsec.exe -nosplash -verbose -application org.eclipse.equinox.p2.artifact.repository.mirrorApplication -source download.eclipse.org/scout/releases/3.9 -destination file://C:/p2mirrors/scout_releases_39

A few hours later… I was able to change my target fileto force Tycho consume the bundles from my local copy.

In the target platform file (I used a text editor, I am not sure if this manipulation is possible in the target file editor) just change the location attribute from the repository tag.

For example:
<repository location="http://download.eclipse.org/scout/releases/3.9"/>

<repository location="file:///C:/p2mirrors/scout_releases_39"/>

Be aware that the type of the location stays “Software Site” (in the XML: type="InstallableUnit"), because type="Directory" is not supported by Tycho (see the wiki page Tycho/Target_Platform).

In the target editor I was able to see the URI pointing to my local folders.

Now I have a build that works offline!

Scout Links
Project Home, Forum, Wiki, Twitter