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 .