Tomcat-Plugin

A loader derivative from the standard Apache Tomcat WebappLoader. It tries first to locate a file WEB-INF/eclipse-classpath.conf and read classpath entry URLs from that file. If that does not succeed, it tries to locate a .classpath file in the context directory or any parent directory and construct the classpath from that.

To build from source, compile project and export as JAR file. Place the resulting JAR into the $TOMCAT_HOME/server/lib directory. Alternatively, you may copy the generated .class file and the mbeans-descriptors.xml in a directory corresponding to the package name in $TOMCAT_HOME/server/classes.

In a future version, the loader will be made compatible with the tomcat launcher plugin.

When searching the .classpath file, it stops at the first .classpath file found or when the number of maximum ascends is exceeded. It assumes the file to be compliant with the file structure created by Eclipse version 3.3. It may work with earlier or later versions as well.

The location the .classpath file is found is assumed to be an Eclipse project and the directory above that will be assumed to be an Eclipse workspace. The loader will recursively add libraries and output directories from the web app's project and any referenced project to the web apps classpath.

Limitations: When the eclipse .classpath feature is used, the loader is not able to resolve libraries referenced as classpath entries. It may have issues with jars located outside the workspace. Detection of paths outside the workspace may be broken for non-windows systems. Does not work with projects located outside of the workspace. Might have problems with linked resources.

Usage: Create a context file the references this loader instead of the default loader.

<Context path="/test"
	reloadable="true"
	docBase="C:\Data\Eclipse\kindergarten\test\Webcontent"
	workDir="C:\Data\Eclipse\kindergarten\tc-test\work">
	<Loader
		className="net.sf.kindergarten.tomcat.EclipseLoader"
		delegate="false" reloadable="true"
		useSystemClassLoaderAsParent="false"
		maximumAscend="1"
		classpathFile="WEB-INF/eclipse-classpath.conf"
	/> 
</Context>
		

The jar file containing the loader must be added to the server's classpath, e.g. by placing it into the $TOMCAT_HOME/server/lib directory.