code: public static String relativize(final String path,
                                      final File parentDir,
                                      final boolean removeInitialFileSep) {
  
          // Check sanity
          Validate.notNull(path, "path");
          Validate.notNull(parentDir, "parentDir");
  
          final String basedirPath = FileSystemUtilities.getCanonicalPath(parentDir);
          String toReturn = path;
  
          // Compare case insensitive
          if (path.toLowerCase().startsWith(basedirPath.toLowerCase())) {
              toReturn = path.substring(basedirPath.length());
          }
  
          // Handle whitespace in the argument.
          return removeInitialFileSep && toReturn.startsWith(File.separator)
                  ? toReturn.substring(File.separator.length())
                  : toReturn;
      }
docs: If the supplied path refers to a file or directory below the supplied basedir, the returned
  path is identical to the part below the basedir.
  
  @param path      The path to strip off basedir path from, and return.
  @param parentDir The maven project basedir.
  @param removeInitialFileSep If true, an initial {@code File#separator} is removed before returning.
  @return The path relative to basedir, if it is situated below the basedir. Otherwise the supplied path.