But why removing all jars? I used it the last weeks without removing the
jars. Tomcat
(http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html)
(and also Jetty from my experience) look first at /WEB-INF/classes,
second /WEB-INF/lib/*.jar for the needed classes. This would also allow
the outside usage of the webapp.

Yes, that's try, but if you create a launch configuration for eclipse, it automatically adds all jars from your project to your classpath. So, you have all jars in the startup classpath and in WEB-INF/lib and this can cause problems as the class loaded via WEB-INF/lib is not the same as when loaded via the startup classpath.

You start your servlet container from inside Eclipse? I start it from command line and only attach for remote debugging.


So, this is a simple but working solution for eclipse.
And, as the compiled classes from eclipse are not copied to WEB-INF/classes
but to the usual configured output folder, you would get into problems
when the cocoon.jars are still in WEB-INF/lib.

I have set the eclipse output to WEB-INF/classes, so that changes aren't lost after servlet container restart. So I only need to restore the patched roles file. What about


<!-- Prepares the webapp to make it directly usable with the eclipse project -->
<target name="eclipse-webapp-prepare" depends="prepare, eclipse-webapp-delete-jars, eclipse-webapp-restore-roles"
description="Prepares the webapp directory to make it usable within Eclipse"/>


  <target name="eclipse-webapp-restore-roles">
      <copy file="${build.dest}/org/apache/cocoon/cocoon.roles"
tofile="${build.webapp}/WEB-INF/classes/org/apache/cocoon/cocoon.roles"
            overwrite="yes"/>
  </target>

  <target name="eclipse-webapp-delete-jars">
      <!-- delete all jars, they are already included in the project -->
      <delete>
          <fileset dir="${build.webapp}/WEB-INF/lib" includes="*.jar"/>
      </delete>
  </target>

Joerg



Reply via email to