How to Setup Source Code Maintenance for a Stock Zimbra Binary Install Using Eclipse or Command Line

How to Setup Source Code Maintenance for a Stock Zimbra Binary Install Using Eclipse or Command Line

How to Setup Source Code Maintenance for a Stock Zimbra Binary Install Using Eclipse or Command Line

Author - Sing Koo

Zimbra open source is available to the public in binary (ready to install) distribution as well as in source distribution. It is always tempting to jump start the installation and run Zimbra as soon as possible. When it comes time to tweak the Zimbra server, most administrators resort to seek out the corresponding scripts and make changes and adjustments to the scripts. Operational scripts can be found in /opt/zimbra/bin. However, not all options are available for customization. After studying the Zimbra community site, the general advise for customization is to do their own build using source code distribution. The alternative is to use what the binary distribution offers. What if you have installed a binary distribution and decided to customize the code. Here is a procedure that enables you to do just that.

To begin, you need to determine the release number of your binary. The following steps provide you the "how to" in setting up a development environment so that you can implement the changes to the Zimbra server source code.

1. Obtain the source code of your binary distribution using Perforce (refer to Zimbra Wiki using Perforce)

     http://wiki.zimbra.com/wiki/Building_Zimbra_using_Perforce
   This process will enable you to connect your development system with the Zimbra Community's Perforce code repository and obtain the specific release of the source code tree.
    For example, if you specify GNR-609, the directory "/home/public p4/GNR-609" will contain all the sub-directories of  Zimbra release 6.0.9.
    The sub-directory  "ZimbraSever" contains all the files that are required for you to make modifications to the server source files and to 
    create the new JAR file for deployment. If you are not using an IDE to maintain the code, you can use your favorite editor and ANT to rebuild the JAR file. This assumes 
    that you have already setup your JAVA_HOME and ANT_HOME in your shell environment.
    Continue on with step 2 if you want to use IDE to setup your interactive development environment.
    

2. Install Eclipse in your operating system if you have not already done so. Eclipse is available from http://www.eclipse.org/.

3. Setup a new Zimbra server project and set your project directory somewhere similar to the following directory path:

    /home/public/p4/GNR-609/ZimbraServer

4. You are now ready to launch Eclipse and open the "ZimbraServer" project to make changes.

5. Upon completion, you can right mouse click on build.xml under WebRoot of your "ZimbraServer" project in the "Package Explorer" window. From it, select "Run AS -> Ant Build". This will initiate the compilation of modified source code and will create the zimbrastore.jar file. It is located in the "ZimbraServer" sub-directory.

6. Copy the zimbrastore.jar to the Jetty deployment directory:

    cp  /home/public/p4/GNR-609/ZimbraServer/build/zimbrastore.jar /opt/zimbra/jetty/webapps/zimbra/WEB-INF/lib
    If your development machine is different than the "ZimbraServer" host, you may need to copy the new JAR file to the target directory using SCP, etc.

7. Restart Jetty at the "ZimbrServer" host.

   zmcontrol restart
  

8. The "ZimbraServer" should begin to run using the newly created JAR file.

Similar process can be applied to other ZimbraJAVA source directory such as ZimbraCommon.

Jump to: navigation, search