As some of you probably know I have a privilege to teach Java related stuff at Poznań University of Technology. During the lab sessions which I am leading we were going through configuration of Eclipse IDE to work with JEE 6. I am using Eclipse since I started to write in Java, some things are obvious for me. We wanted to work with Glassfish, Apache Maven and Subversion which are quite common tools, so it should be quite simple to force Eclipse to work with this setup. Let’s start.
- Download Eclipse IDE for Java EE Developers
- Unpack and run
- Now, I will have to install m2eclipse, I would like to use Eclipse Marketplace because it does not require knowledge about update sites for plugins. So, I choose “Help” and than “Eclipse Marketplace”.
- I am searching for m2eclipse… ok, there is something with Install button here [click].
- Accept the license agreement
- Confirm that I want to install unsigned jars
- Installation was sucessful, Eclipse is asking if I want to restart IDE – “ok, if you have to”.
- I know that I need also m2eclipse-extras for integration with Eclipse Web Tools Platform.
- I am choosing Eclipse Marketplace and searching for m2eclipse-extras – without luck.
- It seems that I need an update site for this. From Help menu I am choosing “Install new software”
- Starting to work with new Update Site for m2eclipse-extras
- I need to choose out of 4 bundles from that site. I cannot click “select all” because I don’t have Sublipse plugin installed, anyway who is using SVN nowadays? 😉
- After choosing right bundles it is time to accept license agreement
- Once again I need to confirm that I want to install unsigned jars
- Installation was sucessful, Eclipse is asking if I want to restart IDE – “ok, if you have to”.
- It is high time to import my project into workspace, choose File>Import>Import existing Maven project (but who knows maybe “Import existing project” would also work ;-))
- At this stage m2eclipse shows warning that my Eclipse is running on JRE not JDK and this may cause some problems
- To correct this I have to edit eclipse.ini and add “-vm” parameter with path to JDK (in separate lines – but everyone knows how .ini file works)
- Ok, now it is time for Glassfish, I choose Window>Preferences>Server Runtime and click on Add button
- There is no Glassfish here, so I choose to download additional server adapters.
- Ok, now I can choose out of four different Glassfish types (finally I will choose appropriate).
- During creation of new server runtime, I have to remember to point to glassfish-3.1/glassfish, (base glassfish-3.1 directory is not enough).
- After creation of new adapter, it should be possible to run imported application using Glassfish. It should be but…
- Eclipse says that in order to run Glassfish I need JDK – what the heck, I’ve just changed my eclipse.ini. Someone told me that I have to define new “Installed JRE” which is pointing to my JDK installation.
Only 24 easy steps – great! 😉
I’m not a huge fan of NetBeans but please take a look how NetBeans IDE deals with this issue.
- Download NetBeans (with Glassfish)
- Run NetBeans and Glassfish installer
- Run NetBeans IDE
- From File menu choose Open project
- From Tools menu choose Servers, ensure that Glassfish is in place. (This step is unfortunately necessary :(, without this NetBeans claims that there is no Glassfish defined – you just have to open dialog window, nothing more).
- Run Project
NetBeans will even launch Derby network server on its own if you use this DB in your project. I do not have nothing against Eclipse puzzles but it seems that it simply works!
I know why all this have to be done with Eclipse, but the question is who will bother with this if he can just launch Visual Studio 😉. In fact it is just a matter of reasonable defaults, is it really so hard? Maybe JEE is too new to get proper support in Eclipse?