private static File findProjectBaseDirectory()

in src/main/java/org/apache/maven/shared/verifier/Embedded3xLauncher.java [232:244]


    private static File findProjectBaseDirectory(File workingDirectory) {
        File currentDirectory = workingDirectory;
        // traverses directory structure from process work directory to filesystem root
        // first directory with .mvn subdirectory is considered project base directory
        while (currentDirectory != null && currentDirectory.getParentFile() != null) {
            // see if /.mvn exists
            if (new File(currentDirectory, ".mvn").isDirectory()) {
                return currentDirectory;
            }
            currentDirectory = currentDirectory.getParentFile();
        }
        return workingDirectory;
    }