ZimletWritingTip

Revision as of 14:41, 17 April 2008 by P24t (talk | contribs) (Use _dev directory to cut down Zimlet development cycle)

ZCS 4.5 Article ZCS 4.5


Use _dev directory to cut down Zimlet development cycle

Typical software development involves the cycle fix -> build -> test -> fix ... It can be particularly cumbersome because Zimlets need to be deployed to the system in order to be tested. You might fix a typo in the xml, then need to deploy, possibly restart tomcat, then reload the browser to see the change.

There is a Zimlet dev directory to address this issue. It is a special location /opt/zimbra/tomcat/webapps/service/zimlet/_dev directory (replace /opt/zimbra/tomcat with your own Tomcat install directory). The Zimlets stored in the dev directory is read each time it's needed. For example, you can test the Hello World Zimlet by doing the following

 $ mkdir -p /opt/zimbra/tomcat/webapps/service/zimlet/_dev/com_zimbra_hello
 $ cp com_zimbra_hello.xml /opt/zimbra/tomcat/webapps/service/zimlet/_dev/com_zimbra_hello
      • ZCS 5.x note: Since Tomcat has been replaced with Jetty, the directories are at /opt/zimbra/mailboxd/webapps/service...... instead of /opt/zimbra/tomcat... (Thanks tdesorbaix)

Then simply reload the browser to load the new Zimlet in dev directory. Now you don't need to go through formal Zimlet lifecycle management of deploying and undeploying in order to test your new Zimlets. Each time you edit the contents in _dev directory, just reload the browser. When you are ready to deploy to the all the users, you can then create a zip bundle and deploy on the machines.

This feature is not supposed to be used on the production machines. Because the Zimlets in dev directory is read often it creates a lot of disk activity. Use dev directory only on your development box. Do not create dev directory on the production machines.

Javascript Debugger

Firefox has a browser extension named Firebug http://www.getfirebug.com/ which is phenomenal.

Jump to: navigation, search