public boolean foundPomXml(final File directory, final int depth) {
		LOG.debug("Directory: {}", directory);
		if (depth == -1 || directory == null || !directory.isDirectory()) {
			return false;
		} else {
			File[] pomFiles = directory.listFiles(new FileFilter() {
				@Override
				public boolean accept(final File pathname) {
					return "pom.xml".equals(pathname.getName());
				}
			});
			if (pomFiles.length == 1) {
				pathToPomXml = pomFiles[0];
				return true;
			} else {
				return foundPomXml(directory.getParentFile(), depth - 1);
			}
		}
	}
public boolean foundPomXml ( final File directory , final int depth ) { LOG . debug ( "Directory: {}" , directory ) ; if ( depth == - 1 || directory == null || ! directory . isDirectory ( ) ) { return false ; } else { File [ ] pomFiles = directory . listFiles ( new FileFilter ( ) { @ Override public boolean accept ( final File pathname ) { return "pom.xml" . equals ( pathname . getName ( ) ) ; } } ) ; if ( pomFiles . length == 1 ) { pathToPomXml = pomFiles [ 0 ] ; return true ; } else { return foundPomXml ( directory . getParentFile ( ) , depth - 1 ) ; } } }
Tries to find the pom recursively by going up in the directory tree.

@param directory The start folder where to search
@param depth how many times should we try to go up to find the pom?
@return a boolean denoting if the pom was found / side effect setting the pom file