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:
- Go to Help > Eclipse Marketplace.
- Search for "Freemarker".
- Under "Freemarker IDE from JBoss Tools", select Install.
- In the installation dialog, uncheck all options except FreeMarker IDE.
YEdit Plugin
Install YEdit to edit repository data YAML files.
- Go to Help > Eclipse Marketplace.
- Search for "YEdit".
- Select Install.
Create a New Bloomreach Content Project
-
Go to File > New > Maven Project.
-
Optionally set a custom project location or working set.
-
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/(orhttps://maven.bloomreach.com/repository/maven2-enterprise/for enterprise licenses) -
In the Catalog field, select Nexus Indexer.
-
Choose the archetype with Group Id
org.onehippo.cms7and Artifact Idhippo-project-archetype.Hint: Eclipse selects the latest archetype version by default. To use an earlier version, uncheck Show the last version of Archetype only.
-
Click Next.
-
Enter values for Group Id, Artifact Id, Version, and Package.
-
Click Finish to generate the project.
Import an Existing Bloomreach Content Project
- Go to File > Import....
- Select Maven > Existing Maven Projects.
- Click Next.
- Browse to your project’s root directory.
- Optionally add the project to a working set.
- Click Finish to import the project.
Run or Debug a Bloomreach Content Project on a Tomcat Server within Eclipse
- Prepare a local Tomcat installation:
- Download Tomcat 9 and install it locally. Do not start Tomcat yet; you will launch it from Eclipse.
- Build and run your Bloomreach Content project from the command line. After verifying it runs, stop it with Ctrl+C.
- Copy the following files from your project's
target/tomcat9xdirectory to your Tomcat installation, preserving the folder structure and replacing existing files:common/lib/*.jarshared/lib/*.jar(exclude your project'srepository-data-developmentandrepository-data-site-developmentjars, such asmyproject-repository-data-development-1.0.0.jarandmyproject-repository-data-site-development-1.0.0.jar)conf/context.xmlconf/catalina.properties
- Configure the Tomcat Server in Eclipse:
-
Go to File > New > Other, select Server > Server, and click Next.
-
Select Apache > Tomcat v9.0 Server and click Next.
-
Set the Tomcat installation directory to your prepared Tomcat location and click Next.
-
In the Available column, select the
cms,essentials, andsitemodules of your project and add them to the Configured column. Click Finish. -
Go to Window > Show View > Servers.
-
Double-click Tomcat v9.0 Server at localhost to open its configuration.
-
Under General Information, click Open launch configuration.
-
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 -
Under Server Locations, select Use Tomcat installation (takes control of Tomcat installation).
-
In Timeouts, set the Start timeout to 200.
-
Go to File > Save to save the server configuration.
-
- Configure the
cmsapplication to include therepository-data-developmentmodule in its deployment assembly:- Right-click the
cmsmodule (e.g.,myproject-cms) and select Properties. - Select Deployment Assembly.
- Click Add.
- Select Project and click Next.
- Select your project's
repository-data-developmentmodule (e.g.,myproject-repository-data-development) and click Finish. - Click Apply and Close.
- Right-click the
- Configure the
siteweb application to include therepository-data-site-developmentmodule in its deployment assembly:- Right-click the
webappmodule (e.g.,myproject-webapp) and select Properties. - Select Deployment Assembly.
- Click Add.
- Select Project and click Next.
- Select your project's
repository-data-site-developmentmodule (e.g.,myproject-repository-data-site-development) and click Finish. - Click Apply and Close.
- Right-click the
- Prevent Eclipse from auto-redeploying the
repository-data-webfilesmodule (web files are synchronized by Bloomreach Content):- Right-click the
repository-data-webfilesmodule (e.g.,myproject-repository-data-webfiles) and select Properties. - Select Deployment Assembly.
- Remove the
src/main/resourcesentry so the list is empty. - Click Apply and Close.
- Right-click the
- Set the context root of the site web application:
- Right-click the
webappmodule (e.g.,myproject-webapp) and select Properties. - Select Web Project Settings.
- Change the
Context rootfromsiteto your project name (e.g.,myproject).
- Right-click the
- To run the project, click the Run icon in the Servers view.
- 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:
- Go to Run > Debug Configurations...
- Select Remote Java Application and click the New launch configuration icon.
- Enter a name for the debug configuration.
- On the Connect tab, set Project to the module you want to debug (typically
webapp, e.g.,myproject-webapp). - Ensure the Port is set to
8000. - Click Apply to save the configuration.
- 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.