Deploying plugins using ANT
Whenever you’re developing DSLs in the form of Eclipse plugins, you’ll have to come up with a means of deploying these plugins to the Eclipse’s of your language’s users. At several times, I’ve used a simple ANT script to do just that:
<?xml version="1.0"?> <project name="DSL deployment" default="deploy"> <target name="check" unless="eclipse.home"> <echo message="Property {eclipse.home} not set (run this ANT script inside the same JRE as Eclipse)." /> </target> <target name="deploy" depends="check" if="eclipse.home"> <echo message="Deploying plugin JARs to Eclipse installation (${eclipse.home})" /> <copy todir="${eclipse.home}/dropins"> <fileset dir="${basedir}/lib/plugins" /> </copy> <echo message="Please restart Eclipse to activate/update the plugins." /> </target> </project>
You simply put all the plugins to be deployed in the lib/ directory of the containing Eclipse project and run the ANT script inside the same JRE as Eclipse, using the settings on the JRE panel of the ANT Run Configuration. The script checks for this and will signal if it’s not ran in the proper way. After deployment, you’ll have to (have) Eclipse restarted to activate the plugins. The plugins are placed in the dropins directory rather than the plugins directory which allows you to easily distinguish them from “regular” plugins.
This setup has the advantage that you can have Eclipse export the plugins to the lib/ directory of the containing Eclipse project, by pointing the Export wizard to that directory on the Destination tab. In case of errors, the logs.zip file gets dumped in lib/ directory as well.
I would rather use the eclipse director to install the plugins for me, that way i would get an error at install time instead of searching why the plugin didn’t register itself or similar. Would also be an small ant script to produce.
best regards
David
Good idea: currently, it’s a bit of a hit and miss to check whether the plugins are actually running correctly.