Hi, 
 
Using Jetty has dramatically increased out performance in terms of
debugging using AppFuse 1.9.3 MVC. 
 
We use the ant task below. Basically it puts together a full web
application under %project_home%/${webapp.name}. 
 
Changes in class files are automatically picked up by Jetty. Note,
however, that changes in JSP pages are not automatically picked up.
Also, Log4j logs are NOT outputted to console. 
 
 
 

Getting started 


*       Make sure you have Eclipse set to build class files
automatically. Make sure 'Build Automatically' is ticked under the
Project menu. This means that Eclipse will auto-compile your Java source
files (everything specified in the project build path) when you save
your changes. This allows compiled Class files to be dynamically
reloaded whenever changes are made to the source. 

*       Download <http://dist.codehaus.org/jetty/jetty-5.1.x/>  version
5.x of Jetty. This is needed for access to the Jar files and is the
embedded version that the plugin uses. 

*       Install the Jetty Launcher plugin from within Eclipse. Help ->
Software Updates -> Find and Install -> select 'Search for new features
to install' -> New Remote Site Name is Jetty URL:
http://jettylauncher.sourceforge.net/updates/
<http://jettylauncher.sourceforge.net/updates/>  -> Finish -> Choose yes
when asked to restart workbench. 

*       Now run the Jetty Ant task. This will copy all needed files for
the web application into the directory ./${project_name} under your
project root in your workspace. The directory that the task creates is
configured in properties.xml. 

*       Refresh the project in Eclipse so that Eclipse knows the new
directory is available. 


Now you are ready to launch Jetty and give it a try. 

    * Within Eclipse, select/mark the project node in package explorer. 

*       From the Eclipse menu: Run -> Debug... -> Select Jetty Web 

*       Select the 'New launch configuration' button (top left) 

*       Name the new configuration something useful. Many of the fields
should be automatically pre-populated. 


Now fill out the runtime options 


*       Main tab -> Project should be the project you want to launch.
Jetty Home points to the where you extracted Jetty 5.x to on your local
machine. Select 'Use Options'. The webapp root dir is the the local
directory created by the Ant task (the placeholder for ${webapp.name}.
e.g. myWebApp). The context name is URL path that the application will
run as (e.g. /myWebApp). Use 127.0.0.1 as the http host, choose
something suitable for the port (perhaps 8080). 

*       Arguments tab -> Jetty does not use log4j by default. 
*       Classpath tab -> Should be automatically populated. You still
need to add, under User Entries, tools.jar (from ${JAVA_HOME} folders),
and your DB driver jar file. 

The above should work fine. There can be made improvements to the script
and getting log4j working. 
 
Enjoy,
Jon
 
 
==== build.xml  - start=======================
 
 <target name="jetty" depends="copy-resources, compile-web,compile-jsp"
description="Package for Jetty">
     <mkdir dir="${jetty.dir}"/>
 
     <!-- If Servlet 2.4, uncomment the <dispatcher> elements in
filter-mappings -->
        <if>
            <or>
                <isset property="convert.to.jsp2"/>
            </or>
            <then>
                <replaceregexp flags="g"
                    file="${webapp.target}/WEB-INF/web.xml"
                    match='&lt;!--dispatcher&gt;'
                    replace='&lt;dispatcher&gt;'/>
                <replaceregexp flags="g"
                    file="${webapp.target}/WEB-INF/web.xml"
                    match='&lt;/dispatcher--&gt;'
                    replace='&lt;/dispatcher&gt;'/>
                <property name="jstl.final.dir"
value="${jsp2.jstl.dir}"/> 
            </then>
            <else>
                <property name="jstl.final.dir" value="${jstl.dir}"/>
            </else> 
        </if>
        <echo>Preparing tomcat-context.xml for inclusion in war</echo>
        <!-- Copy tomcat-context.xml file to context.xml -->
        <if>
            <and>
                <isset property="tomcat5"/>
                <not><isset property="tomcat5.5"/></not>
            </and>
            <then>
                <copy tofile="${webapp.dist}/context.xml"
                    file="metadata/conf/tomcat-context.xml"
