Friday, December 14, 2012

Building a Java EE application with Intellij (and Windows)

We are going to use Intellij to build our photodb project (Check Getting started with Apache TomEE by Jonathan Gallimore to see an example with Eclipse). By using an IDE to build and run the application, we make this a multi-platform task, meaning that the Windows users can follow the same steps as Ubuntu ones. In fact, I will use a Windows box for this demo. I won't install the tools. I will assume that you have a computer with the following software already installed.

Select "Keep project files in", point it to another directory and click "Next".

Click "Next" again.

Select the JDK that you want to use in the project (Add one if necessary).

Click "Next" and then "Finish".

Now lets prepare the Application Server. We will use the bleeding edge version of TomEE. You can either build your server locally or download it here [I've already built it for you ;O)]. Now extract it to a directory of your choice.

Click on "Edit Configurations..."

Add a new configuration.

Select "TomEE Server" and "Local"

Click "Configure" and set the path of your TomEE installation.

Select the "Deployment" tab, click "Add" and "Artifact".

Select "photodb-gui:exploded".

Change the "Application Context" to "/photodb".

We are almost there. We still need to configure the JAAS. Copy "photodb/src/main/config/localLoginScript.js" to the config folder of your TomEE installation. Now add an environment variable to TomEE.