Search code examples
sap-commerce-cloud

Unable to read configuration in impex


I am new to hybris. I am trying to use a key=value from project.properties in impex file.

I tried to copy the same key=value in my local.properties file as well. But it doesnt work.

My code :

project.properties/ local.properties

mykey=myvalue

coredata.impex

Insert_update User; uid[unique=true]; specialKey
;testuser;$mykey;

Where can I see any documentation for this


Solution

  • You are in the right direction, just missing one intermediate step of importing property into impex macro key using correct processor.

    1 - define your key in project or local properties file mykey=myvalue

    2 - Import above in impex macro using ConfigPropertyImportProcesser

    GenericItem[processor=de.hybris.platform.commerceservices.impex.impl.ConfigPropertyImportProcessor];pk[unique=true] 
    $config-key=$mykey
    

    3 - Run your impex with imported config macro

    INSERT_UPDATE User; uid[unique=true]; specialKey
    ;testuser;$config-key;
    

    NOTE : Moving key=value from project.properties to local.properties will not make a difference. The later file only has precedence over the values defined in project.properties and helps you to define/maintain/override such pairs as per application/deployment environment needs.