overwrite="true">
                    <filterset refid="db.variables"/>
                </copy>
            </then>
            <elseif>
                <isset property="tomcat5.5"/>
                <then>
                    <copy tofile="${webapp.dist}/context.xml"
                        file="metadata/conf/tomcat-context-5.5.xml"
overwrite="true">
                        <filterset refid="db.variables"/>
                    </copy>
                </then>
            </elseif>
        </if>
   
        <!-- Copy .properties files in src tree to build/web/classes -->
        <copy todir="${build.dir}/web/classes">
         
            <fileset dir="src/web">
                <include name="**/*.properties"/>
                <include name="**/*.xml"/>
            </fileset>
        </copy>
    
     <!-- scripts, images, some jsps, properties -->
        <copy todir="${jetty.dir}"> 
      <fileset dir="${webapp.target}" excludes="**/web.xml"/>
     </copy>
     <!-- the all important web.xml file -->
     <copy file="${webapp.target}/WEB-INF/web.xml"
tofile="${jetty.dir}/WEB-INF/web.xml"/>
    
     <!-- web tier, compiled class file -->
     <copy todir="${jetty.dir}/WEB-INF/classes">
      <fileset dir="${build.dir}/web/classes">
       <exclude name="**/database.properties"/>
      </fileset>
     </copy>
    <copy todir="${jetty.dir}/WEB-INF">
      <fileset dir="${build.dir}/dao/gen/META-INF">
      <include name="*.xml"/>
      </fileset>
     <fileset dir="${build.dir}/service/classes/META-INF">
      <include name="*.xml"/>
     </fileset>
     </copy>
     
     <copy file="${clickstream.jar}" todir="${jetty.dir}/WEB-INF/lib"/>
        <copy file="${dwr.jar}" todir="${jetty.dir}/WEB-INF/lib"/>
        
     <copy todir="${jetty.dir}/WEB-INF/lib">
      <fileset dir="${commons.dir}">
       <include name="*.jar"/>
      </fileset>
     </copy>
     
     <copy todir="${jetty.dir}/WEB-INF/lib">
      <fileset dir="${spring.dir}">
       <include name="*.jar"/>
      </fileset>
     </copy>
     
     <copy todir="${jetty.dir}/WEB-INF/lib">
      <fileset dir="${jstl.final.dir}/lib">
       <include name="*.jar"/>
      </fileset>
     </copy>
        
     <copy todir="${jetty.dir}/WEB-INF/lib">
      <fileset dir="${javamail.dir}">
       <include name="*.jar"/>
      </fileset>
     </copy>
        
 
     
     <copy file="${log4j.jar}" todir="${jetty.dir}/WEB-INF/lib"/>
        <copy file="${strutsmenu.jar}"
todir="${jetty.dir}/WEB-INF/lib"/>
        <copy file="${database.jar}" todir="${jetty.dir}/WEB-INF/lib"/>
        
       <copy todir="${jetty.dir}/WEB-INF/lib">
          <fileset dir="${displaytag.dir}">
           <include name="*.jar"/>
          </fileset>
        </copy>
                  
     <copy file="${hibernate.jar}" todir="${jetty.dir}/WEB-INF/lib"/>
        
       <copy todir="${jetty.dir}/WEB-INF/lib">
          <fileset dir="${hibernate.dir}/lib">
           <include name="*.jar"/>
          </fileset>
        </copy>
     
       <copy todir="${jetty.dir}/WEB-INF/lib">
          <fileset dir="${spring.dir}">
           <include name="*.jar"/>
           <exclude name="mock.jar"/>
          </fileset>
        </copy>
           
     <copy file="${sitemesh.jar}" todir="${jetty.dir}/WEB-INF/lib"/>
        
       <copy todir="${jetty.dir}/WEB-INF/lib">
          <fileset dir="${velocity.dir}">
           <include name="*.jar"/>
          </fileset>
        </copy>
           
     
        
     <copy file="${urlrewrite.jar}" todir="${jetty.dir}/WEB-INF/lib"/>
        
       <copy todir="${jetty.dir}/WEB-INF/lib">
          <fileset dir="${lucene.dir}">
           <include name="*.jar"/>
          </fileset>
        </copy>
       <copy todir="${jetty.dir}/WEB-INF/lib">
          <fileset dir="${mysql.dir}">
           <include name="*.jar"/>
          </fileset>
        </copy>
     
      <copy todir="${jetty.dir}/WEB-INF/lib">
          <fileset dir="${country.dir}">
           <include name="*.jar"/>
          </fileset>
        </copy>
 
     <copy file="${pmd.dir}/lib/saxpath-1.0-fcs.jar"
