I’m currently messing around with scripting the setup of Eclipse using ant. The idea is to create a one-button setup of our development environment, replacing an existing Word document which describes how to do so manually.
The setup involves things like unzipping Tomcat servers, unzipping a virgin Eclipse instance, installing plugins on top of Eclipse, etc. All of this is working smoothly now.
Another part of the setup involves configuring things in Eclipse — the things that you would normally do using the Eclipse UI. This involves things like picking a specific JRE, creating a server in Eclipse, creating a workspace, importing some projects into the workspace.
I’ve had some modest successes in initializing the Eclipse preferences by simply writing files into the preference folders of Eclipse. But this is based upon reverse engineering and feels like a fragile approach. Furthermore, I have not yet worked out how to import the existing projects.
Am I overlooking the easy and robust way to achieve this?
I have done similar thing previously and I have found the reverse engineering approach to work well for preferences.
The only way I have found to import existing projects is to write a headless Eclipse plugin that uses
IWorkspace, IProjectDescription and IProject. Check this thread on Eclipse Community Forums for some pointers. You can also find more information about it in the Eclipse help.Then it’s just a matter of executing Eclipse from your script with some parameters like