Project Configuration

Now, you will configure Eclipse for developing Red Hat Web Application Framework.

Add Projects

Red Hat Web Application Framework

  1. In Eclipse, go to File->New->Project

  2. Select Java Project

  3. Name this project, webapp (or whatever you wish) and select your existing Red Hat Web Application Framework core-platform directory as the project directory.

  4. In the source tab, make sure that Eclipse lists the Red Hat Web Application Framework source directory, src. If it is not there, click Add Existing Folders... to add it. You may also want to add the directory for the Junit test code, test/src.

    After adding the existing source folders, click on Create New Folder.... Name this folder _generated. This is where Eclipse will store its JavaCC-generated source files.

  5. Select the Libraries tab once you are presented with the Java Settings dialog box.

  6. Click on Add JARs and select all the JARs under your Red Hat Web Application Framework Project (typically under lib and etc/lib)

  7. Click on Add External JARs and add the following JARs:

    • $ORACLE_HOME/jdbc/lib/classes12.zip

    • $RESIN_HOME/lib/jta-spec JAR

    • $RESIN_HOME/lib/resin.jar

  8. Click on the Order and Export tab. Select All

  9. Create a build folder for Eclipse on your file system. Then, enter the path to that build folder in the Build output folder input box

  10. Click on the Finish button

CMS and Other Projects

To add CMS or other projects to Eclipse, follow the same steps as for Red Hat Web Application Framework, with the following exceptions:

  • For CMS and other projects that depend on Red Hat Web Application Framework, you do not need to add external JARs. Eclipse will pick up these libraries from Red Hat Web Application Framework.

  • When you reach the Java Settings Dialog box, select the Projects tab. For CMS, add a dependency upon Red Hat Web Application Framework. For projects that use both Red Hat Web Application Framework and CMS, add a dependency upon both Red Hat Web Application Framework and CMS.

  • Create build folders for the respective projects.

Perforce

For each project that you have added, go to the Package Explorer and right-click on it. Then, select Team->Share Project. Select the options for Perforce. Now, you should see a Perforce menu and Perforce options for your source files.

Building and Deploying

Eclipse uses its own build directories for compiling your source files. However, you will probably still want to use the Red Hat Web Application Framework build system for building and deploying your application. Therefore, you should create a shell script that will do this for you. Then, you may call this shell script to build and deploy Red Hat Web Application Framework from within Eclipse when you are ready to run your application.

Here is a shell-script that I use. You should modify it for your own environment.

#!/bin/bash 

#setup environment 
. /etc/profile.d/ccm-config.sh
. /etc/profile.d/ccm-devel.sh 
. /etc/profile.d/ccm-scripts.sh

CCM_HOME=/var/ccm-devel/dev/bche/ecm_dev
ORACLE_HOME="/opt/oracle/product/9.2.0" 
JAVA_HOME=/opt/IBMJava2-131

CLASSPATH=$CCM_HOME/core-platform/lib/jaas.jar
CLASSPATH=$CLASSPATH:$CCM_HOME/core-platform/lib/jce.jar
CLASSPATH=$CLASSPATH:$CCM_HOME/core-platform/lib/sunjce_provider.jar
CLASSPATH=$CLASSPATH:$CLASSPATH:$ORACLE_HOME/jdbc/lib/classes12.zip
CLASSPATH=$CLASSPATH:$CCM_HOME/core-platform/etc/lib/iDoclet.jar
export CLASSPATH 
  
export ANT_OPTS="-Xms128m -Xmx128m" 
	  
########## 
#build
########## 
	  
#uncomment to make enterprise.init 
#cd $CCM_HOME 
#ant make-config 
#ant make-init 
	  
#clean 
cd $CCM_HOME 
ant clean 
	  
#build 
cd $CCM_HOME 
ant deploy
	  
#javadoc 
cd $CCM_HOME 
ant javadoc 
ant deploy-api
	

In your ant.properties file, make sure that you have set

compile.debug=on

Once you have created this shell script, in Eclipse go to Run->External Tools->Configure. A dialog box will appear for configuring external tools. Select New. In the Tool Location input box, select your shell script for deploying Red Hat Web Application Framework. Select the options:

Then, select OK. Now, in Eclipse, your shell script will appear under Run->External Tools. Use that to build and deploy Red Hat Web Application Framework from within Eclipse.