0

I tried to create a custom module to create a custom configuration for Magento 2 data migration tool, like this:

app/code/Vendor/Migration/etc/module.xml

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Vendor_migration" setup_version="1.0.0">
        <sequence>
        <module name="Magento_DataMigrationTool"/>
    </sequence>
  </module>
</config>

app/code/Vendor/Migration/composer.json

{
    "name": "vendor/module-migration",
    "description": "Providing config for migration",
    "config": {
        "sort-packages": true
    },
    "require": {
        "magento/framework": "*",
        "magento/data-migration-tool": "*"
    },
    "type": "magento2-module",
    "autoload": {
        "files": [
            "registration.php"
        ],
        "psr-4": {
            "Vendor\\Migration\\": ""
        }
    },
    "version": "1.0.0"
}

app/code/Vendor/Migration/registration.php

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Vendor_Migration',
    __DIR__
);

app/code/Vendor/Migration/etc/opensource-to-opensource/1.9.3.8/config.xml

...
<options>
        <map_file>app/code/Vendor/Migration/etc/opensource-to-opensource/1.9.3.8/map.xml</map_file>
        <class_map>app/code/Vendor/Migration/etc/opensource-to-opensource/1.9.3.8/class-map.xml</class_map>
...
</options>
...

when I run the migration, I got the following error:

php bin/magento migrate:settings -r -a app/code/Vendor/Migration/etc/opensource-to-opensource/1.9.3.8/config.xml

Invalid map filename: /var/www/M2/vendor/magento/data-migration-tool/app/code/Vendor/Migration/etc/opensource-to-opensource/1.9.3.8/class-map.xml

it seems it still call the vendor module path as a prefix

1 Answer 1

0

The problem is that the rootDir in vendor/magento/data-migration-tool/src/Migration/Reader/Settings.php is set to vendor/magento/data-migration-tool/ :

$rootDir = dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR;

You can override the validate() function in your Vendor/Migration module to set the rootDir to your module's directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.