private void alignToBaseDirectory(Model model, File basedir) {
      if (basedir == null) {
        return;
      }

      Build build = model.getBuild();

      if (build != null) {
        build.setDirectory(alignToBaseDirectory(build.getDirectory(), basedir));

        build.setSourceDirectory(alignToBaseDirectory(build.getSourceDirectory(), basedir));

        build.setTestSourceDirectory(alignToBaseDirectory(build.getTestSourceDirectory(), basedir));

        for (Resource resource : build.getResources()) {
          resource.setDirectory(alignToBaseDirectory(resource.getDirectory(), basedir));
        }

        for (Resource resource : build.getTestResources()) {
          resource.setDirectory(alignToBaseDirectory(resource.getDirectory(), basedir));
        }

        if (build.getFilters() != null) {
          List<String> filters = new ArrayList<>();
          for (String filter : build.getFilters()) {
            filters.add(alignToBaseDirectory(filter, basedir));
          }
          build.setFilters(filters);
        }

        build.setOutputDirectory(alignToBaseDirectory(build.getOutputDirectory(), basedir));

        build.setTestOutputDirectory(alignToBaseDirectory(build.getTestOutputDirectory(), basedir));
      }

      Reporting reporting = model.getReporting();

      if (reporting != null) {
        reporting.setOutputDirectory(alignToBaseDirectory(reporting.getOutputDirectory(), basedir));
      }
    }
private void alignToBaseDirectory(Model model, File basedir)