private void configureResourceLocator ( final ResourceManager resourceManager , final CheckstyleExecutorRequest request , final List < Artifact > additionalArtifacts ) { final MavenProject project = request . getProject ( ) ; resourceManager . setOutputDirectory ( new File ( project . getBuild ( ) . getDirectory ( ) ) ) ; // Recurse up the parent hierarchy and add project directories to the search roots MavenProject parent = project ; while ( parent != null && parent . getFile ( ) != null ) { // MCHECKSTYLE-131 ( olamy ) I don't like this hack. // (dkulp) Me either. It really pollutes the location stuff // by allowing searches of stuff outside the current module. File dir = parent . getFile ( ) . getParentFile ( ) ; resourceManager . addSearchPath ( FileResourceLoader . ID , dir . getAbsolutePath ( ) ) ; parent = parent . getParent ( ) ; } resourceManager . addSearchPath ( "url" , "" ) ; // MCHECKSTYLE-225: load licenses from additional artifacts, not from classpath if ( additionalArtifacts != null ) { for ( Artifact licenseArtifact : additionalArtifacts ) { try { // MCHECKSTYLE-287, MCHECKSTYLE-294: Ignore null licenseArtifacts ... if ( licenseArtifact != null ) { if ( getLogger ( ) . isDebugEnabled ( ) ) { getLogger ( ) . debug ( "Adding licenceArtifact [" + licenseArtifact . getGroupId ( ) + ":" + licenseArtifact . getArtifactId ( ) + ":" + licenseArtifact . getVersion ( ) + "] to resourceManager." ) ; } resourceManager . addSearchPath ( "jar" , "jar:" + licenseArtifact . getFile ( ) . toURI ( ) . toURL ( ) ) ; } } catch ( MalformedURLException e ) { // noop } } } }
Configures search paths in the resource locator . This method should only be called once per execution .