In a previous post, I blogged about mirroring Eclipse repositories with the p2.mirror Ant task; Since this Ant task needs to be run via the Eclipse antRunner application, you need a full installation of Eclipse on the machine that will run the task and I showed how to run this task from the command line.
It might be more comfortable sometimes to run it from Eclipse; for this, you need to create a launch configuration which runs an Eclipse Application, the same you run from the command line: org.eclipse.ant.core.antRunner.
We create a new general project (say, my.eclipse.mirror) and we create a mirror.ant file with the following example content (see the previous post for more details):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
<project name="Create Mirror" default="create-mirror" basedir="."> <target name="create-mirror"> <property name="target.dir" location="${user.home}/eclipsemirror" /> <echo message="" /> <echo message="Mirroring into ${target.dir}..." /> <p2.mirror source="http://download.eclipse.org/releases/juno"> <destination location="${target.dir}/releases/juno" /> <iu id="org.eclipse.rcp.feature.group" /> <iu id="org.eclipse.rcp.source.feature.group" /> <iu id="org.eclipse.equinox.executable.feature.group" /> <iu id="org.eclipse.equinox.p2.user.ui.feature.group" /> </p2.mirror> <p2.mirror source="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository"> <destination location="${target.dir}/tools/orbit/downloads/drops/R20120526062928/repository" /> </p2.mirror> <p2.mirror source="http://download.eclipse.org/tools/buckminster/headless-4.2"> <destination location="${target.dir}/tools/buckminster/headless-4.2" /> </p2.mirror> </target> </project> |
This example will mirror
- org.eclipse.rcp.sdk, the eclipse launcher and the feature for adding update site features to your RCP, from the main Juno release site,
- the whole Orbit repository (that version of the repository)
- the whole Buckminster headless repository
Now we select the “Run Configurations…” dialog
and we create a new Eclipse Application launch configuration, which we call run_mirror; we choose, as the Program to Run, the application org.eclipse.ant.core.antRunner. Note that this application is installed by default in your SDK, but if there is a different target platform active in your workspace, which does not include the org.apache.ant bundle, this launch will fail.
In the Arguments tab, we must specify the -buildfile argument (expected by the runner) passing our ant file mirror.ant; this file is intended to be relative to the Working directory, thus we must modify it by selecting our project relative to the workspace:
Optionally, we save this launch configuration, using the “Common” tab, into our project
By default, the mirror will be saved into the folder eclipsemirror into your home folder; you may want to change this by specifying the additional program argument -Dtarget.dir=<path>, for instance,
Choose Apply and then Run; in your console view you should see that the mirror task has started
You can ignore possible problems of dependencies which cannot be satisfied
Depending on your Network connection it might take some time, but in the end you should see something like
And you can see that the mirror directory will mimic the original repositories structure
This example project can be found at https://github.com/LorenzoBettini/eclipse-mirror-example
Happy mirroring! 🙂
Pingback: Mirror Eclipse repositories with p2.mirror Ant task | Lorenzo Bettini
very informative post, it help me alot i wanted to become a good android developer one day
Many thanks Lorenzo! This post saved the day.
Simone, I suggest you to try Eclipse b3 aggregator to mirror Eclipse repositories: it is much better 🙂
Pingback: Mirror Eclipse repositories with p2.mirror Ant task | Lorenzo Bettini