We're going to guide you, step by step, to create and run a new OpenXava project in IntelliJ IDEA.
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 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.
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:
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.
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:
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:
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.
If you're already have your OpenXava project working in Eclipse and want to migrate it to IntelliJ follow the steps below.
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:
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.
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:
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.