on 2022 Jan 26 8:15 AM
Hi! Does anyone know how to add third-party libraries into Hybris?
I had been using maven in previous projects before, and I got so used to just adding dependencies in the pom.xml. However, I'm not quite sure what is the "standard" way of doing this in Hybris (SAP Commerce).
Leads would be appreciated! Thank you!
Request clarification before answering.
There are two ways to include third-party Java libraries in SAP Commerce.
First option is placing *.jar files under lib folder. Two lib folder is available for this usage, one is located in extension's root folder (<extension folder>/lib) which is used for Global Libraries and the other one is located in web directory (<extension folder>/web/webroot/WEB-INF/lib) which is used for Web Module Libraries.
Second option is usage of external-dependendencies.xml file which is very similar to pom.xml file structure. Similar to lib folder, this file also exists in two places, one is in extension's root folder and the other is in web module (<extension folder>/web/webroot/WEB-INF). To be able to use this file you need to set usemaven="true" in extension's extensioninfo.xml.
Note that these two options cannot be used at the same time. You need to select one option which suits you. And when usemaven option is selected, you need to ensure that the server which builds the SAP Commerce has access to maven repositories so that the external libraries can be downloaded at the build time if needed.
For more details, you can read: https://help.sap.com/viewer/d0224eca81e249cb821f2cdf45a82ace/latest/en-US/120f6d7b89a745018cb28b5e34...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
simply put your libaries into \lib or \web\webroot\WEB-INF\lib. The build process will automatically look for them. You have to take care of the classpath in your IDE.
As an alternative add usemaven="true" in your extensioninfo.xml if you want to use maven.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.