void substituteModuleInfos()

in src/main/java/org/apache/maven/plugin/compiler/SourcesForRelease.java [131:150]


    void substituteModuleInfos(final Path mainOutputDirectory, final Path testOutputDirectory) throws IOException {
        for (Map.Entry<SourceDirectory, ModuleInfoOverwrite> entry : moduleInfos.entrySet()) {
            Path main = mainOutputDirectory;
            Path test = testOutputDirectory;
            SourceDirectory directory = entry.getKey();
            String moduleName = directory.moduleName;
            if (moduleName != null) {
                main = main.resolve(moduleName);
                if (!Files.isDirectory(main)) {
                    main = mainOutputDirectory;
                }
                test = test.resolve(moduleName);
                if (!Files.isDirectory(test)) {
                    test = testOutputDirectory;
                }
            }
            Path source = directory.getModuleInfo().orElseThrow(); // Should never be absent for entries in the map.
            entry.setValue(ModuleInfoOverwrite.create(source, main, test));
        }
    }