I managed to make it works in the following way:
app/code/Vendor/Migration/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Migration\Reader\Map" type="Vendor\Migration\Reader\Map" />
<preference for="Migration\Reader\Groups" type="Vendor\Migration\Reader\Groups" />
<preference for="Migration\Reader\ClassMap" type="Vendor\Migration\Reader\ClassMap" />
<preference for="Migration\Reader\Settings" type="Vendor\Migration\Reader\Settings" />
</config>
app/code/Vendor/Migration/Reader/ClassMap.php
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Vendor\Migration\Reader;
/**
* Class ClassMap
*/
class ClassMap extends \Migration\Reader\ClassMap
{
/**
* Validating xml file
*
* @return $this
* @throws Exception
*/
protected function validate()
{
$mapFile = $this->config->getOption(self::MAP_FILE_OPTION);
$rootDir = dirname(__DIR__) . DIRECTORY_SEPARATOR;
$configFile = $rootDir . $mapFile;
if (!is_file($configFile)) {
return parent::validate();
}
$xml = file_get_contents($configFile);
$document = new \Magento\Framework\Config\Dom($xml, $this->validationState);
if (!$document->validate($rootDir .'etc/' . self::CONFIGURATION_SCHEMA)) {
throw new Exception('XML file is invalid.');
}
$this->xml = new \DOMXPath($document->getDom());
return $this;
}
}
app/code/Vendor/Migration/Reader/Groups.php
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Vendor\Migration\Reader;
/**
* Class Groups
*/
class Groups extends \Migration\Reader\Groups
{
/**
* Init configuration
*
* @param string $groupsFile
* @return $this
* @throws Exception
*/
public function init($groupsFile)
{
$xmlFile = $this->getThisRootDir() . $groupsFile;
if (!is_file($xmlFile)) {
return parent::init($groupsFile);
}
$xml = file_get_contents($xmlFile);
$document = new \Magento\Framework\Config\Dom($xml, $this->validationState);
if (!$document->validate($this->getRootDir() .'etc/' . self::CONFIGURATION_SCHEMA)) {
throw new Exception('XML file is invalid.');
}
$this->xml = new \DOMXPath($document->getDom());
return $this;
}
/**
* Get Migration Tool Configuration Dir
*
* @return string
*/
protected function getThisRootDir()
{
return dirname(__DIR__) . DIRECTORY_SEPARATOR;
}
}
app/code/Vendor/Migration/Reader/Map.php
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Vendor\Migration\Reader;
/**
* Class Map
*/
class Map extends \Migration\Reader\Map
{
/**
* Init configuration
*
* @param string $mapFile
* @return $this
* @throws Exception
*/
protected function init($mapFile)
{
$this->ignoredDocuments = [];
$this->wildcards = null;
$configFile = $this->getThisRootDir() . $mapFile;
if (!is_file($configFile)) {
return parent::init($mapFile);
}
$xml = file_get_contents($configFile);
$document = new \Magento\Framework\Config\Dom($xml, $this->validationState);
if (!$document->validate($this->getRootDir() .'etc/' . self::CONFIGURATION_SCHEMA)) {
throw new Exception('XML file is invalid.');
}
$this->xml = new \DOMXPath($document->getDom());
return $this;
}
/**
* Get Migration Tool Configuration Dir
*
* @return string
*/
protected function getThisRootDir()
{
return dirname(__DIR__) . DIRECTORY_SEPARATOR;
}
}
app/code/Vendor/Migration/Reader/Settings.php
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Vendor\Migration\Reader;
use Migration\Exception;
/**
* Class Settings
*/
class Settings extends \Migration\Reader\Settings
{
/**
* Validating xml file
*
* @return $this
* @throws Exception
*/
protected function validate()
{
$mapFile = $this->config->getOption(self::MAP_FILE_OPTION);
$rootDir = dirname(__DIR__) . DIRECTORY_SEPARATOR;
$configFile = $rootDir . $mapFile;
if (!is_file($configFile)) {
return parent::validate();
}
$xml = file_get_contents($configFile);
$document = new \Magento\Framework\Config\Dom($xml, $this->validationState);
if (!$document->validate($rootDir .'etc/' . self::CONFIGURATION_SCHEMA)) {
throw new Exception('XML file is invalid.');
}
$this->xml = new \DOMXPath($document->getDom());
return $this;
}
}
I hope will help someone.