Blob Blame History Raw
diff --git m2e-maven-runtime/org.eclipse.m2e.maven.indexer/pom.xml m2e-maven-runtime/org.eclipse.m2e.maven.indexer/pom.xml
index af8200b..d97e974 100644
--- m2e-maven-runtime/org.eclipse.m2e.maven.indexer/pom.xml
+++ m2e-maven-runtime/org.eclipse.m2e.maven.indexer/pom.xml
@@ -25,7 +25,7 @@
     <dependency>
       <groupId>org.apache.maven.indexer</groupId>
       <artifactId>indexer-core</artifactId>
-      <version>3.1.0</version>
+      <version>5.1.1</version>
       <optional>true</optional>
       <exclusions>
         <exclusion>
diff --git m2e-maven-runtime/org.eclipse.m2e.maven.indexer/src/main/java/org/apache/maven/index/DefaultIndexerEngine.java m2e-maven-runtime/org.eclipse.m2e.maven.indexer/src/main/java/org/apache/maven/index/DefaultIndexerEngine.java
index 4b155c1..f34b300 100644
--- m2e-maven-runtime/org.eclipse.m2e.maven.indexer/src/main/java/org/apache/maven/index/DefaultIndexerEngine.java
+++ m2e-maven-runtime/org.eclipse.m2e.maven.indexer/src/main/java/org/apache/maven/index/DefaultIndexerEngine.java
@@ -128,13 +128,15 @@ public class DefaultIndexerEngine
     {
         try
         {
-            IndexSearcher indexSearcher = context.getIndexSearcher();
+            IndexSearcher indexSearcher = context.acquireIndexSearcher();
             TopDocs result =
                 indexSearcher.search( new TermQuery( new Term( ArtifactInfo.UINFO, ac.getArtifactInfo().getUinfo() ) ),
                                       2 );
             if ( result.totalHits == 1 )
             {
-                return indexSearcher.doc( result.scoreDocs[0].doc );
+                Document doc = indexSearcher.doc( result.scoreDocs[0].doc );
+                context.releaseIndexSearcher( indexSearcher );
+                return doc;
             }
         }
         catch ( IOException e )
diff --git org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java
index 6f167dd..9b072ef 100644
--- org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java
+++ org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java
@@ -11,13 +11,6 @@
 
 package org.eclipse.m2e.core.internal.index.nexus;
 
-import io.takari.aether.client.AetherClient;
-import io.takari.aether.client.AetherClientAuthentication;
-import io.takari.aether.client.AetherClientConfig;
-import io.takari.aether.client.AetherClientProxy;
-import io.takari.aether.client.Response;
-import io.takari.aether.okhttp.OkHttpAetherClient;
-
 import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -34,14 +27,20 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.OperationCanceledException;
 
-import org.apache.maven.index.updater.AbstractResourceFetcher;
+import org.apache.maven.index.updater.ResourceFetcher;
 import org.apache.maven.wagon.authentication.AuthenticationInfo;
 import org.apache.maven.wagon.proxy.ProxyInfo;
 
 import org.eclipse.m2e.core.internal.MavenPluginActivator;
 
+import io.takari.aether.client.AetherClient;
+import io.takari.aether.client.AetherClientAuthentication;
+import io.takari.aether.client.AetherClientConfig;
+import io.takari.aether.client.AetherClientProxy;
+import io.takari.aether.client.Response;
+import io.takari.aether.okhttp.OkHttpAetherClient;
 
-public class AetherClientResourceFetcher extends AbstractResourceFetcher {
+public class AetherClientResourceFetcher implements ResourceFetcher {
 
   private AetherClient aetherClient;
 
@@ -95,6 +94,15 @@ public class AetherClientResourceFetcher extends AbstractResourceFetcher {
     }
   }
 
+  public InputStream retrieve(String name) throws IOException, FileNotFoundException {
+
+    String url = baseUrl + "/" + name;
+    Response response = aetherClient.get(url);
+
+    Closer closer = Closer.create();
+    return closer.register(response.getInputStream());
+  }
+
   class AetherClientConfigAdapter extends AetherClientConfig {
 
     int connectionTimeout;
diff --git org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java
index 9686315..ab8c7c9 100644
--- org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java
+++ org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java
@@ -69,7 +69,6 @@ import org.apache.maven.index.MAVEN;
 import org.apache.maven.index.NexusIndexer;
 import org.apache.maven.index.SearchType;
 import org.apache.maven.index.artifact.Gav;
-import org.apache.maven.index.artifact.IllegalArtifactCoordinateException;
 import org.apache.maven.index.context.IndexCreator;
 import org.apache.maven.index.context.IndexingContext;
 import org.apache.maven.index.creator.JarFileContentsIndexCreator;
@@ -239,9 +238,10 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
       }
 
       synchronized(getIndexLock(repository)) {
-        ArtifactInfo artifactInfo = getIndexer().identify(query, Collections.singleton(getIndexingContext(repository)));
-        if(artifactInfo != null) {
-          return getIndexedArtifactFile(artifactInfo);
+        Collection<ArtifactInfo> artifactInfo = getIndexer().identify(query,
+            Collections.singleton(getIndexingContext(repository)));
+        if(artifactInfo != null && !artifactInfo.isEmpty()) {
+          return getIndexedArtifactFile((ArtifactInfo) artifactInfo.toArray()[0]);
         }
       }
     } catch(Exception ex) {
@@ -282,8 +282,9 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
 
   public IndexedArtifactFile identify(File file) throws CoreException {
     try {
-      ArtifactInfo artifactInfo = getIndexer().identify(file);
-      return artifactInfo == null ? null : getIndexedArtifactFile(artifactInfo);
+      Collection<ArtifactInfo> artifactInfo = getIndexer().identify(file);
+      return artifactInfo == null || artifactInfo.isEmpty() ? null
+          : getIndexedArtifactFile((ArtifactInfo) artifactInfo.toArray()[0]);
     } catch(IOException ex) {
       throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, -1,
           Messages.NexusIndexManager_error_search, ex));
@@ -626,13 +627,11 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
     fireIndexChanged(repository);
   }
 
-  private ArtifactContext getArtifactContext(File file, IndexingContext context)
-      throws IllegalArtifactCoordinateException {
+  private ArtifactContext getArtifactContext(File file, IndexingContext context) {
     return getArtifactContextProducer().getArtifactContext(context, file);
   }
 
-  private ArtifactContext getWorkspaceArtifactContext(IMavenProjectFacade facade, IndexingContext context)
-      throws CoreException {
+  private ArtifactContext getWorkspaceArtifactContext(IMavenProjectFacade facade, IndexingContext context) {
     IRepository workspaceRepository = repositoryRegistry.getWorkspaceRepository();
     ArtifactKey key = facade.getArtifactKey();
     ArtifactInfo ai = new ArtifactInfo(workspaceRepository.getUid(), key.getGroupId(), key.getArtifactId(),
@@ -640,13 +639,8 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
     ai.packaging = facade.getPackaging();
     File pomFile = facade.getPomFile();
     File artifactFile = (pomFile != null) ? pomFile.getParentFile() : null;
-    try {
-      Gav gav = new Gav(key.getGroupId(), key.getArtifactId(), key.getVersion());
-      return new ArtifactContext(pomFile, artifactFile, null, ai, gav);
-    } catch(IllegalArtifactCoordinateException ex) {
-      throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, -1,
-          Messages.NexusIndexManager_error_unexpected, ex));
-    }
+    Gav gav = new Gav(key.getGroupId(), key.getArtifactId(), key.getVersion());
+    return new ArtifactContext(pomFile, artifactFile, null, ai, gav);
   }
 
   protected void scheduleIndexUpdate(final IRepository repository, final boolean force) {
@@ -843,7 +837,7 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
   }
 
   protected Directory getIndexDirectory(IRepository repository) throws IOException {
-    return FSDirectory.getDirectory(getIndexDirectoryFile(repository));
+    return FSDirectory.open(getIndexDirectoryFile(repository));
   }
 
   public IndexedArtifactGroup resolveGroup(IndexedArtifactGroup group) {
@@ -1132,7 +1126,7 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
             String details = getIndexDetails(repository);
             String id = repository.getUid() + "-cache"; //$NON-NLS-1$
             File luceneCache = new File(request.getLocalIndexCacheDir(), details);
-            Directory directory = FSDirectory.getDirectory(luceneCache);
+            Directory directory = FSDirectory.open(luceneCache);
             IndexingContext cacheCtx = getIndexer().addIndexingContextForced(id, id, null, directory, null, null,
                 getIndexers(details));
             request = newIndexUpdateRequest(repository, cacheCtx, monitor);
@@ -1276,7 +1270,8 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
 
       Query q = getIndexer().constructQuery(MAVEN.SHA1, encode(digest), SearchType.EXACT);
 
-      return getIndexer().identify(q, contexts);
+      Collection<ArtifactInfo> result = getIndexer().identify(q, contexts);
+      return result == null || result.isEmpty() ? null : (ArtifactInfo) result.toArray()[0];
 
     } catch(NoSuchAlgorithmException ex) {
       throw new IOException("Unable to calculate digest");