Skip to content

Setting up Eclipse

Stephan DeSouza edited this page Jan 19, 2022 · 6 revisions

Overview

This document details how to setup Eclipse Oxygen as your primary IDE for ZCS development.

Repository setup

Choose a location on your filesystem to checkout the source:

mkdir -p ~/Projects/Zimbra
cd ~/Projects/Zimbra

Clone the zm-zcs repository:

git clone [email protected]:Zimbra/zm-zcs.git
cd zm-zcs
git checkout develop

Create eclipse-ivysettings.xml inside the zm-zcs directory to hold the Ivy settings. This file is used by both Eclipse and Intelli-J in the Ivy Plugin to configure where it stores any dependencies downloaded or created during the build process.

Note: You may have to update the path to match your directory structure. Replace ${user.home} with your home directory if necessary. If you are not running on Mac OS X update the path prefix accordingly. The path MUST be absolute.

<?xml version="1.0" encoding="UTF-8"?>
<ivysettings>
<property name="httpclient.version" value="4.5.8"/>
<property name="httpclient.httpcore.version" value="4.4.11"/>
<property name="httpclient.async.version" value="4.1.4"/>
<property name="jetty.version" value="9.4.18.v20190429"/>
<property name="dom4j.version" value="2.1.1"/>
<property name="com.google.guava.version" value="28.1-jre"/>
<settings defaultResolver="chain-resolver" />
  <caches defaultCacheDir="${user.home}/.ivy2/cache"/>
  <resolvers>
    <chain name="chain-resolver" returnFirst="true">
      <filesystem name="local">
        <artifact pattern= "${user.home}/.zcs-deps/[organisation]/[module]/[module]-[revision].[ext]" />
        <artifact pattern= "${user.home}/.zcs-deps/[organisation]-[revision].[ext]" />
        <artifact pattern= "${user.home}/.zcs-deps/[organisation].[ext]" />
      </filesystem>
      <ibiblio name="maven" m2compatible="true" usepoms="false"/>
      <url name="zimbra">
        <artifact pattern="https://files.zimbra.com/repository/[module]/[artifact]-[revision].[ext]" />
        <artifact pattern="https://files.zimbra.com/repository/[module]/[artifact].[ext]" />
        <artifact pattern="https://files.zimbra.com/repository/[organisation]/[module]/[module]-[revision].[ext]" />
      </url>
    </chain>
    <!-- 'build-tmp' resolver is not part of the chain and is used only for packaging war files -->
    <!--
    <filesystem name="build-tmp">
      <artifact pattern="${build.tmp.dir}/[module]-[revision].[ext]" />
    </filesystem>
    <filesystem name="build-dist">
      <artifact pattern="${dist.dir}/[module]-[revision].[ext]" />
    </filesystem>
    -->
  </resolvers>
</ivysettings>

Clone the zm-mailbox repository and checkout the branch that you would wish to work for:

git clone [email protected]:Zimbra/zm-mailbox.git      # If you have a GitHub Account
git clone https://github.com/Zimbra/zm-mailbox.git  # Anonymous clone
git checkout develop

Compile the zm-mailbox repo using following link:

https://github.com/Zimbra/zm-mailbox/wiki/How-to-set-up-development-environment-for-zm-mailbox-repository

Note: If you wish to contribute back to the project you will need to fork the repository and submit pull requests from your fork.

Once cloned locally you can proceed to setup the Eclipse by following the process below:

Installing Ivy Plugin

  1. Open Eclipse Marketplace

    alt text

  2. Search for Apache IvyDE

    alt text

  3. Install Apache IvyDE

    Push the install button and confirm. alt text

    Update the radio button to I accept.. and push the Finish button to install IvyDE.

    alt text

    Push the install anyway button when prompted by the security warning.

    alt text

    Push the Restart Now button when prompted to finish the installation:

    alt text

  4. Update Ivy Settings

    Open the Eclipse Preferences menu:

    alt text

    Select the Ivy / Settings submenu:

    alt text

    Push the File System... button and navigate to ~/ProjectsZimbra/zm-zcs/ and select the eclipse-ivysettings.xml file:

    alt text

    Push the Open button to select the eclipse-ivysettings.xml.

    Note: If you don't have one of these files please re-read from the beginning and following the instructions titled: Repository setup

    alt text

    Push the Apply and Close button.

Creating a Workspace

  1. Open Eclipse Oxygen.

  2. Create a new empty workspace: Recommend using '~/Projects/Zimbra'.

    alt text

  3. Eclipse welcome screen

    alt text

    Close the welcome screen.

  4. Eclipse main window will then appear:

    alt text

Import zm-zcs into the workspace

  1. Add zm-zcs as a new Java project:

    alt text

    alt text

    Unselect Use default location push Browse and navigate to ~/Projects/Zimbra and select zm-zcs:

    alt text

    Push Open to complete the selection.

    alt text

    Push Finish to add the zm-zcs project to the workspace.

    alt text

