public final synchronized ExtendedArtifact searchArtifact ( File file ) { final String filename = removePathPrefix ( getBaseDirectory ( ) , file ) ; getLog ( ) . debug ( "Retreiving module for " + filename ) ; //$NON-NLS-1$ File theFile = file ; File pomDirectory = null ; while ( theFile != null && pomDirectory == null ) { if ( theFile . isDirectory ( ) ) { final File pomFile = new File ( theFile , "pom.xml" ) ; //$NON-NLS-1$ if ( pomFile . exists ( ) ) { pomDirectory = theFile ; } } theFile = theFile . getParentFile ( ) ; } if ( pomDirectory != null ) { ExtendedArtifact a = this . localArtifactDescriptions . get ( pomDirectory ) ; if ( a == null ) { a = readPom ( pomDirectory ) ; this . localArtifactDescriptions . put ( pomDirectory , a ) ; getLog ( ) . debug ( "Found local module description for " //$NON-NLS-1$ + a . toString ( ) ) ; } return a ; } final BuildContext buildContext = getBuildContext ( ) ; buildContext . addMessage ( file , 1 , 1 , "The maven module for this file cannot be retreived." , //$NON-NLS-1$ BuildContext . SEVERITY_WARNING , null ) ; return null ; }
Search and reply the maven artifact which is corresponding to the given file .