Table of Contents
The goal of this article is to get a developer that is new to IntelliJ IDEA up and running with the Expresso framework. Prior knowledge of IntelliJ IDEA is not necessary.
To follow along in this article, you should have the following items:
IntelliJ IDEA 3.0 This article was written using IntelliJ IDEA 3.0. The concepts of this article should also work for IDEA 2.2 users with minor adjustments.
Expresso 5.0.3 Complete This is the version that the article was written against because it provides nearly all the needed jar files as well as a pre-created database and the Tomcat server. With effort, you can use Expresso binary and Expresso src distributions together if you do not wish to download the Complete bundle, but it is not recommended.
BouncyCastle Cryptography Provider. Despite its weird name, BouncyCastle is, in the author's opinion, one of the most advanced JCE (Java Cryptography Extensions) providers available to the open source community. There are a few classes in Expresso that rely on this library, and it is highly recommended that you retrieve the latest version from The BouncyCastle web site Most likely the file you will want to get is jce-jdk13-116.jar, so if you are in doubt, the author has successfully used this particular JAR for both JDK 1.3 and JDK 1.4.
Once you have obtained the BouncyCastle provider, you can 'install' it by copying it into the ${EXPRESSO_INSTALL_DIR}/webapps/ROOT/WEB-INF/lib directory.
Probably at this point you are wondering why you have to do this. Well it just so happens that the United States government has certain restrictions for cryptography export. Although the rules have certainly be relaxed from previous years, there is still the provision in the law that strong cryptography cannot be knowingly exported to the State Department's "seven terrorist nations." That means that the distributors of Expresso would have to incorporate I.P. checkers and other basic provisions to prevent them from knowingly export to these blacklisted nations. It is the Expresso development team's goal to have this functionality operational soon. But until that time, the BouncyCastle will have to be separately downloaded. [In this case, it comes from Australia which has no such cryptography export laws.
JDK 1.4.1 - IDEA insists that for best debugging experiences, you use the latest Java Virtual Machine. This can be found at Sun's Java Website
Before we begin, we need to briefly discuss notation used throughout the rest of the article. Most of the directories mentioned in this tutorial are relative to the root directory where you unzipped the Expresso-complete installation. We will denote this root directory as ${EXPRESSO_INSTALL_DIR}. So for clarification, let's say, for example, that you've unzipped Expresso into the C:/expresso directory. If you see the notation ${EXPRESSO_INSTALL_DIR}/webapps/ROOT/WEB-INF/lib, then given the base directory, the full path would be: C:/expresso/webapps/ROOT/WEB-INF/lib
So let's get started! Launch IDEA. If you do not get prompted with the new project dialog, go to File -> New Project. For the project name, enter "Expresso". Select the JDK to use with the project. If you do not have a JDK configured, click on the ellipsis (...). If the list for "Select JDK" is blank, click on the Configure button and select the root directory where you have your Java Development Kit installed. Now for the Compiler Output Path, select ${EXPRESSO_INSTALL_DIR}/webapps/ROOT/WEB-INF/classes. There is a screenshot included below that shows what the dialog might look like when everything is entered. Now click Next.

For the project path dialog, enter ${EXPRESSO_INSTALL_DIR}/webapps/ROOT/WEB-INF/src (Remember to substitute ${EXPRESSO_INSTALL_DIR} with the directory you installed Expresso-complete into.)
You should now be at the "Source Path" screen. Click on Add Path. Now locate the directory ${EXPRESSO_INSTALL_DIR}/webapps/ROOT/WEB-INF/src and select that as your source path. Aside from a different directory, your source path dialog will look similar to that listed below. Once you have selected this, click on the Next button.

Now for setting up the classpath for an Expresso project. There are several items that have to be added here:
${EXPRESSO_INSTALL_DIR}/webapps/ROOT/WEB-INF/lib/*.jar Now as soon as you locate this directory, you'll see that there are a lot of jar files. The quickest way to select them all is to select the first jar file in the list and left-click; Then scroll down to the last jar file, hold down the SHIFT key and click on the last jar file in the list. This will select all the jar files in the lib directory.
${EXPRESSO_INSTALL_DIR}/common/lib/servlet.jar
Once the project is created, click on the "Project" tab in the upper left hand corner of the screen. It should look similar to the picture that is below.

Expresso relies of XML Document Type Definitions to be copied into the output path along with the source files. Unfortunately, IDEA doesn't copy DTD's to the output directory by default. To set this up, we select the menu item: File -> Project Properties. Now click on the Compiler button. Near the bottom of the page is a box titled Resource Patterns. Change this entry to:
.+\.(properties|xml|html|dtd);.+\.(gif|png|jpeg|jpg)Now click OK.
Ok, it is time to put our procedure to the test! From the IDE menu select Build -> Rebuild Project. You should see the IDE compile approximately 500 files. Although you will see several "Deprecation Warnings", there should be no actual compilation errors. If there are errors, you need to double-check your setup procedure. If you cannot find your error, you are encouraged to post to the JCorporate forums or OpenSource mailing list for assistance.
Now it is time for a little side trip. Locate the file ${EXPRESSO_INSTALL_DIR}/conf/server.xml and open it for editing. Locate inside the following lines of code:
<!-- Tomcat Root Context --> <!-- <Context path="" docBase="ROOT" debug="0"/> -->Uncomment it by removing the <!-- and --> lines. Now save the file and close your editor. Back to IDEA!>
If you wish to use a non-ROOT context for your own setup, you will want to add a line like:
<Context path="/myappname" docBase="myappname" debug="0"/>
There are a couple of ways to set up debugging here the IDEA can support. You can either attach to a Tomcat server remotely, or you can launch the entire Tomcat server within the IDE. Because the latter is a little bit simpler to set up, we will cover this method more extensively.
First we have to do a small tweak. For some reason, most likely Classloader related, log4j does not work if in the WEB-INf/lib directory. Instead, copy the log4j jar file from ${EXPRESSO_INSTALL_DIR}/webapps/ROOT/WEB-INF/lib to ${EXPRESSO_INSTALL_DIR}/common/lib directory.
In the IDE menu click Run -> Debug. The Debug settings dialog pops up. Click on the "Web App" tab and press the "+" button. For a name, enter "Tomcat."
For the Web Application box, click the Configure Button. Click the "Enable Web Application support" button. Now click the Add Button. For the Name, enter ROOT; for the Path to Document Root, enter ${EXPRESSO_INSTALL_DIR}/webapps/ROOT. You can click on the "Validate JSP" pages if you wish. For Application Server, keep the default of "Tomcat 4.0.x Server." Check the box: "Launch server before debugger attaches" box.
For the Runtime configuration enter the following parameters:
Catalina home: ${EXPRESSO_INSTALL_DIR}
Path to Catalina configs:${EXPRESSO_INSTALL_DIR}/conf
Application Context Path: (leave blank)
If you have a non-ROOT context, the name of that contextwill go here. For example, if you use the expresso-binary target, it will be "/expressoXXX" where XXX is the version of Expresso
VM Parameters: -Xmx128m -Xms128m These settings set a large minimum and maximum memory setup for Tomcat. This significantly improves performance while debugging and gives the server application lots of memory room to breathe.
Include project classpath: Leave unchecked. Tomcat has a custom class loader that automatically makes all jars in WEB-INF/lib and common/lib available to the web application.

If you are interested in Remote Debugging. It is recommended that you set up an ANT target to assist in the launching of the server. You would add this target to the build.xml file that comes with the Expresso source package. A sample target might look something like this:
<target name="debug"
depends="compile"
description="development debug startup, occupies current shell; terminate with control-C or gracefully via Tomcat shutdown script" >
<mkdir dir="${basedir}/logs"/>
<java classname="org.apache.catalina.startup.Bootstrap"
failonerror="true"
fork="true"
dir="${local.tomcat.home}"
>
<classpath refid="tomcat.classpathset"/>
<sysproperty key="catalina.home" value="${local.tomcat.home}" />
<sysproperty key="catalina.base" value="${local.tomcat.home}" />
<sysproperty key="java.compiler" value="NONE" />
<jvmarg value="-Xrunjdwp:transport=dt_shmem,server=y,suspend=n,address=5005" />
<jvmarg value="-Xdebug" />
<jvmarg value="-Xnoagent" />
<jvmarg value="-Xms128m" />
<jvmarg value="-Xmx250m" />
<arg value="start" />
</java>
</target>
Once you have that set up, go to IDEA, click File -> Project Properties -> Run/Debug -> Remote. Click on the plus sign to add a new remote debugging profile. If you are launching Tomcat on the local server, then accept the defaults there and click OK.
Now start Tomcat by running the ANT build script you created above. On a windows machine, the command line might look something like this:
%ANT_HOME%\bin\ant debugOnce Tomcat is launched, you could click on the debug button in IDEA to attach to the running Tomcat process.
If everything has gone well, you should be able to point your browser to http://localhost:8080/ and you will see the Expresso welcome page. If you have problems, feel free to post to the Expresso forums or the Opensource mailing list any questions. Be sure to mention that you are trying to get Expresso running within IDEA and post the full error message. From here, it is recommended that you read the Expresso Developer's Guide to get a feel for the full capabilities of the framework.