Here is a snippet from my automated eclipse installer written in ant.
This installs all the features from the custom update site. The code is "as is", but of course I would like something like this to guide me when I wrote it.
This script also uses the antcontrib extension for ant. Antcontrib tasks have ac space prefix: '
Hope this helps.
<property name="real.eclipse.home" location="${eclipse.home}/eclipse"/> <property file="${real.eclipse.home}/configuration/config.ini" prefix="ECLIPSE_CONFIG"/> <property name="eclipse-plugins.dir" location="${real.eclipse.home}/plugins"/> <path id="newest.equinox.launcher-library.path.id"> <dirset dir="${eclipse-plugins.dir}"> <include name="org.eclipse.equinox.launcher.*"/> </dirset> </path> <property name="equinox.launcher-library.full-path" refid="newest.equinox.launcher-library.path.id"/> <basename property="equinox.launcher-library.dir" file="${equinox.launcher-library.full-path}"/> <echo message="equinox.launcher-library.dir='${equinox.launcher-library.dir}'"/> <path id="newest.equinox.launcher.path.id"> <fileset dir="${eclipse-plugins.dir}"> <include name="org.eclipse.equinox.launcher_*.jar"/> </fileset> </path> <property name="equinox.launcher.jar" refid="newest.equinox.launcher.path.id"/> <basename property="equinox.launcher.jar.basename" file="${equinox.launcher.jar}"/> <echo message="equinox.launcher.jar='${equinox.launcher.jar}'"/> <java jar="${equinox.launcher.jar}" fork="true" failonerror="true" > <arg value="-consolelog"/> <arg value="-application"/> <arg value="org.eclipse.equinox.p2.director"/> <arg value="-repository"/> <arg value="http://${repository.server}/custom-update-site"/> <arg value="-list"/> <redirector logError="true" outputproperty="features.list" > <outputfilterchain> <linecontains> <contains value="feature.group="/> </linecontains> <replaceregex pattern="(.*feature\.group)=.*$" replace="\1"/> </outputfilterchain> </redirector> </java> <ac:for list="${features.list}" delimiter="${line.separator}" trim="true" param="feature"> <sequential> <ac:if> <isset property="feature.comma.list"/> <then> <ac:var name="feature.comma.list" value="${feature.comma.list},@{feature}"/> </then> <else> <property name="feature.comma.list" value="@{feature}"/> </else> </ac:if> </sequential> </ac:for> <echo message="Found following features to install"/> <echo message="${features.list}"/> <java jar="${equinox.launcher.jar}" fork="true" failonerror="true" > <arg value="-consolelog"/> <arg value="-application"/> <arg value="org.eclipse.equinox.p2.director"/> <arg value="-repository"/> <arg value="http://${repository.server}/custom-update-site"/> <arg value="-destination"/> <arg file="${real.eclipse.home}"/> <arg value="-installIU"/> <arg value="${feature.comma.list}"/> <arg value="-profile"/> <arg value="${ECLIPSE_CONFIG.eclipse.p2.profile}"/> </java>
PS For its utility and complexity, Eclipse P2 is certainly one of the most underrated features.
Alexander Pogrebnyak
source share