Intershop Commerce Management 11+, comes with significant changes related to dependencies and cartridge ordering. The most important changes are explained here in detail together with some practical examples.
In Intershop Commerce Management 11+, the cartridgelist.properties file is no longer used. Instead, a short list of feature cartridges can be declared (system property is.cartridges) to define the root cartridges of the application server. All other cartridges are not registered explicitly, but are resolved via their dependencies on each other. Therefore, the dependencies play an important role and are used to determine the order of the cartridges. For example, if cartridge C1 is dependent on cartridge C2 (C1 → C2), cartridge C2 is loaded and placed before cartridge C1 on the server's cartridge list. If two or more cartridges have the same "level or layer", then the cartridges are listed by name.
Thus, it is necessary to explicitly declare all dependencies on other cartridges that are necessary to compile the code as well as at runtime. Missing dependencies at compile time are quite easy to detect since they are immediately printed out on the console window. Missing runtime dependencies are more difficult to find. If a runtime dependency is missing, it may happen that used components are not initialized yet.
Especially if a component (defined via component framework) is used, the cartridge where the component is defined must be declared as a runtime dependency in the build.gradle(.kts) file.
Example: Extending the Webshop REST API with a custom sub resource that is wired below standard Product Resource via a component file:
<components xmlns="http://www.intershop.de/component/2010" scope="global"> <fulfill requirement="subResource" of="intershop.WebShop.RESTAPI.ProductResource"> <instance with="CustomProductSubResource"> ... </instance> </components>
The component intershop.WebShop.RESTAPI.ProductResource
is defined in instances.component
of cartridge app_sf_rest (business). So, this cartridge has to be added to the build.gradle(.kts)
as a dependency. If only the mentioned component is used and no other code artifacts from this cartridge, the dependency can be a runtime dependency:
// access 'intershop.WebShop.RESTAPI.ProductResource' in component file cartridgeRuntime 'com.intershop.business:app_sf_rest
As mentioned earlier, all dependencies on other cartridges must be specified to ensure that the correct cartridge order is generated. This leads to a higher number of dependencies, which can also lead to problems when cyclic dependencies are created or unwanted dependencies are created between different application types. To prevent this, it is important to follow a few basic rules.
Cartridges (e.g., ac-cartridges) should not add themselves to application-specific cartridge lists via app-extension.component
, especially when the cartridge should be added to multiple application types. The assignment of these cartridges should be done in an apps.component file of an as-cartridge (application suite cartridge), e.g., as_headless, as_backoffice, as_sldsystem. The as-cartridge also integrates multiple application types to form a complete business scenario. as-cartridges must not be referenced directly except for feature cartridges (ft_) or other application suite cartridges.
See Concept - Cartridge | Architectural Layers and Cartridge Types.
Example of an earlier approach (ICM 7.10):
ac_myconnectorcartridge/src/main/resources/resources/ac_myconnectorcartridge/components/app-extension.component
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <components xmlns="http://www.intershop.de/component/2010" scope="global"> <fulfill requirement="selectedCartridge" of="intershop.SLDSystem.Cartridges" value="ac_myconnectorcartridge"/> <fulfill requirement="selectedCartridge" of="intershop.EnterpriseBackoffice.Cartridges" value="ac_myconnectorcartridge"/> </components>
Example of the new approach (ICM 11):
as_sldsystem/src/main/resources/resources/as_sldsystem/components/apps.component
<?xml version="1.0" encoding="UTF-8"?> <components xmlns="http://www.intershop.de/component/2010"> ... <fulfill requirement="selectedCartridge" of="intershop.SLDSystem.Cartridges" value="ac_myconnectorcartridge"/> ... </components>
as_backoffice/src/main/resources/resources/as_backoffice/components/apps.component
<?xml version="1.0" encoding="UTF-8"?> <components xmlns="http://www.intershop.de/component/2010"> ... <fulfill requirement="selectedCartridge" of="intershop.EnterpriseBackoffice.Cartridges" value="ac_myconnectorcartridge"/> ... </components>