Import zm-mailbox into the workspace

Import native into the workspace

  1. Add zm-mailbox/native as a new Java project:

    alt text

    alt text

    Push Browse and navigate to ~/Projects/Zimbra/zm-mailbox and select native:

    alt text

    Push Open to complete the selection.

    alt text

    Push Finish to add the zm-zcs project to the workspace.

    alt text

  2. Inform the Ivy subsystem of the new native project:

    Expand the native folder and right click on the ivy.xml file.

    alt text

    Push Finish to update the Ivy dependencies.

    alt text

Import common into the workspace

  1. Add zm-mailbox/common as a new Java project:

    alt text

    alt text

    Push Browse and navigate to ~/Projects/Zimbra/zm-mailbox and select common:

    alt text

    Push Open to complete the selection.

    alt text

    Push Next to update common project settings:

    alt text

    Push the Projects tab to switch to the common project settings:

    alt text

    The zm-mailbox/common project depends on the zm-mailbox/native project. Click on the Add... button and select the native project and push OK.

    alt text

    alt text

    Push Finish to add the zm-mailbox/common project to the workspace.

    alt text

  2. Inform the Ivy subsystem of the new common project:

    Expand the common folder and right click on the ivy.xml file.

    alt text

    Push the Add Ivy Library... menu option:

    alt text

    Push Finish to update the Ivy dependencies.

    alt text

Import soap into the workspace

  1. Add zm-mailbox/soap as a new Java project:

    alt text

    alt text

    Push Browse and navigate to ~/Projects/Zimbra/zm-mailbox and select soap:

    alt text

    Push Open to complete the selection.

    alt text

    Push Next to update soap project settings:

    alt text

    Select the soapdocs/src/java and soapdocs/src/java-test.

    alt text

    Right click and select Remove from Build Path

    alt text

    Push the Projects tab to switch to the soap project settings:

    alt text

    The zm-mailbox/soap project depends on the zm-mailbox/native and zm-mailbox/common projects. Click on the Add... button and select the native, and common projects and push OK.

    alt text

    alt text

    Push Finish to add the zm-mailbox/soap project to the workspace.

    alt text

  2. Inform the Ivy subsystem of the new soap project:

    Expand the soap folder and right click on the ivy.xml file.

    alt text

    Push the Add Ivy Library... menu option:

    alt text

    Push Finish to update the Ivy dependencies.

    alt text

Import client into the workspace

  1. Add zm-mailbox/client as a new Java project:

    alt text

    alt text

    Push Browse and navigate to ~/Projects/Zimbra/zm-mailbox and select client:

    alt text

    Push Open to complete the selection.

    alt text

    Push the Projects tab to switch to the client project settings:

    alt text

    The zm-mailbox/client project depends on the zm-mailbox/native, zm-mailbox/common, and zm-mailbox/soap projects. Click on the Add... button and select the native, common, and soap projects and push OK.

    alt text

    alt text

    Push Finish to add the zm-mailbox/client project to the workspace.

    alt text

  2. Inform the Ivy subsystem of the new soap project:

    Expand the soap folder and right click on the ivy.xml file.

    alt text

    Push the Add Ivy Library... menu option:

    alt text

    Push Finish to update the Ivy dependencies.

    alt text

Import store into the workspace

  1. Add zm-mailbox/store as a new Java project:

    alt text

    alt text

    Push Browse and navigate to ~/Projects/Zimbra/zm-mailbox and select store:

    alt text

    Push Open to complete the selection.

    alt text

    Push Next to update store project settings:

    alt text

    Push the Projects tab to switch to the store project settings:

    alt text

    The zm-mailbox/store project depends on the zm-mailbox/native, zm-mailbox/common, zm-mailbox/soap, and zm-mailbox/client projects.

    Click on the Add... button.

    alt text

    Select the native, common, soap, and client projects and push OK.

    alt text

    Push Finish to add the zm-mailbox/store project to the workspace.

    alt text

  2. Inform the Ivy subsystem of the new store project:

    Expand the store folder and right click on the ivy.xml file.

    alt text

    Push the Add Ivy Library... menu option:

    alt text

    Push Finish to update the Ivy dependencies.

    alt text

Configuring remote debugger

Eclipse supports debugging remotely over port 9999 to the Zimbra docker-zcs-dev-machine development container.

Note: These instructions assume that the docker-zcs-dev-machine container is running locally and is therefore accessible over localhost:9999. If this does not match your development environment please fill in the hostname and port that fits your environment.

  1. Adding a debug runtime configuration

    Click on the Run menu option and select Debug Configurations.

    alt text

    The Debug Configurations dialog will appear:

    alt text

    You will want to double-click on the Remote Java Applications item in the left column. This will create a new configuration which you may name.

    alt text

If you still find errors in workspace

Select Project, right-click properties

Go to Java Compiler and check compliance level is set to 1.8