Monday, December 3, 2012

Launching a GWT Demo with IntelliJ IDEA

It's been a while since I worked with GWT. I did it for a pet project, when I was into all the databases stuff. It was about database normalization. You know, to avoid redundancies, which of course you denormalize when you copy your entities to Lucene or a NoSQL database. But this post isn't about that.

I wanted to start a simple GWT project. Copying the one in the tutorial. So I launched my new IDEA Ultimate environment (those $100 have to pay off), which has built-in GWT support. This has to take only a few minutes I thought. Right...

First, I wanted to run the project in production mode, deploying it to a Tomcat 6. It said the deploy was successful, yet nothing was there. I checked Catalina Home, Catalina Base, all those variables. After hours I decided to remove the Tomcat folder and create a new one, so I downloaded it again from the Apache site, unzipped it, and set it up in IDEA. Then I checked with great detail all files in conf, that everything was there, and suddenly, it worked. What happened? Only deity knows...

So, now let's make it run in dev mode. I read about a new mode in GWT 2.5: "Super Dev Mode" and IDEA suports it. Let's try it.

Well, supposedly it runs a compiler server and you add bookmarks links so when you work on your GWT page, you can rebuild your javascript code "on the fly". But where was my GWT page? It certainly didn't work with my app that was running on Tomcat (in production mode). I guess Super Dev Mode needs more polishing.

Let's try the old and tested "Classic" Dev Mode. It started successfully. Now I need to install the GWT plugin for Chrome. Easy you say? Nahh.. It seems that this plugin is not supported (at least yet) if you run Chrome on Windows 8 (or Server 2012, in my case). Why? Well, people are complaining in the forums. After being defeated once more, I downloaded and installed Firefox. Aha! It seems that there is no official GWT extension for Firefox. Luckily there was an unofficial one and it seemed to work.

So this was the status of a little GWT demo which was supposed to be running in minutes but took me hours. Now at least I can start adding more widgets and panels. I hope I can run the GWT plugin for Chrome again without resorting to virtual machines.

As usual, thanks to StackOverflow for helping me finding some answers, or at least people that had the same questions.