Building Apache MyFaces with IntelliJ IDEA - Step by Step

Prepare maven and the maven-idea-plugin

Download and install maven

  1. Download the current maven version available at

  2. Follow the Installation Instructions on to install maven

Build latest maven-idea-plugin

The latest stable release works for MyFaces, but there is a patch (filed under which enables you to work more naturally with MyFaces in IntelliJ.

For building the patched version of the plugin,

  1. Do a subversion checkout from

  2. run
    •         mvn clean install
    •         mvn clean install -Dmaven.test.skip=true
    if there are test failures)

Apply the patch under the link above.

(If you are using TortoiseSVN, right-click your local folder and select TortoiseSVN -> "Apply Patch...". Select the downloaded patchfile. Two new windows are opened. Right-click one of the provided filenames and select "Patch all". Close the window.)

Uncomment the maven-idea-plugin in myfaces-master/maven/master-pom/pom.xml. It should look like this:


Checkout MyFaces and create the IDEA Project with maven

  1. checkout (svn) the myfaces source directory from

  2. change into that directory in the console window
  3. run
    •         mvn clean install
  4. select one of the JDKs in your IntelliJ settings under "JDK & Global Libraries" and remember (or clipboard) the exact name
    Note: JDK 1.5.x is not recommended, use a JDK 1.4.x instead

  5. after that run
    •        mvn idea:idea -DjdkName=NAME
    where NAME is the name of the JDK in your IntelliJ settings (see last step)
  6. exit the console window and open the newly created project "myfaces-build.ipr" with IntelliJ IDEA

Customize the project

configure the Web-Modules:

add shared-tomahawk-library

  1. select the tomahawk module
  2. select the libraries tab
  3. press add Jar/Directory and select /shared/core/shared-tomahawk/target/myfaces-shared-tomahawk-X-snapshot.jar
  4. if you want to debug myfaces you should add the sources /shared/core/shared-tomahawk/target/myfaces-shared-tomahawk-X-snapshot-sources.jar
  5. select the Order/Export tab
  6. check myfaces-shared-tomahawk-X-snapshot.jar (shared lib will be visible to tomahawk-sandbox as well)

add shared-impl-library

  1. select the myfaces-impl module
  2. select the libraries tab
  3. press add Jar/Directory and select /shared/core/shared-impl/target/myfaces-shared-impl-X-snapshot.jar
  4. if you want to debug myfaces you should add the sources /shared/core/shared-impl/target/myfaces-shared-impl-X-snapshot-sources.jar

for each of the web-modules (they are listed in the left section of the dialog having a globe as icon)

  1. select the web-module in the left section of the dialog
  2. select the tab J2EE Build Settings
  3. check the checkbox "Create web module exploded directory"
  4. click on the tab web module settings
  5. in the top-left drop-down-menu select an application server (most likely tomcat)

Choose an application server for running/debugging and set the application contexts

  1. click on the dropdown left of the "dead" run and debug buttons, and selct "Edit Configurations"
    (alternatively you can select Run -> "Edit Configurations" to get the same dialog)

  2. click on the tab "Tomcat Server"
  3. click on the + Button in the left section of the dialog and choose "Local"
  4. In the right section of the dialog, in the dropdown next to "Application Server" select "Tomcat"
  5. In the right section of the dialog select the sub-tab Deployment
  6. For each web-module:
    • click on the module
    • check the checkbox "Deploy Web Module" in the right section of the dialog
    • enter an application-context for the module
      Note: the individual modules must have different application context and there can only be one module with the context /
      myfaces-example-simple generally is a good one to start with ;-)

  7. Click on the run or debug button start the application and test if you can access the examples with your browser (probably under http://localhost:8080/)

JetBrains_IntelliJ_IDEA (last edited 2009-09-20 23:02:02 by localhost)