Suresh Lakku
Suresh Lakku

Reputation: 108

How to add dependencies in hybris using external-dependencies.xml file?

I'm newbie in hybris. I want to add maven dependency in hybris using external-dependencies.xml. But I can't see any of those jar(s) popped-in. Is it possible to get jar using external-dependencies.xml, if yes, please provide your response.

Upvotes: 7

Views: 13444

Answers (3)

Fernando Castilla
Fernando Castilla

Reputation: 709

The platform build is coupled with ant but you can use maven dependency (by default is disabled because all necessary libraries are shipped with the hybris).

In order to activate dependency management you have to follow these steps:

1) Make sure you have maven installed

2) Open the extensioninfo.xml from your extension 2.1) Include usemaven="true", for instance

enter image description here

3) Manage your dependencies inside "external-dependencies.xml" file (Inside this file is a regular maven pom.xml)

4) build your project (ant all). Hybris fetch required libraries into \lib and \web\webroot\WEB-INF\lib (Bear in mind that there are two "external-dependencies.xml", one for the core module and other for the web module)

Besides if you look the ant targets you will see there is one call "updateMavenDependencies". This task delete all jars in the lib folder and replaces them with the defined maven dependencies. In case you dont want maven to manage a few libraries you can handle this, creating a file in the root of your extension call "unmanaged-dependencies.txt".On this file you will include all libraries maven is not going to manage (therefore the ant target is not going to delete the libraries include on this file)

Upvotes: 23

thijsraets
thijsraets

Reputation: 582

My official answer: add usemaven="true" in your extensioninfo.xml (extension tag)

Upvotes: 5

Victor Sosa
Victor Sosa

Reputation: 398

I'm newbie too to Hybris but what I know is that whenever you need a dependency in a Hybris extension you need to add the name of the dependency to hybris/config/localextensions.xml and in extensioninfo.xml in the extension you want to add the dependency.

As for the Maven dependency, I'm not sure how to do that because I mostly use the out-of-the-box build system which is based on Ant.

Upvotes: -2

Related Questions