Q: Running deployServer gradle task with custom domainsplittings.xml and urlrewriterules.xml fails After adding our custom urlrewriterules.xml and domainsplittings.xml files to our cartridge in "staticfiles\share\system\config\cluster\" folder we can no longer execute deployServer gradle task. Task fails with following error:
* What went wrong:
Execution failed for task ':init_project:deployShareFiles'.
> Could not deploy files of task :init_project:deployShareFiles
   > Task :init_project:deployShareFiles: Resource 'C:\Work\Project\intershop-ci\sources\projects\webshop\build\server\share\system\config\cluster\domainsplittings.xml' already defined for Task :bc_urlrewrite:deployShareFiles
   > Task :init_project:deployShareFiles: Resource 'C:\Work\Project\intershop-ci\sources\projects\webshop\build\server\share\system\config\cluster\urlrewriterules.xml' already defined for Task :bc_urlrewrite:deployShareFiles

Does anybody knows why is that and how can we add our own url rewrite rules without editing those files every time after deployServer (which copy system rules from bc_urlrewrite cartridge)?
Thank you for you answers!

A: Please take a look at Cookbook - Deployment Tools ICM 7.x / 23 Recipe: Replace a File Deployed by Another Component:

Replacing a file is a drastic measure. Consider using content filters to alter an existing file instead of providing your own version, because it eases future migrations.

It looks like you can't use the configuration framework's environment specific files in order to overload the $IS_SHARE/system/config/cluster/domainsplittings.xml and $IS_SHARE/system/config/cluster/urlrewriterules.xml files (loaded with a fixed path, not via the configuration framework).
The error indicates that two different components (bc_urlrewrite vs. init_project) are trying to deploy the same target file. You've got two options:


*

*Use content filters in order to alter the existing files, see Cookbook - Deployment Tools ICM 7.x / 15 Recipe: Change Deployed File Content With Filters

*Resolve the conflict by excluding the file from the deployment of the original component bc_urlrewrite (provide custom deployment logic), see: Cookbook - Deployment Tools ICM 7.x / 14 Recipe: Provide Custom Deployment Configuration and Logic 