todir="${jetty.dir}/WEB-INF/lib"/>
     
      <!-- business layer jars -->
     <copy file="${dist.dir}/${webapp.name}-dao.jar"
todir="${jetty.dir}/WEB-INF/lib"/>
     <copy file="${dist.dir}/${webapp.name}-service.jar"
todir="${jetty.dir}/WEB-INF/lib"/>
    </target>

==== build.xml  - end=======================
 
==== properties.xml  - start=======================
<!-- Properties for Jetty task -->

<property name="jetty.dir" value="${basedir}/${webapp.name}"/>

==== properties.xml  - end=======================
 

________________________________

From: Anthony Presley [mailto:[EMAIL PROTECTED] 
Sent: 08 March 2008 17:26
To: users@appfuse.dev.java.net
Subject: [appfuse-user] Speed up Development Cycles....


All:

Ok, it's happened.  Our source code tree has grown, and our development
cycle is now taking a while .... which is killing our productivity.  I
can't imagine we're the only shop that ends up with this cycle:

  - Develop new code / tests / etc... (say, 10 mins - 30 mins)

  - Compile (say, 10 - 15 seconds)
  - Shutdown Tomcat (say, 2 seconds)
  - War (say, 30 - 45 seconds)
  - Deploy (say, 30 - 45 seconds)
  - Startup Tomcat (say, 10 - 20 seconds)
  - Wait on page to reload (say, 8 - 20 seconds)

  - Total deployment time:  90 - 145 seconds

Assuming my team does this 20 - 24 times a day (probably closer to 2 - 4
times that number), we're watching the screen scroll by for about 30 -
45 minutes a day.  Yikes!  Like 10% of the day, swoosh, gone!  Now, one
possibility is certainly to upgrade the machines, which we can do to
some extent.  But what else can we reasonably do, with the software?

We're using appfuse 1.9 with Spring MVC, Hibernate, and Postgresql ...
deploying with JDK 1.6 (Sun), and Tomcat 5 (and 6, depending on the
developer).

Some thoughts we're throwing around, without moving away from AppFuse
completely:

  - Hot reloads of Tomcat.  I'm old-school and haven't played with this
since Tomcat 4, where it only sometimes worked.  And sometimes it
completely hung.  Is it better now?
  - Does Jetty give us anything new (I seem to recall reading that Jetty
was not any faster than Tomcat)?
  - Migrate to AppFuse 2.  I don't know that this gives us anything,
other than integration with an IDE, but ....
  - Integrate with IDE or Eclipse, possibly using their internal Tomcat
would make deployment faster?

Any other ideas?  What are you guys / gals doing to speed up
development?


--
Anthony


________________________________

This email has been scanned by Netintelligence
http://www.netintelligence.com/email

________________________________



BiP Solutions Limited is a company registered in Scotland with Company Number 
SC086146 and VAT number 38303966 and having its registered office at Park 
House, 300 Glasgow Road, Shawfield, Glasgow, G73 1SQ 
****************************************************************************
This e-mail (and any attachment) is intended only for the attention of the 
addressee(s). Its unauthorised use, disclosure, storage or copying is not 
permitted. If you are not the intended recipient, please destroyall copies and 
inform the sender by return e-mail.
This e-mail (whether you are the sender or the recipient) may be monitored, 
recorded and retained by BiP Solutions Ltd.
E-mail monitoring/ blocking software may be used, and e-mail content may be 
read at any time. You have a responsibility to ensure laws are not broken when 
composing or forwarding e-mails and their contents.
****************************************************************************

Reply via email to