Clojure with SAP Hybris Commerce
As you know SAP Hybris Commerce has already supported to create extensions with Scala and Groovy by providing template extensions. If you want to use Scala for SAP Hybris Commerce, you can easily create an extension with yscala template and then SAP Hybris Commerce will handle to compile Scala code for you. But I also want to use Clojure with SAP Hybris Commerce
So, we will follow the same way to integrate Clojure with SAP Hybris Commerce. First of all we need to create a template extension, let’s call it yclojure, and also another extension to keep Clojure dependencies, provide some ant tasks, classpath entries to compile Clojure code for using in SAP Hybris Commerce, clojurenature.
Let’s start with clojurenature extension to provide Clojure dependencies and ant macro defination to compile given Clojure namespace with given classpath entries.
Then we will prepare yclojure extension to provide us right directory structure, clojurenature extension as dependency, initial Clojure namespace, and other properties to make sure our template extension works well with SAP Hybris Commerce.
And finally we can create a new extension with our yclojure template to write some Clojure code. So, I am going to create a new extension called clojurelib and write very simple Clojure code to use FlexibleSearchService.
Let’s create a new extension useclojure, add clojurelib extension as dependency and also write an unit test to make sure our Clojure code working as expected.
It’s all done. Now we have SAP Hybris Commerce platform with Clojure extension. You can find clojurenature and yclojure extension on GitHub.
monotect Software & IT Consulting provides SAP Hybris Commerce consultancy with many years of experience of software development, E-Commerce knowledge and the experience of SAP Hybris Commerce projects. You can contact us for all your questions about SAP Hybris Commerce and project phases.