public static void addArtifact( NexusIndexer indexer, IndexingContext index, ArtifactContext artifactContext) throws IOException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { indexer.addArtifactToIndex(artifactContext, index); // this hack is necessary to invalidate searcher's and reader's cache (may not be required then // lucene or nexus library change Method m = index.getClass().getDeclaredMethod("closeReaders"); m.setAccessible(true); m.invoke(index); }