How to utilize build tools in SAP Hybris commerce
Published on June 13, 2018
I am writing this blog post to give a bird’s eye view of different build tools used in SAP Hybris commerce and its responsibilities and how does it fit in the overall build process without getting into too much detail.
SAP Hybris Commerce uses a number of build tools for automating tasks like code generation, copying, parsing files and managing external library dependencies.
The below tools are used
- Apache Ant
- Apache Maven
<target name="extgen" description="Runs extgen"> <callback extname="" target="before_extgen"/> <extgen_generate/> <callback extname="" target="after_extgen"/> </target>
Apache Maven is a build automation tool which is responsible for building the software and managing its dependencies. The main use of Maven in Hybris Commerce is to manage its external library dependencies.
All the required external library dependencies for an extension are defined in external-dependencies.xml file inside the extension directory. Based on the purpose there are two possibilities which are defined in the below table:
|Dependencies defined in||Purpose||Path where the libraries are added to|
|<extension folder>/external-dependendencies.xml||Libraries for Global classpath||<extension folder>/lib|
|<extension folder>/web/webroot/WEB-INF/external-dependendencies.xml||Libraries for Web module of the extension||<extension folder>/web/webroot/WEB-INF/lib|
Apart from this, Maven is also used for the creation of Hybris Datahub extensions.
Gradle is a modern build management tool which supports a range of programming languages including Java.
This tool is mainly used for installing recipes in Hybris Commerce. Recipe is a new concept introduced with SAP Hybris Commerce 6 to automate the installation of different flavors (B2C, B2B) and different accelerators (Marketplace, China) and different functionalities (CPQ, OMS) during the setup.
Basically, upon doing a recipe installation, it will introduce a list of predefined extensions in localextensions.xml and introduce a list of properties in local.properties file. Optionally tasks related to starting the server (this is already available in the Out of the Box recipes) and creating build images for deployment can be specified in our custom gradle scripts.
Higher level representation of the responsibilities of different build tools in SAP Hybris Commerce