Table of Contents

IntelliJ IDEA with OpenXava
Creating a new OpenXava project
Create a new IntelliJ project
Import OpenXava as a module
Import Addons as module
Remove Payroll module
Create Payroll as OpenXava project
Import the just created OpenXava project
Run your project
Migrating your existing project from Eclipse
Create a new IntelliJ project from existing sources
Import OpenXava as a module
Import Addons as module
Run your project

IntelliJ IDEA with OpenXava

Although OpenXava comes with an Eclipse workspace ready to use, using IntelliJ instead of Eclipse is very easy. Here you have the instructions for two cases: creating a new OpenXava project directly in IntelliJ or migrating your existing project from Eclipse to IntelliJ.

Creating a new OpenXava project

We're going to guide you, step by step, to create and run a new OpenXava project in IntelliJ IDEA.

Create a new IntelliJ project

In IntelliJ choose File > New > Project...:

It will show the next dialog:

Just click on Next button to show the next step:

Click on Next again to go the only relevant step, the name and location of your project:

For Project name we put Payroll, as example in this tutorial, but you should write the name of your own project instead. For the location, don't leave the default one, instead choose path of the OpenXava workspace plus the name of your project, in this case openxava-6.3/workspace/Payroll. This is very important, otherwise your project will not run afterwards.
Click on Finish, then IntelliJ will ask you:
Click on OK, although IntelliJ is still not happy enough and asks you one more thing:
Click on This Window button.
Finally, a plain Java IntelliJ project has been created. It should look like this:

Import OpenXava as a module

For that, choose File > New > Module From Existing Sources...:

Now select the OpenXava project inside the workspace folder of your OpenXava distribution:

Note, we choose OpenXava inside workspace-6.3/workspace. Click on OK.

In the next dialog select Import module from external model > Eclipse:

And click on Next. This takes you to the next dialog:

Where you have to click on Next without touching anything.

In the next step unselect OpenXavaTemplate and OpenXavaPlantilla, leaving only OpenXava, thus:

Click on Next. In the next dialog about code style:

Just click on Finish.

Import Addons as module

For that, choose File > New > Module From Existing Sources...:

Now select the Addons project inside the workspace folder of your OpenXava distribution:

As you already have figure out this is the same procedure we have used to import OpenXava, so yes click on OK, then Next, Next, Next and Finish, accepting all default values.

Finally, you have your project with three modules, Addons, OpenXava and Payroll:

Remove Payroll module

Don't worry, we'all add it again in a few steps. Click with mouse right button on Payroll module, and the select Remove Module:

IntelliJ will ask you for confirmation:

Click on Remove, with no fear.

Create Payroll as OpenXava project

Look for CreateNewProject.xml on the root of OpenXava module, and click on it with the mouse right button. Select the option Add as Ant Build File:

It shows an Ant view on the left. There choose CreateNewProject and click on the Run button (the button with the play green icon).

It asks you for the project name, type Payroll, and click on OK.

And wait until the message "Ant Build Progress" on bottom disappears:

Import the just created OpenXava project

We are going to import the just created Payroll project as a module. Choose File > New > Module From Existing Sources...:

Now select the Payroll project inside the workspace folder of your OpenXava distribution:

As you already have figure out this is the same procedure we have used to import OpenXava and Addons, so yes click on OK, then Next, Next, Next and Finish, accepting all default values. Before creating the module IntelliJ will ask you a last question:

Click on No. Finally, you have your project with three modules again, Addons, OpenXava and Payroll:

Run your project

Finally, the big moment. Open Payroll > src > _run, and there click on _Run_Payroll with the mouse right button. Then choose Run '_Run_Payroll.main()'.

Be patient, the first time it has to build everything. Then you will get in console:

Click on the link http://localhost:8080/Payroll and try your application. Congratulations! Your new OpenXava application is running in IntellJ. Now you can modify your code, adding a new entity for example, and restart your application to see the changes.

Migrating your existing project from Eclipse

If you're already have your OpenXava project working in Eclipse and want to migrate it to IntelliJ follow the steps below.

Create a new IntelliJ project from existing sources

In IntelliJ choose File > New > Project from Existing Sources...:

Now select your project inside of your Eclipse workspace, for this tutorial we're going to import InvoiceDemo, included by default with OpenXava:

In the next dialog select Import project from external model > Eclipse, possibly the default option:

And click on Next. This takes you to the next dialog:

Where you have to click on Next without touching anything. It takes you to the next the dialog:

Click on Next. In the next dialog about code style:

Click Next without touching anything. Now you have to choose the JDK:

Accept the default values clicking on Finish. Then IntelliJ gets angry because unknown modules:

Don't worry, just click on OK, to get one more question:

Click on This Window button to finally get your project imported:

Still remains to import the OpenXava and Addons modules.

Import OpenXava as a module

For that, choose File > New > Module From Existing Sources...:

Now select the OpenXava project inside the workspace folder of your OpenXava distribution:

Note, we choose OpenXava inside workspace-6.3/workspace. Click on OK.

In the next dialog select Import module from external model > Eclipse:

And click on Next. This takes you to the next dialog:

Where you have to click on Next without touching anything.

In the next step unselect OpenXavaTemplate and OpenXavaPlantilla, leaving only OpenXava, thus:

Click on Next. In the next dialog about code style:

Just click on Finish.

Import Addons as module

For that, choose File > New > Module From Existing Sources...:

Now select the Addons project inside the workspace folder of your OpenXava distribution:

As you already have figure out this is the same procedure we have used to import OpenXava, so yes click on OK, then Next, Next, Next and Finish, accepting all default values.

Finally, you have your project with three modules, Addons, OpenXava and InvoiceDemo:

Run your project

Open InvoiceDemo > src > _run, and there click on _Run_InvoiceDemo with the mouse right button. Then choose Run '_Run_Payroll.main()'.

Be patient, the first time it has to build everything. Then you will get in console:

Click on the link http://localhost:8080/InvoiceDemo and try your application. Congratulations! Your OpenXava application is running now in IntellJ. Now you can modify your code, adding a new entity for example, and restart your application to see the changes.