1. Create new project
Create a Java application via New Project Wizard.
2. Select application server
Before you configure libraries, you need to select an application server to which you'll be deploying your application. If there is no application yet, click New to configure one.
If you're going to deploy your application to multiple application servers, you can configure them later via Run → Edit Configurations.
3. Select JSF library
If the application is using the JSF library, select the corresponding item in the list. By default IntelliJ IDEA uses libraries provided by the selected application server.
Library you selected is automatically downloaded and configured (if required), by IntelliJ IDEA.
4. Configure other libraries
Now you can select other libraries for use with your application: Bean Validation, CDI, JSON Processing, WebSockets, RESTful Web Services (JAX-RS), WebSockets, you name it.
After you click Finish, IntelliJ IDEA creates the project.
6. Check module dependencies
To make sure that libraries are properly configured, go to the Project Structure → Modules → Project Dependencies. There you can review and modify the list of libraries as you see fit.
7. Check web settings
To check the Web descriptor and resources directory configuration, go to Project Structure → Facets and configure descriptors (e.g. application server specific), or change Web resource directories.
These settings will be used to build artifacts.
8. Check configured artifacts
An artifact is what IntelliJ IDEA deploys to application server when you run your application. To make sure that artifacts are properly configured, go to Project Structure → Artifacts.
This dialog lets you change existing artifacts, or add new ones.
9. Check run configuration
One last step before running the application is to make sure that its Run Configuration is all right. For that, see Run → Edit Configurations.
Run Configuration defines how application server is configured and controls application deployment.
10. Check artifacts to deploy
Deployment tab lets you choose what artifacts to deploy, update or remove from application server when you run this configuration.
11. Run application
Assuming that everything is set right, we can try running our application.
When application is deployed to selected server, IntelliJ IDEA opens it start page (can also be changed in Run Configuration settings.)
12. Live edit
In addition to the server-side debugging toolsб IntelliJ IDEA provides the Live edit feature, which helps you debug applications directly in your Web browser. This is very simple, really: after you installed (browser helper plugin), just use the Debug in Browser from the browser context menu.
IntelliJ IDEA opens application page in your Web browser and warns that it's now available for live editing.
Now you can see the DOM structure of application page directly in IntelliJ IDEA, and, which is what's so cool about Live Edit, deploy them to the server as you type, so everything is synced without a single restart.
Try to make some changes on the page, and you'll see that browser displays them immediately.
13. Create a named bean
Now let's create some server code and try debugging it.
14. Update application
When application is running, we can use the Update action via F10 to choose how to redeploy it.
15. Debug application
In debug mode IntelliJ IDEA stops at breakpoints (well, what else would it do, right?)
15. Update resources on frame deactivation
Note that you can specify application redeployment settings on the Update tab, which is available in the Run configuration dialog.
One more useful option here is On frame deactivation, which controls what happens when IntelliJ IDEA window loses focus. If you choose to redeploy resources at that moment, then, for example, switching from IntelliJ IDEA to Web browser would trigger this action, and by the time you hit Refresh, the application will already have been updated on server, allowing you to see all the changes you made in action much quicker than otherwise.
16. Configure application servers
In this tutorial we used GlassFish 4.0. Of course, you can easily configure any other application server of your choice via Settings → Application Servers.
As we hope you could see, development of Java EE applications with IntelliJ IDEA is easy as pie. And fun, too!