Willing to refresh my Sonar knowledge, I decided to (logically) start with setting up my environment on Linux, from ground up. This post summarize the needed actions.
- Java 6 up and running
- Eclipse IDE (probably apart from the Aptana, better be able to make them evolve independently)
- Maven 2 (I'm convinced by Maven - meaning that I think that its bad, but that all alternatives are worse)
- m2clipse (Maven plugin for Eclipse)
- Base test workspace (basic Maven projet, code/test/run)
- Tomcat running inside eclipse (using WTP)
- Base web project (welcome page, servlet)
tells me that a version of Java is already installed: 1.6 openjdk. Some surfing shows that people think its slow, however, I'm willing to put this to the test. I can always get the sun version later if needed.
To apt or not to apt? With my python experience, knowing that I want a precise version, I think I'll be better to download the one I want from the eclipse website and unpack it.
Once downloaded, it was just one command to unpack and move it to opt:
(the move did fail in my test, but a quick sudo resolved it - still not used to need to request privileges when I want to do something outside of my home).
First test (basic project with a hello world) works fine, so to the next element.
Well, I decided to install a tomcat also - always useful to be able to test a web application.
Note that tomcat is installed in /usr/share/tomcat6, because you will need to tell it to eclipse.
Maven & m2eclipse (eclipse integration)
As m2eclipse embeds Maven itself, you only need to install the plugin, using Eclipse install new feature functionality, specifying http://download.eclipse.org/technology/m2e/releases as the update site. After a quick restart, the new project should propose a "Maven" option, creating a basic (or more complex using archetypes) ready to launch Maven project.
Tomcat and WTP
WTP (WebToolProject) allows eclipse to start and run web project (.war) on an installed web server (such as Tomcat). WTP is included with eclipse "J2EE edition". You need to use the preferences to define a server, and point eclipse to your tomcat installation (that you noted previously).
The server did show up, but all attempt to start it (with a simple "Dynamic Web Project" or even with no modules at all) resulted in a "corrupted configuration" message:
Could not load the Tomcat server configuration at /Servers/Tomcat v6.0 Server at localhost-config. The configuration may be corrupt or incomplete.
After some search, I did discover that :
- ./tomcat6/conf directory was empty
- A ./tomcat6/skel/conf existed with the needed file
- ./myworkspace/servers/Tomcat v6.0 Server at localhost-config was empty
The last one is the place where Eclipse expect to find Tomcat config files for its usage (it does not use the main configuration - which is probably a good idea, so you can keep apart configurations per workspace, should you need to). Once I copied the contents of the conf directory to it, the server did start with no further problems.
To make it accept my brand-new web application, I still had to configure it as a "dynamic-web-projet", using the Project facets configuration (which should, I think, be automatic). This minor task done, the server responded to a welcome page and a (very basic) servlet without problem.
Maven, Tomcat and WTP
Same as above, but with a Maven project using a web archetype from codehaus. No problem here either, except, again, I had to configure the project facet before being able to use the "Run on server" option.
Well, again, this was not exactly frightening. Being "command line oriented", I was probably a good candidate to switch to Linux, but seeing how easy it is, I'm wondering why my day job office has not yet made the switch, probably some corporate tools would not work, but I'm not even sure of that. Could be an interesting last internal improvement project.