How to automate the installation of Eclipse plugins with ant task

In this blog post I suggest a simple way to automate the installation of Eclipse plugins with ant task and maven-antrun-plugin.

${project.basedir}/target/eclipse = eclipse dir (extract using maven dependency plugin)
${project.basedir}/target/p2-repo = p2 dir of plugins  (extract using maven dependency plugin)
sample1.feature.group, sample2.feature.group,.... = sample feature group names


a snippet of my code follows.


<plugin>
 <artifactid>maven-antrun-plugin</artifactid>
         <executions>
     <execution>
     <id>install-eclipse</id>
     <phase>package</phase>
     <goals>
      <goal>run</goal>
     </goals>
     <configuration>
     <tasks>
      <java classname="org.eclipse.equinox.launcher.Main" failonerror="true" fork="true" maxmemory="1024m" spawn="false">
      <classpath>
       <fileset dir="${project.basedir}/target/eclipse/plugins" includes="org.eclipse.equinox.launcher*.jar">
      </fileset></classpath>
      <arg value="-nosplash"/>
      <arg value="-application"/>
      <arg value="org.eclipse.equinox.p2.director"/>
      <arg value="-repository"/>
      <arg value="file:${project.basedir}/target/p2-repo"/>
      <arg value="-destination"/>
      <arg value="${project.basedir}/target/eclipse"/>
      <arg value="-installIU"/>
      <arg value="sample1.feature.group"/>
      <arg value="-installIU"/>
      <arg value="sample2.feature.group"/>
      <arg value="-installIU"/>
      <arg value="sample3.feature.group"/>
      <arg value="-installIU"/>
      <arg value="sample4.feature.group"/>
      <arg value="-installIU"/>
      <arg value="sample5.feature.group"/>
     </java>
     </tasks>
    </configuration>
    </execution>
   </executions>
  </plugin>

Comments

Popular posts from this blog

Consuming a RESTful Web Service with C++ using QT libraries

How to develop CXF based JAX-WS with WSO2 Developer Studio

Quick Start Apache Stratos from EC2 images