Setting up a JavaEE project with IntelliJ and maven

Java EE Project (EAR, WAR – Local Deployment) with IntelliJ IDEA and Maven


Setting up a Java EE project with IntelliJ is a trivial task. Getting a multi-module setup to work properly with quick deployments and maven builds is not at all a trivial task.

My requirements:

  • A multi-module project with at least a web module, an ejb module and a common module with shared code to be used by ejb/web
  • Maven building ear file.
  • Easy deployment to local app server (Glassfish and Websphere Application Server)
  • Quick compiles and hot swapping of recompiled code into running app.
  • EJB 3.0 (not 3.1)

Download attached  example project and have a look for what it’s worth.

This is how I created my project using IntelliJ IDEA 10 Ultimate edition:

1. Create modules:

  • Create EJB module named ‘ejb’ and add EJB facet. Don’t “Fix” javaee.jar yet!
  • Create Web module named ‘web’ with Web facet. Don’t create any artifact yet. Move and rename web folder within web module! Give…

View original post 411 more words