Create ant build file:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<project name="p2mirror" default="default" xmlns:contrib="antlib:net.sf.antcontrib">
<description>
description
</description>
<target name="setup_windows">
<property name="REPO_HOME" value="C:/java/eclipse_3.5/repo"></property>
</target>
<target name="windows" depends="setup_windows">
<antcall target="STS" />
</target>
<target name="build_aggregate_repo" depends="setup_windows">
<contrib:for param="dir">
<dirset dir="${REPO_HOME}" includes="*">
</dirset>
<sequential>
<echo>@{dir}</echo>
<p2.composite.repository description="Eclipse plugins" >
<repository location="file://${REPO_HOME}/../eclipse_repo" name="Eclipse plugins" compressed="false"/>
<add>
<repository location="file://@{dir}" />
</add>
</p2.composite.repository>
</sequential>
</contrib:for>
</target>
<target name="anyedit">
<echo>anyedit</echo>
<p2.mirror verbose="true">
<repository location="${REPO_HOME}/anyedit" name="anyedit" append="true"/>
<source>
<repository location="http://andrei.gmxhome.de/eclipse/" />
</source>
<iu id="AnyEditTools.feature.group" version="" />
<iu id="EclipseSkins.feature.group" version="" />
<iu id="de.loskutov.BytecodeOutline.feature.feature.group" version="" />
<iu id="JDepend4Eclipse.feature.group" version="" />
<iu id="FileSync.feature.group" version="" />
</p2.mirror>
</target>
<target name="ajdt2">
<echo>ajdt2</echo>
<p2.mirror verbose="true">
<repository location="${REPO_HOME}/adjt2_35/" name="AJDT2_35" append="true" />
<source>
<repository location="http://download.eclipse.org/tools/ajdt/35/update" />
</source>
<iu id="org.eclipse.ajdt" version="" />
<iu id="org.eclipse.ajdt.source" version="" />
<iu id="org.eclipse.ajdt.other" version="" />
<!--
<slicingoptions includeOptional="true" includeNonGreedy="false" followStrict="true" />
-->
</p2.mirror>
</target>
<target name="subclipse16">
<echo>subclipse 1.6</echo>
<p2.mirror verbose="true">
<repository location="${REPO_HOME}/subclipse16/" name="subclipse" append="true" />
<source>
<repository location="http://subclipse.tigris.org/update_1.6.x" />
</source>
<!--
<slicingoptions includeOptional="true" includeNonGreedy="false" followStrict="true" />
-->
</p2.mirror>
</target>
<target name="eclemma">
<p2.mirror verbose="true">
<repository location="${REPO_HOME}/eclemma/" name="ECLEMMA" append="true" />
<source>
<repository location="http://update.eclemma.org/" />
</source>
<iu id="com.mountainminds.eclemma.feature.feature.group" version="" />
</p2.mirror>
</target>
<target name="findbugs">
<echo>findbugs</echo>
<p2.mirror verbose="true">
<repository location="${REPO_HOME}/findbugs" name="findbugs" append="true"/>
<source>
<repository location="http://findbugs.cs.umd.edu/eclipse/" />
</source>
<iu id="edu.umd.cs.findbugs.plugin.eclipse.feature.group" version="" />
</p2.mirror>
</target>
<target name="pmd">
<echo>pmd</echo>
<p2.mirror verbose="true">
<repository location="${REPO_HOME}/pmd" name="pmd" append="true"/>
<source>
<repository location="http://pmd.sf.net/eclipse/site.xml" />
</source>
<iu id="net.sourceforge.pmd.eclipse.feature.group" version="" />
</p2.mirror>
</target>
<target name="m2eclipse">
<echo>m2eclipse</echo>
<p2.mirror verbose="true">
<repository location="${REPO_HOME}/m2eclipse" name="m2eclipse" append="true"/>
<source>
<repository location="http://m2eclipse.sonatype.org/update-dev/" />
</source>
<iu id="Maven Integration" version="" />
<iu id="Maven Optional Components" version="" />
<iu id="Maven Project Configurators" version="" />
</p2.mirror>
</target>
<target name="checkstyle">
<echo>checkstyle</echo>
<p2.mirror verbose="true">
<repository location="${REPO_HOME}/checkstyle" name="checkstyle" append="true"/>
<source>
<repository location="http://eclipse-cs.sf.net/update/" />
</source>
<!--
<iu id="net.sf.eclipsecs.feature.group" version="5.0.0.200906281855-final" />
-->
</p2.mirror>
</target>
<target name="propedit">
<echo>propedit</echo>
<p2.mirror verbose="true">
<repository location="${REPO_HOME}/propedit" name="propedit" append="true"/>
<source>
<repository location="http://propedit.sourceforge.jp/eclipse/updates/" />
</source>
<iu id="jp.gr.java_conf.ussiy.app.propedit.feature.group" version="5.3.3" />
<iu id="jp.gr.java_conf.ussiy.app.propedit.hyperlink.feature.group" version="1.0.2" />
</p2.mirror>
</target>
<target name="moreunit">
<echo>moreunit</echo>
<p2.mirror verbose="true">
<repository location="${REPO_HOME}/moreunit" name="moreunit" append="true"/>
<source>
<repository location="http://moreunit.sourceforge.net/org.moreunit.updatesite/"/>
</source>
<iu id="moreUnit.feature.group" version="" />
</p2.mirror>
</target>
<target name="STS">
<echo>Sprint Tools Suite</echo>
<p2.mirror verbose="true">
<repository location="${REPO_HOME}/STS" name="STS" append="true" />
<source>
<repository location="http://dist.springframework.org/snapshot/IDE/nightly" />
<repository location="http://dist.springsource.com/snapshot/DMS-TOOLS/nightly" />
<repository location="http://dist.springsource.com/snapshot/STS/nightly/e3.4" />
</source>
<iu id="Core / dm Server Tools" version="" />
<iu id="Core / STS" version="" />
<iu id="Core / Spring IDE" version="" />
<iu id="Extensions / Spring IDE" version="" />
<iu id="Integrations / Spring IDE" version="" />
<iu id="Resources / Spring IDE" version="" />
</p2.mirror>
<!-- no need...
<slicingoptions includeOptional="true" includeNonGreedy="false" followStrict="true" />
-->
</target>
</project>
You can use it directly from your eclipse installation - you'll have to run it from eclipse JVM!
All you have to do is run target "windows". If you want to fetch more plugins just add them to the "windows" target.
build_aggregate_repo is left as an example how to build p2 repo that contains multiple features (sort of "corporate p2 repo"). You can extend this build file with your own custom targets.
Also, notice that I used ant contrib lib so you have couple of options:
- install and use your own ant and ant contrib (just replace ANT_HOME in eclipse)
- remove antcontrib and targets that use it (aggregate repo, windows)
IU names are needed only if you don't intend to do the full mirror of the p2 repo.
In case someone would like to find out the names of IU:
- opening Help -> Install New software
- selecting update site as usual
- select desired feature, category of features, or plugin
- click on the More... in the Details group of the dialog
- select General information from the tree in a newly open dialog
- use Identifier as IU name
More information on p2 ant tasks can be found at:
- http://wiki.eclipse.org/Equinox/p2/Ant_Tasks
- http://wiki.eclipse.org/Equinox_p2_Repository_Mirroring
If you don't want to run this from GUI you can create shell script or a .bat file that executes antRunner app from your eclipse:
Code:
/cygdrive/c/java/eclipse_3.5/eclipse351_wtp/eclipse/eclipsec.exe -nosplash --launcher.suppressErrors -application org.eclipse.ant.core.antRunner -buildfile build.xml $@
"$@" represents all of the arguments passed through command line - should be names of the ant targets you want to execute (STS, springide, emma).