You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by David Eisner <cr...@Glue.umd.edu> on 2000/05/09 21:41:01 UTC

Source Tree Organization

Hi.  I've read through the "Developing Applications With Tomcat"
guide.  It's very helpful.  I have two questions, though, regarding
source organization.

1) Section 4.1 indicates that the lib/ subdirectory contains 
   "JAR files that will be copied to the WEB-INF/lib deployment directory."
   However, both the sample build.xml in the document and the build.xml
   in the sample app copy the contents of the lib/ dir 
   to ${deploy.home}/lib, and not ${deploy.home}/WEB-INF/lib":


  <property name="deploy.home"    value="${tomcat.home}/webapps/${app.name}"/>
  ...
  <target name="prepare">
    <mkdir dir="${deploy.home}"/>
    <copydir src="web" dest="${deploy.home}"/>
    <mkdir dir="${deploy.home}/WEB-INF"/>
    <copyfile src="etc/web.xml" dest="${deploy.home}/WEB-INF/web.xml"/>
    <mkdir dir="${deploy.home}/WEB-INF/classes"/>
    <mkdir dir="${deploy.home}/WEB-INF/lib"/>
    <copydir src="lib" dest="${deploy.home}/lib"/>    <-- Is this correct?
    <mkdir dir="${javadoc.home}"/>
  </target> 
    

2) What is a reasonble way to handle the layout of applet code?  

   As a first pass, I have created an applet_src/ directory to my
   source tree, and I've added  
      
	 <mkdir dir="${deploy.home}/applet_classes"/>

   to the prepare target in build.xml, as well as a compile_applets target:

     <target name="compile_applets" depends="prepare" init="init">
        <javac srcdir="applet_src" destdir="${deploy.home}/applet_classes"
           classpath="${deploy.home}/applet_classes"
           debug="on" optimize="off" deprecation="off"/>
      </target>

   I then have codebase=applet_classes in my applet tags.

   This scheme was satisfactory while I was just playing around, but
   now I want to include an in-house library jar file, say "inhouse.jar",
   that is needed when I compile or run both servlets and applets.

   I could have one copy inhouse.jar in ${deploy.home}/WEB-INF/lib/ for the 
   servlets, and another copy in ${deploy.home}/applet_classes/ for the
   applets, but this seems kind of messy.  

   What's the "right" way to lay out the source directory and deployed 
   directory for an application that uses applets, and has jar files
   used by both applets and servlets?


Thanks.

-David 



-----------------------------------------------------
David Eisner            | E-mail: cradle@eng.umd.edu |
CALCE EPSC              | Phone:  301-405-5341       |
University of Maryland  | Fax:    301-314-9269       |
-----------------------------------------------------