Develop with Eclipse

This page describes how to use Eclipse IDE for Bloomreach Content development. These instructions reference a third-party tool. Bloomreach maintains this documentation as a best-effort resource and does not guarantee alignment with the latest Eclipse releases. For the most current installation and configuration steps, refer to the official Eclipse documentation.

Introduction

Goal

Use Eclipse IDE to develop, build, run, and debug Bloomreach Content projects.

Background

Eclipse provides Maven integration, allowing you to manage project creation, building, and debugging within the IDE.

Info: These instructions were verified with Eclipse Java EE IDE for Web Developers, version 2018-09 (4.9.0).

Eclipse Plugins

Maven Integration for Eclipse

Maven Integration for Eclipse (m2e) is required to work with Bloomreach Content projects. The Eclipse for Java EE Developers package includes this plugin by default. Use this package for compatibility.

Freemarker Plugin

To edit Freemarker templates, install the Freemarker Plugin from the JBoss Tools Project:

  1. Go to Help > Eclipse Marketplace.
  2. Search for "Freemarker".
  3. Under "Freemarker IDE from JBoss Tools", select Install.
  4. In the installation dialog, uncheck all options except FreeMarker IDE.

YEdit Plugin

Install YEdit to edit repository data YAML files.

  1. Go to Help > Eclipse Marketplace.
  2. Search for "YEdit".
  3. Select Install.

Create a New Bloomreach Content Project

  1. Go to File > New > Maven Project.

  2. Optionally set a custom project location or working set.

  3. Click Next.

    Hint: If this is your first Bloomreach Content project in Eclipse, select Add Archetype... and enter the following Maven archetype coordinates:
    Archetype Group Id: org.onehippo.cms7
    Archetype Artifact Id: hippo-project-archetype
    Archetype Version: 13.0.0 (or the latest version)
    Repository URL: https://maven.bloomreach.com/repository/maven2/ (or https://maven.bloomreach.com/repository/maven2-enterprise/ for enterprise licenses)

  4. In the Catalog field, select Nexus Indexer.

  5. Choose the archetype with Group Id org.onehippo.cms7 and Artifact Id hippo-project-archetype.

    Hint: Eclipse selects the latest archetype version by default. To use an earlier version, uncheck Show the last version of Archetype only.

  6. Click Next.

  7. Enter values for Group Id, Artifact Id, Version, and Package.

  8. Click Finish to generate the project.

Import an Existing Bloomreach Content Project

  1. Go to File > Import....
  2. Select Maven > Existing Maven Projects.
  3. Click Next.
  4. Browse to your project’s root directory.
  5. Optionally add the project to a working set.
  6. Click Finish to import the project.

Run or Debug a Bloomreach Content Project on a Tomcat Server within Eclipse

  1. Prepare a local Tomcat installation:
    1. Download Tomcat 9 and install it locally. Do not start Tomcat yet; you will launch it from Eclipse.
    2. Build and run your Bloomreach Content project from the command line. After verifying it runs, stop it with Ctrl+C.
    3. Copy the following files from your project's target/tomcat9x directory to your Tomcat installation, preserving the folder structure and replacing existing files:
      1. common/lib/*.jar
      2. shared/lib/*.jar (exclude your project's repository-data-development and repository-data-site-development jars, such as myproject-repository-data-development-1.0.0.jar and myproject-repository-data-site-development-1.0.0.jar)
      3. conf/context.xml
      4. conf/catalina.properties
  2. Configure the Tomcat Server in Eclipse:
    1. Go to File > New > Other, select Server > Server, and click Next.

    2. Select Apache > Tomcat v9.0 Server and click Next.

    3. Set the Tomcat installation directory to your prepared Tomcat location and click Next.

    4. In the Available column, select the cms, essentials, and site modules of your project and add them to the Configured column. Click Finish.

    5. Go to Window > Show View > Servers.

    6. Double-click Tomcat v9.0 Server at localhost to open its configuration.

    7. Under General Information, click Open launch configuration.

    8. In the Arguments tab, add the following VM arguments (adjust paths as needed):

      -Dderby.stream.error.file="/Users/hippo/apache-tomcat-9.0.13/logs/derby.log"
      -Dlog4j.configurationFile=file:/Users/hippo/workspace/myproject/conf/log4j2-dev.xml
      -Dproject.basedir=/Users/hippo/workspace/myproject
      -Drepo.path=/Users/hippo/workspace/myproject/storage
      -Xms256m -Xmx1024m
      
    9. Under Server Locations, select Use Tomcat installation (takes control of Tomcat installation).

    10. In Timeouts, set the Start timeout to 200.

    11. Go to File > Save to save the server configuration.

  3. Configure the cms application to include the repository-data-development module in its deployment assembly:
    1. Right-click the cms module (e.g., myproject-cms) and select Properties.
    2. Select Deployment Assembly.
    3. Click Add.
    4. Select Project and click Next.
    5. Select your project's repository-data-development module (e.g., myproject-repository-data-development) and click Finish.
    6. Click Apply and Close.
  4. Configure the site web application to include the repository-data-site-development module in its deployment assembly:
    1. Right-click the webapp module (e.g., myproject-webapp) and select Properties.
    2. Select Deployment Assembly.
    3. Click Add.
    4. Select Project and click Next.
    5. Select your project's repository-data-site-development module (e.g., myproject-repository-data-site-development) and click Finish.
    6. Click Apply and Close.
  5. Prevent Eclipse from auto-redeploying the repository-data-webfiles module (web files are synchronized by Bloomreach Content):
    1. Right-click the repository-data-webfiles module (e.g., myproject-repository-data-webfiles) and select Properties.
    2. Select Deployment Assembly.
    3. Remove the src/main/resources entry so the list is empty.
    4. Click Apply and Close.
  6. Set the context root of the site web application:
    1. Right-click the webapp module (e.g., myproject-webapp) and select Properties.
    2. Select Web Project Settings.
    3. Change the Context root from site to your project name (e.g., myproject).
  7. To run the project, click the Run icon in the Servers view.
  8. To debug the project, click the Debug icon in the Servers view.

Hint: Running your project this way enables IDE features such as automatic compilation and redeployment.

Info: These steps are based on 'Tutorial: setup Eclipse workspace for Hippo CMS' by Bart Vreeken.

Troubleshooting

Symptom

Tomcat fails to start with the following error:

java.lang.NoClassDefFoundError: Lorg/slf4j/Logger

Cause

Either the shared folder or the conf/catalina.properties file was not copied correctly.

Resolution

Verify that you copied the shared directory and conf/catalina.properties file from your project's target/tomcat9x directory to your Tomcat installation, preserving the folder structure.

Debug a Bloomreach Content Project Running Outside Eclipse

You can debug a project running from the command line by attaching Eclipse’s debugger:

  1. Go to Run > Debug Configurations...
  2. Select Remote Java Application and click the New launch configuration icon.
  3. Enter a name for the debug configuration.
  4. On the Connect tab, set Project to the module you want to debug (typically webapp, e.g., myproject-webapp).
  5. Ensure the Port is set to 8000.
  6. Click Apply to save the configuration.
  7. Click Debug to attach the Eclipse debugger to the running application.

When you set breakpoints in your code, Eclipse will switch to the debug perspective when those breakpoints are hit.

Share Feedback
Page: /build/development-tools/import-a-project-into-eclipse
Section: Build
Category *