‎2018 Dec 06 11:58 AM - edited ‎2024 Feb 03 5:15 PM
Hi Experts,
I am new to data hub and want to understand what is the proper way to deploy extensions. I am importing data from csv file to hybris 6.8
From what I understand, we do following steps:
1) We create mvn project by running mvn install:install-file command
2) Change extension xml, java source file and spring file as per requirement
3) mvn clean install
4) create jar files for raw, canonical and target extensions using jar -cf
5) manually copy the jar files from target folder and resource folder and paste it inside /opt/datahub/extensions
6) start tomcat
I want to understand following thing:
1) Are my steps correct or is there a better way to perform any of the mentioned step specially 5th step?
2) Is it better to create different maven product for different items? For example: different projects for Product, category, price, etc.
Request clarification before answering.
data hub is dead move on integration objects and create your own CSV to OData client. If you are going to use Data Hub (do the overlay maven build as a web app)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Attempted to provide a comment for Marcus's answer but it did not work, so I'm placing it here. The overall idea laid out in you question is correct but the specific steps are strange:
Step 1) mvn install:install-file adds a jar file to your local maven repo, typically located in $HOME/.m2/repository - it does not st new project. You need this command only to make the sdk and the archetype jars know to maven. The best way to st new project is to generate it from the maven artifact as it's described in https://help.hybris.com/1808/hcd/8ec7f04215344470af8851f271e84d29.html. Run that mvn archetype:generate command and make sure to use exact version from the install:install-file for the artifact and the sdk version, e.g.:
mvn archetype:generate -DarchetypeGroupId=com.hybris.datahub -DarchetypeArtifactId=datahub-extension-archetype -DarchetypeVersion=18.08.0-RC5 -DgroupId=test.datahub.ext -DartifactId=my-ext -DsdkVersion=18.08.0-RC5
It will prompt you for a couple of values and then generate the project in my-ext directory that you can import to IDE as a maven project. After that follow Markus's advice to make it simpler running/testing/debugging during development.
Step 4) No need to use jar -cf - mvn install executed from the my-ext directory creates the jar files in the target subfolders of the canonical. raw, and target modules inside the my-ext folder. It also places those jars to your local maven repo, so that they can be referenced by other maven projects. If you don't need to put them into the maven repo but simply need jar files: mvn package is sufficient. mvn clean simply deletes everything in the target directories to guarantee a clean build.
Step 5) that's correct but is needed only, if you're running a stand-alone Tomcat and want to test your extension with it. Otherwise, if you follow the Markus's answer you'll be able to start tomcat right in your IDE.
Hope this clarifies Markus's answer and helps you. You may need to learn a bit more about maven and its war overlays to understand what exactly is happening.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
setup your datahub project as war overlay
You can now build the datahub with all extensions "baked in"
you only need to deploy the new war
EDIT 2018-12-07
You stated as comment that you are "exploring how to import data as csv"
For that, the datahub is overkill (and also a dead end), a simple solution would be Hotfolder Imports, for which you can also find examples in the platform.
If you want to go for something more fancy and future proof, go for the new OData API, as already pointed out
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 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.