Easily create your own Eclipse

Eclipse contains hundreds of preferences to set.
It takes years to know perfectly what option exists, which value is the best and where is this option.

When you work with multiple workspaces it become almost impossible to have all your preferences set in all of them.
If you use one workspace but work with other colleagues, everyone has different settings.

What if, you could build your own zip of Eclipse with your plugins, your JDKs, all your preferences applied automatically in a new workspace ?

In fact, you can do it quite easily. we will describe all the steps in this article.


Download Eclipse

Eclipse comes different packages. Choose yours accordingly to your use and unzip it as usual.

Install your plugins

Eclipse has a lot a plugins but we often install a subset of them depending on our needs. By example, if your company only use Git, you don't need a SVN plugin. You can read my previous post about the plugins I recommand.


At this point, you can already zip your eclipse directory and share it with your coworkers to have an Eclipse installation with your plugins. No rocket science here, so let's get a little further.

Install Google Workspace Mechanic

Google have created a plugin dedicated to preferences sharing. I found Google Workspace Mechanic (GWM) not so easy to learn, so here are the basics.

The update site is :
http://workspacemechanic.eclipselabs.org.codespot.com/git.update/mechanic

Every preference in Eclipse is saved in a file in the .metadata/.plugins directory in your workspace. GWM is able to read and write those files to set your preferences.
The plugin use a simple property file (epf extension) to describe a modification of preference.

By example, this sample file activates the "Show line numbers" option :


# @title View line numbers
# @description Show the useful line numbers rulers which also show modifications on lines
# @task_type LASTMOD
file_export_version=3.0
/instance/org.eclipse.ui.editors/lineNumberRuler=true

The two first lines describe the modifications contained in the file.
The third tells GWM how to determine if someone should be asked to apply the modification. By example, if the preference is already set to true, GWM can manage to ignore the modification. But I didn't investigate this part so much. I always set LASTMOD which have for effect to ask the user once and only once.
The fourth line is the version format of the file, nothing to worry about.

The next lines contains the path to the preference and the value to set.

Of course, except being an Eclipse god, nobody knows where preferences are stored. So let's see how to simply create epf files !

Record your preferences changes

Here is the true power of GWM. The next start of Eclipse after GWM installation, you should see this discreet icon at the bottom right corner :


It's in fact, the GWM main menu !
Right click it and choose "Start recording" :






Go the Preferences and change only one preference.
Then return to the same menu and stop recording, this window will appear :


You can find and complete the informations of the epf file and save it !
Of course, record every single preference change in its own file is quite a job.
But, it's the last time you do it. So it worth the effort.

Install your epf files inside Eclipse

Once you have all your epf files, you still have to share them across your workspaces and/or with your colleagues.
For that purpose, GWM provides a list of directories to scan (you can change them in the preferences).
But, by default, GWM will check new files in the configuration/com.google.eclipse.mechanic/mechanic directory inside Eclipse !
So create this directory and put all of your epf files in it.

You can immediately try it by restarting Eclipse on a new workspace. The GWM icon should show you that incoming preferences changes are waiting to be applied :



Obviously, we want to click the "View and correct configuration issues". We have now, for each epf file, the choice to apply the change or not :



By default, everything will be applied. So a click on "OK" imports all your preferences !

If you now zip your eclipse folder, the unzipped Eclipse will contains the GWM plugin and by default, will ask to apply all the epf files contained in it.

Embed JDKs

Personally, I find downloading and installing a specific version of Java another waste of time.
Like Eclipse, once Java is installed, you can perfectly move its installation directory elsewhere.

So, just create a jvms directory inside your eclipse folder and move your JDK folder in it.

Use GWM to record preferences change and add all your JDKs in Installed JRE. Stop the record and save the epf file.

You can also change the eclipse.ini file and add an option to use one of the embedded JVM :
-vm
jvms/jdk1.7.0_45/jre/bin/javaw.exe

Of course, change the path accordingly to the JDK you chose.

You can embed other software (like Tomcats) the same way !

You can now zip your Eclipse folder and your team will share the same JDKs, Tomcats and all other stuff your team need !


Conclusion

You can now build an Eclipse zip which doesn't need 2 hours of configuration after installing it !

Here is my epf configuration changes (except JDKs and Tomcats) :

https://drive.google.com/file/d/0B8EeRUJNdG1aRnVlMHVncVdlVlk/edit?usp=sharing










Commentaires

  1. Pour éviter les pbs de licence de la JVM oracle, tu peux aller voir par là http://www.azulsystems.com/products/zulu/downloads

    Merci pour l'article, je suis en train de le mettre en oeuvre :)

    RépondreSupprimer
  2. Les références à un FabClipse m'ont mis le doute un instant ;) lol

    Quelques erreurs de français, euh, anglais, dans les descriptions : dafault au lieu de default plusieurs fois

    sinon, ben voila, j'ai installé ton paramétrage, je tourne avec zulu, voyons ce que ça donne, si ok je pousserai dans l'équipe

    questions annexes, utilises tu :
    - des outils de qualité de code ? Lesquels?
    - un formattage particulier, si oui lequel ?

    RépondreSupprimer
  3. Bonjour, merci pour la remontée d'informations !

    FabClipse est juste le nom que je donne au zip de mon Eclipse paramétré. Ça permet aux gens de se rappeler que ce n'est pas l'installation standard du site officiel.

    Du coup, les noms des préférences qui ont comme texte FabClipse, c'est vraiment de la configuration personnelle (coloration, formatage, ...) qui peuvent ne pas convenir à tout le monde.

    Du coup, dans le fabclipse_fomatter.epf tu retrouves mon formateur de code.

    Pour les outils de qualité, j'en utilise pas pour l'instant, si tu as un avis, n'hésite pas !

    RépondreSupprimer

Enregistrer un commentaire

Posts les plus consultés de ce blog

Calendrier google des jours fériés

Eclipse.ini file