Setting up IDE for Cartridge Development
You must make sure your IDE can manage all necessary dependencies before you start developing cartridges.
On this page
General
This tutorial provides an end-to-end guidance on how to set up your IDE for cartridge development using the out-of-the-box Simple Cartridge as a framework. When you finish the procedure, you'll be able to start modifying the cartridge in Eclipse, and see your changes on a live Tomcat deployment.
Prerequisites
Install the components mentioned below before proceeding.
Base Components
Component | Version |
---|---|
Java 8 | JDK 1.8.121 or later, or OpenJDK 8 or later |
Apache Maven | 3.5.2 or later
For the setup instructions for the base components, please refer to Quick Installation.
Development Components
Component | Version |
---|---|
Eclipse IDE for Java Developers | 2018-09 (4.9.0) or later |
Eclipse Tomcat Plugin | 9.1.2 or later |
Source code project simple-cartridge
from the Tribefire Enablement Cartridges (Maven variant)
(test and demo purposes) | artifacts
package version 2.0.82
.
You can find the link to the enablement cartridges source code on the Resources page.
Simple Cartridge Setup
- Make sure to have proper Maven configuration including
settings.xml
and environment variables as described in Quick Installation. - On your file system, create a new folder
enablement-cartridges
at a location of your choice and unzip the downloaded source code package there. - Navigate to the
artifacts
directory and open a terminal. - Perform a Maven build with the following command:
mvn clean install
This build may take a few minutes when run for the first time.
- Perform the Tribefire setup for the Simple Cartridge with the following command:
jinni setup-local-tomcat-platform setupDependency=tribefire.extension.enablement-maven.simple:simple-cartridge-setup#2.0 installationPath=yourInstallationPath deletePackageBaseDir=true
Make sure to replace yourInstallationPath
with the path to your actual installation directory. Example (Linux and macOS):
jinni.sh setup-local-tomcat-platform setupDependency=tribefire.extension.enablement-maven.simple:simple-cartridge-setup#2.0 installationPath=$HOME/tribefire-setups/simple-cartridge deletePackageBaseDir=true
- Start up Tribefire and inspect whether the Simple Cartridge functionality was set up correctly. On the Tribefire Services landing page, you should be able to find the following items:
- Models:
simple-data-model
simple-deployment-model
simple-service-model
- Service Domains:
SimpleInMemoryAccess
- Cartridges:
simple.cartridge
- Web Terminals:
SimpleWebTerminal
Eclipse IDE Settings
As we are using Eclipse as our IDE of choice, the following settings are specific to that particular IDE. If you want to use another IDE, make sure to set the equivalent settings to their correct values.
Eclipse Preferences
We strongly recommend that you use our prepared preferences file. To import it:
- Download the file bt_eclipse_preferences.epf from this page.
- In Eclipse, navigate to File -> Import -> General -> Preferences, select the file you downloaded in the previous step and mark the Import all checkbox. Then, click Finish.
Maven Settings
- In Eclipse, go to Window -> Preferences -> Maven.
- Click Installations -> Add.
- In the new window navigate to the root folder of your Maven-installation and click
Open
. - Click Apply.
- Click User Settings. Inspect whether the following requirements are met:
- The
settings.xml
file is found. - The path to Local Repository is parsed correctly.
Tomcat Settings
- In Eclipse, go to Help -> Eclipse Marketplace.
- Using Eclipse Marketplace, install the Eclipse Tomcat Plugin, version 9.1.2 or later .
If you experience errors during the download using Eclipse Marketplace, you can download the plugin directly from http://tomcatplugin.sf.net/.
- In Eclipse, go to Window -> Preferences -> Tomcat.
- Select Tomcat 8 and set the Tomcat home directory to the
host
directory of your Tribefire installation. - Click Apply.
- Expand the Tomcat entry in the Eclipse preferences and select JVM Settings.
- Using the drop down list on the top, make sure to have the correct JRE selected.
- Click Add next to the Append to JVM Parameters field.
- Enter the value
-Djava.util.logging.manager=com.braintribe.logging.juli.BtClassLoaderLogManager
and click OK. - Click the Add button again and enter the value
-Djava.util.logging.config.file=conf/logging.properties
, then click OK. - Click Apply and Close.
Maven Project Import
- In Eclipse, right-click within the Package Explorer panel and select Import.
- Choose Maven -> Existing Maven Projects.
- In the new window, click Browse and navigate to
path/to/enablement-cartridges/artifacts/simple-cartridge-parent
- Click Open and Finish. The included artifacts will now imported as Eclipse-projects. This may take a while.
After the import and build of the projects, Eclipse will throw two errors about missing artifacts at the
pom
file of thesimple-cartridge-setup
project. This is a known issue that won't harm you during the development.
Development
The Simple Cartridge is now ready to be extended with custom implementations. Most of the changes will be visible on Tribefire immediately. Other, more fundamental, changes may require a restart of the Tomcat server. Remember to run Tomcat in the Eclipse context.
Build
After you are done with your development, simply perform the Maven build again:
mvn clean install
What's Next?
When you have your IDE ready for cartridge development, it is time to start developing cartridges.
For more information, see Developing Cartridges.