Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Equinox/p2/p2.mirrorsURL

< Equinox‎ | p2
Revision as of 18:53, 8 June 2011 by Stephan.cs.tu-berlin.de (Talk | contribs) (New page: ''Disclaimer: this page is not authored by a p2 expert, I merely reproduced some information which I found difficult to collect -- Stephan'' ==Enabling your repository to leverage mirrors...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Disclaimer: this page is not authored by a p2 expert, I merely reproduced some information which I found difficult to collect -- Stephan

Enabling your repository to leverage mirrors

The p2.mirrorsURL should be added to your metadata so that p2 will see the list of available mirrors to choose during installation.

Where to add?

It seems adding this property to artifacts.xml is sufficient. Obviously, artifacts.jar must be updated after that change.

Should composite repos be treated, too, or just their children (leaves)?

What to add?

The property has the following structure:

  <property name="p2.mirrorsURL" 
          value="http://www.eclipse.org/downloads/download.php?file={repository_path}&amp;format=xml&amp;protocol=http"/>
  • replace {repository_path} with the path where your artifacts.jar sits on download.eclipse.org,
    e.g., for http://download.eclipse.org/eclipse/updates/3.6/R-3.6.2-201102101200/artifacts.jar the path would be /eclipse/updates/3.6/R-3.6.2-201102101200
  • yes, &amp; is 5 characters
  • the last part, &amp;protocol=http is optional, it just restricts the list of mirros to those that support http: (which might be faster than ftp:).

This will tell p2 to use the given URL for fetching a list of available mirrors (in xml format).

How to add?

If you use a site.xml the word goes that this is where you should specify this property. The Equinox/p2/Publisher should automatically transfer this information into your metadata.

If you don't use a site.xml you may consider manually editing artifacts.xml (which of course can be automated using, e.g., an xsl template, like this p2.xsl from the Mylyn project). When manually editing artifacts.xml add the property to the existing list of properties right at the top of the document. Don't forget to update the size attribute of the enclosing <properties> element.

How to test?

First, you may paste the full URL you specified as the value into your browser (now collapse &amp; to &). The result should be an XML file with lots of mirror URLs. Pasting one of these URLs into the browser should in turn take you to the directory holding your artifacts.jar and friends.

Secondly, to test whether install successfully uses mirrors you may use the following options file (stored, e.g., as /tmp/p2options):

 org.eclipse.equinox.p2.core/debug=true
 org.eclipse.equinox.p2.core/artifacts/mirrors=true

(The first line generally enables debugging p2, the second line selects specific tracing for mirror selection)

Then you may want to unpack a fresh Eclipse package and change into the eclipse directory.

Finally, use the Equinox/p2/Director application for installing your feature using this command line:

 ./eclipse -consoleLog -noSplash -debug /tmp/p2options -application org.eclipse.equinox.p2.director \
       -repository http://download.eclipse.org/myproject/myrepo \
       -installIU org.eclipse.myproject.myfeature.group

This should install your feature and print to the console where each artifact was downloaded from. If p2.mirrorsURL is not properly configured no such messages will be shown.

Conversely, you can disable the automatic mirror selection mechanism by setting the VM argument eclipse.p2.mirrors to false (remember that vm args have to be last on the command line preceded by the switch -vmargs).

Copyright © Eclipse Foundation, Inc. All Rights Reserved.