Develop with Eclipse
Use the Eclipse IDE to work on Hippo implementation projects.
Eclipse integrates with Maven to enable creating, building, running and debugging projects within the IDE.
Maven Integration for Eclipse
Maven Integration for Eclipse is required to work with Hippo projects in Eclipse. It comes pre-installed with the Eclipse for Java EE Developers package, which we recommend you use.
Freemarker Plugin for Eclipse
A Freemarker Plugin for Eclipse is available as part of the JBoss Tools Project and can be installed separately.
- Choose Help > Eclipse Marketplace.
- Search for "JBoss Tools".
- Choose Install.
- A tree of checkboxes will appear, uncheck all (by unchecking the root) except FreeMarker IDE.
Create a New Hippo Project
- Choose File > New > Maven Project.
- Optionally specify a non-default project location and/or a working set.
- Choose Next.
If this is the first time you create a Hippo project in Eclipse, you must first choose Configure..., then Add Remote Catalog and add the Hippo Maven repository:
Catalog File: https://maven.onehippo.com/maven2
- At Catalog choose Hippo.
Choose the archetype with Group Id org.onehippo.cms7 and Artifact Id hippo-project-archetype.The latest version of the archetype is automatically selected. To select an earlier version, uncheck Show the last version of Archetype only.
Enter a Group Id, Artifact Id, Version and Package for the new project.In Eclipse Mars you may also need to manually override the default values for the groupId, artifactId, version and projectName properties in the list under Properties available from archetype. This appears to be a bug in Maven Integration for Eclipse.
Choose Finish to generate the project.
Import an Existing Hippo Project
- Choose File > Import....
- Select Maven > Existing Maven Projects.
- Choose Next.
- Browse to the root directory of your project.
- Optionally add the project to a working set.
- Choose Finish to import the project.
Run or Debug a Hippo Project on a Tomcat Server within Eclipse
- First prepare a local Tomcat 8 installation:
- Download and Tomcat 8 and install it on your development machine. Do not run it yet, you will do this from within Eclipse later on.
- Build and run your Hippo project from the command line. Once it is running, stop it by pressing Ctrl+C.
- Copy the following files from your project's target/tomcat8x folder to your Tomcat installation (use the exact same folder hierarchy and replace existing files):
- shared/lib/*.jar except your project's bootstrap-content jar (e.g. myhippoproject-bootstrap-content-1.0.0.jar).
- Configure the Tomcat Server in Eclipse:
- Choose File > New > Other, select Server > Server and choose Next.
- Select Apache > Tomcat v8.0 Server and choose Next.
- Set Tomcat installation directory to the location of your local Tomcat installation prepared in step 1, and choose Next.
- Select the cms, essentials and site modules of your project in the Available column and add them to the Configured column, and choose Finish.
- Choose Window > Show View > Servers.
- Double-click to open Tomcat v8.0 Server at localhost.
- Under General Information click on Open launch configuration.
Select the Arguments tab and add the following arguments to those already there in the VM arguments box (use the appropriate paths for your situation):
-Dderby.stream.error.file=”/Users/hippo/apache-tomcat-8.0.23/logs/derby.log” -Dlog4j.configuration=file:/Users/hippo/workspace/myhippoproject/conf/log4j-dev.xml -Dproject.basedir=/Users/hippo/workspace/myhippoproject -Drepo.path=/Users/hippo/workspace/myhippoproject/storage -Xms256m -Xmx1024m
- Under Server Locations select the option Use Tomcat installation (takes control of Tomcat installation).
- Under Timeouts raise the Start timeout to 200.
- Choose File > Save to save the server configuration.
- Configure the cms application to include the bootstrap-content module in its deployment assembly:
- Right click on your project's cms module (e.g. myhippoproject-cms) and select Properties.
- Select Deployment Assembly.
- Click on Add.
- Select Project and click on Next.
- Select your project's bootstrap-content module (e.g. myhippoproject-bootstrap-content) and click on Finish.
- Click OK.
- Configure the bootstrap-webfiles module not to be auto-redeployed by Eclipse (web files are automatically synchronized by the Hippo application):
- Right click on your project's bootstrap-webfiles module (e.g. myhippoproject-bootstrap-webfiles) and select Properties.
- Select Deployment Assembly.
- There should be two entries: src/main/java and src/main/resources. Remove both entries so the list is empty.
- Click OK.
- To run your Hippo project on the Tomcat server click on the Run icon in the Servers view.
- To debug your Hippo project on the Tomcat server click on the Debug icon in the Servers view.
If Tomcat won't start because of:
Then you either did not copy the shared folder correctly, or you did not copy the conf/catalina.properties correctly.
Debug a Hippo Project Running Outside Eclipse
If you choose to run your Hippo project from the command line, you can still use Eclipse for debugging by attaching its debugger to the running application.
- Choose Run > Debug Configurations...
- Select Remote Java Application and click on the New launch configuration icon in the top left corner of the dialog.
- Enter a Name for this debug configuration.
- On the Connect tab, at Project browse to the project you want to debug. Typically this is the site module, e.g. myhippoproject-site.
- Make sure Port is set to 8000.
- Choose Apply to save the debug configuration.
- Choose Debug to attach de Eclipse debugger to the running application.
If you now set breakpoints in your code Eclipse will open the debug perspective when your application executes that code.