Search code examples
javaantimportsap-commerce-cloudimpex

How to specify a particular tenant as an argument with "ant importImpex" command?


I'm trying to import the impex files using ant importImpex -DSource=items.impex. This is successfully importing the impex files but the changes are reflecting in the MASTER tenant.

How to specify a particular tenant as an argument with ant importImpex command?

I have tried ant importImpex -DSource=items.impex -Dtenant=tenantID but it is not working.

Is there any other way?


Solution

  • There is no option to set tenant in this ant target.

    To know available options type ant -p. Note that in hybris 6.1 you'll see that the option to set impex path is -Dresource

    What you can do is use Bean Shell annotation in your impex file.

    Add this line before your INSERT_UPDATE statements :

    "#% Registry.setCurrentTenantByID(""tenantId"");"

    Then run the regular ant importImpex target and you'll see that the data are only in the tenant set in the annotation.