Reputation: 123
I have a large number of machines that require Eclipse to be installed on them, and the plugins to be installed/configured/managed for them (a 'standard' set of plugins and configurations have been defined). Is there a way this can be scripted/automated so that as new plugins are added and configurations changed, I can run this script and it will update the machine?
Thanks
Edit: What I did in the end was to grab all the currently approved versions of the plugins and eclipse, and stored them in source control. Then I created a ant script that can install eclipse and put the plugins in the right place. Bit clunky but works for us. Thanks to both the answers, they were helpful :)
Upvotes: 3
Views: 2312
Reputation: 36
You can always write a script that installs/updates/uninstalls a plugin/set of plugins. Here is an example of a script to install and uninstall a group of features. This version only uses standard Windows commands.
set plugins_list_to_uninstall=my.plugin.id1 my.plugin.id2
set uninstalljoinedpluginslist=
for %%i in (!plugins_list_to_uninstall!) do (
set uninstalljoinedpluginslist=%%i.feature.group,!uninstalljoinedpluginslist!
)
set plugins_list_to_install=my.plugin.id3 my.plugin.id4
set installjoinedpluginslist=
for %%i in (!plugins_list_to_install!) do (
set installjoinedpluginslist=%%i.feature.group,!installjoinedpluginslist!
)
:: extract eclipse.p2.profile from config.ini
set profile=SDKProfile
if exist .\configuration\config.ini (
for /f "tokens=1* delims==" %%i in ('find "eclipse.p2.profile" .\configuration\config.ini') do (
set profile=%%j
)
echo Profile is detected as !profile!
)
:: then extract eclipse launcher version
if exist .\plugins\org.eclipse.equinox.launcher_*.jar (
for /f %%a in ('dir /b/a-d .\plugins\org.eclipse.equinox.launcher_*.jar') do (
for /f "tokens=1* delims=_" %%i in ("%%~Na") do (
set launchver=%%j
)
)
echo Eclipse launcher version is !launchver!
) else (
set launchver=0
echo Eclipse launcher is not detected. Is it old eclipse 3.2- ?
goto :filecleanup
)
echo Asking Eclispe to uninstall !uninstalljoinedpluginslist!:
call java -jar ./plugins/org.eclipse.equinox.launcher_!launchver!.jar -application org.eclipse.equinox.p2.director -uninstallIU !uninstalljoinedpluginslist!
:: this should remove files physically for eclipse 3.6+ versions
call java -jar ./plugins/org.eclipse.equinox.launcher_!launchver!.jar -application org.eclipse.equinox.p2.garbagecollector.application -profile !profile!
echo Asking Eclispe to install !installjoinedpluginslist!:
call java -jar ./plugins/org.eclipse.equinox.launcher_!launchver!.jar -application org.eclipse.equinox.p2.director -installIU !installjoinedpluginslist!
See p2.director help for details: http://help.eclipse.org/indigo/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/p2_director.html
Another option would be preparing a compiled eclipse distributive that contains all the plugins installed, as mentioned earlier. However, you can go further and install all the necessary plugins from a network drive on your system. Or (requires little more efforts), your custom update site that you can deploy on any webserver within your network. The trick is to enable automatic updates in the prepared Eclipse instance (Window->Preferences->Install/Update->Automatic Updates->Automatically find new updates and notify me). It works even with network drives, but I would suggest having your custom update site, it's very easy to configure. Network paths have a disadvantage of a fixed file name, you have to put your plugin update with exactly the same name and to the same location.
Upvotes: 2
Reputation: 392
An easy way to do that is to create a custom eclipse bundle with your 'standard' plugin set installed and then to copy the bundle on every machine.
Upvotes: 1