Developing with Eclipse

The Eclipse Classpath

Compiling, debugging, external dependencies, source code completion, searching, auto imports, all rely on a properly configured classpath. When you first create a project, a .classpath file is created in the projects root directory. With the Jetspeed source, we provide you with a ready-to-use Eclipse .classpath file. We have already configured the relative source directories for you. Eclipse provides a .classpath GUI editor from the Project->Properties menu option.

JAR files and the Maven-1 repository

Jetspeed requires quite a few JAR files to be able to compile. The .classpath file that comes with Jetspeed is setup to get its JAR files out of a local Maven-1 repository. You can see all the JAR file dependencies from Eclipse. Go to Project->Properties->Java Build Path->Libraries. Notice all the JAR files are configured as VARIABLE library entries. Take one example:

                    MAVEN_REPO/commons-lang/jars/commons-lang-2.0.jar                            
					
The Variable is portion is MAVEN_REPO. The Extension portion is /commons-lang/jars/commons-lang-2.0.jar Eclipse locates the JAR dependency from a Variable location root. In order for this classpath to work correctly, the variable root is dependent on a Maven-1 local repository file structure.

To configure the MAVEN_REPO variable, go to Window->Preferences->Java->Build Path->Classpath Variables, click on New, and define a new variable named MAVEN_REPO, pointing it out the root of your local Maven-1 repository, usually someplace like your $HOME/.maven/repository.

JAR files and the Maven-2 repository

The same procedure applies for working a local Maven-2 repository. We provide an alternative .classpath file found in the source code under etc/editors/m2.classpath. Copy m2.classpath over the .classpath file in the project root.

This classpath requires a different Eclipse classpath variable: M2_REPO. To configure the M2_REPO variable, go to Window->Preferences->Java->Build Path->Classpath Variables, click on New, and define a new variable named MAVEN_REPO, pointing it out the root of your local Maven-2 repository, usually someplace like your $HOME/.m2/repository.

Debugging with Eclipse and Tomcat

Remote debugging of the Jetspeed Portal running on Tomcat requires that you start Tomcat up with debugging enabled. Here is a shell script that can be used to debug:

export JPDA_TRANSPORT=dt_socket
export JPDA_ADDRESS=8000
./catalina.sh jpda start
<p>A DOS script:</p>
set JPDA_TRANSPORT=dt_socket
set JPDA_ADDRESS=8000
catalina jpda start

From there, just follow the Eclipse documentation on how to remotely debug.