main

Eclipse RAP 2.0 QuickStart with IntelliJ IDEA

februar 21, 2013 — by Edvin Syse0

Eclipse RAP 2.0 is finally out! As you probably know, developing Eclipse RAP or RCP applications outside of Eclipse can be challenging. Actually, even from the Eclipse IDE itself it’s often no walk in the park to juggle all the tooling required to create and run a RAP application, let alone deploy it to a standalone servlet container like Tomcat as a simple WAR.

I’ve created a quickstart project that will get you up and running with RAP 2.0, including project files for IntelliJ IDEA 12 if that’s your IDE of choice.

Bootstrap your application

Download this small ANT script to bootstrap your RAP application. Run it from the command line by supplying a default package and an application name:

This will create a folder named MyRapApp in the current folder with all the RAP dependencies and a module for your GUI ready to go. If you want, you can go right ahead and change into the MyRapApp directory and create a WAR-file ready to be deployed in your favourite servlet container just by running the default build command:

You now have ROOT.war that clocks in at a little less than 12MB, including the OSGI runtime, the RAP and JFace binaries and your project module.

You can open the supplied project.ipr in IntelliJ IDEA and get coding right away. The project includes a minimal sample View and a sample Editor for your convenience.

As per default, the OSGI console will start together with your servlet container. If you start Tomcat from the command line, you can actually interact with the console directly after the application is ready. Listing the activated bundles yields:

To run the project from IntelliJ IDEA you open the project.ipr and create a run configuration for the already supplied app:war artifact. Click Run -> Edit configurations, Add (+) -> Tomcat Server -> Local and choose the Deployment tab. From there, click the plus, and choose the already populated app:war artifact. Next, run the configuration and your application will be automatically deployed to Tomcat.

Configure IDEA Run Configuration

Hot code deploy is supported, and every time you make your project, the module artifact and the WAR artifact are automatically rebuilt. The RAP source code is attached as well, so you have documentation and sources available directly in IDEA.

If you take a look at the application in your browser, you should see something like this:

rap-quickstart-app

Changes to the editor should enable the save button, and clicking save should reset the dirty state. If you are having issues or wondering about details, please let me know and I’ll try to help out. Good luck!