From 82921c411e0d2d2ab060f33e8b68bd381c2b099d Mon Sep 17 00:00:00 2001 From: Mat Booth Date: Jun 18 2019 15:40:11 +0000 Subject: Rebuild against maven-indexer 6.0 --- diff --git a/0001-Fix-manifests-for-guava-and-use-OSGi-fied-archetypes.patch b/0001-Fix-manifests-for-guava-and-use-OSGi-fied-archetypes.patch new file mode 100644 index 0000000..4a041a6 --- /dev/null +++ b/0001-Fix-manifests-for-guava-and-use-OSGi-fied-archetypes.patch @@ -0,0 +1,73 @@ +From 3d136cc50295613fddcc7c6ec113bfbdd53c4605 Mon Sep 17 00:00:00 2001 +From: Mat Booth +Date: Tue, 18 Jun 2019 15:35:48 +0100 +Subject: [PATCH 1/2] Fix manifests for guava and use OSGi-fied archetypes + +--- + org.eclipse.m2e.core.ui/META-INF/MANIFEST.MF | 4 +++- + org.eclipse.m2e.core/META-INF/MANIFEST.MF | 5 +++-- + org.eclipse.m2e.editor.xml/META-INF/MANIFEST.MF | 2 +- + org.eclipse.m2e.sourcelookup/META-INF/MANIFEST.MF | 2 +- + 4 files changed, 8 insertions(+), 5 deletions(-) + +diff --git a/org.eclipse.m2e.core.ui/META-INF/MANIFEST.MF b/org.eclipse.m2e.core.ui/META-INF/MANIFEST.MF +index 93e30e8..9cbc82e 100644 +--- a/org.eclipse.m2e.core.ui/META-INF/MANIFEST.MF ++++ b/org.eclipse.m2e.core.ui/META-INF/MANIFEST.MF +@@ -36,7 +36,9 @@ Require-Bundle: org.eclipse.m2e.core;bundle-version="[1.11.0,1.12.0)", + org.eclipse.core.expressions;bundle-version="3.4.101", + org.eclipse.ui.forms;bundle-version="3.4.1", + org.eclipse.jface.text, +- org.eclipse.ui ++ org.eclipse.ui, ++ org.apache.maven.archetype.catalog, ++ org.apache.maven.archetype.descriptor + Import-Package: org.eclipse.compare.rangedifferencer, + org.eclipse.ltk.core.refactoring, + org.slf4j;version="1.6.2" +diff --git a/org.eclipse.m2e.core/META-INF/MANIFEST.MF b/org.eclipse.m2e.core/META-INF/MANIFEST.MF +index 4320041..583cc33 100644 +--- a/org.eclipse.m2e.core/META-INF/MANIFEST.MF ++++ b/org.eclipse.m2e.core/META-INF/MANIFEST.MF +@@ -13,9 +13,10 @@ Require-Bundle: org.eclipse.osgi;bundle-version="3.10.0", + org.eclipse.m2e.workspace.cli;bundle-version="0.1.0", + org.eclipse.core.runtime;bundle-version="3.12.0", + org.eclipse.core.resources;bundle-version="3.9.0", +- com.google.guava;bundle-version="[21.0,22.0)" ++ org.apache.maven.archetype.catalog, ++ org.apache.maven.archetype.descriptor, ++ com.google.guava;bundle-version="[18.0,21.0)" + Bundle-ActivationPolicy: lazy +-Bundle-ClassPath: . + Bundle-RequiredExecutionEnvironment: JavaSE-1.8 + Export-Package: org.eclipse.m2e.core, + org.eclipse.m2e.core.archetype;x-friends:="org.eclipse.m2e.core.ui", +diff --git a/org.eclipse.m2e.editor.xml/META-INF/MANIFEST.MF b/org.eclipse.m2e.editor.xml/META-INF/MANIFEST.MF +index a119663..9a70e0c 100644 +--- a/org.eclipse.m2e.editor.xml/META-INF/MANIFEST.MF ++++ b/org.eclipse.m2e.editor.xml/META-INF/MANIFEST.MF +@@ -22,7 +22,7 @@ Require-Bundle: org.eclipse.core.runtime, + org.eclipse.ui.ide, + org.eclipse.core.filesystem, + org.eclipse.ui.forms, +- com.google.guava;bundle-version="[21.0,22.0)" ++ com.google.guava;bundle-version="[18.0,21.0)" + Export-Package: org.eclipse.m2e.editor.xml;x-internal:=true, + org.eclipse.m2e.editor.xml.internal;x-internal:=true, + org.eclipse.m2e.editor.xml.internal.lifecycle;x-internal:=true, +diff --git a/org.eclipse.m2e.sourcelookup/META-INF/MANIFEST.MF b/org.eclipse.m2e.sourcelookup/META-INF/MANIFEST.MF +index f76eb8c..8e2e0fc 100644 +--- a/org.eclipse.m2e.sourcelookup/META-INF/MANIFEST.MF ++++ b/org.eclipse.m2e.sourcelookup/META-INF/MANIFEST.MF +@@ -15,7 +15,7 @@ Require-Bundle: org.eclipse.m2e.launching;bundle-version="[1.11.0,1.12.0)", + org.eclipse.core.expressions;bundle-version="3.4.400", + org.eclipse.debug.ui;bundle-version="3.10.0", + org.eclipse.core.resources, +- com.google.guava;bundle-version="15.0.0", ++ com.google.guava;bundle-version="[18.0.0,21.0.0)", + com.google.gson;bundle-version="2.2.4", + org.eclipse.core.variables;bundle-version="3.2.0" + Import-Package: org.slf4j;version="1.6.2" +-- +2.20.1 + diff --git a/0002-Port-to-latest-versions-of-maven-indexer-and-lucene.patch b/0002-Port-to-latest-versions-of-maven-indexer-and-lucene.patch new file mode 100644 index 0000000..ea994a5 --- /dev/null +++ b/0002-Port-to-latest-versions-of-maven-indexer-and-lucene.patch @@ -0,0 +1,446 @@ +From 7ddc4eeb2f66a8ce472e29c30c1e3dfd7c50b042 Mon Sep 17 00:00:00 2001 +From: Mat Booth +Date: Tue, 18 Jun 2019 15:45:18 +0100 +Subject: [PATCH 2/2] Port to latest versions of maven-indexer and lucene + +--- + .../org.eclipse.m2e.maven.indexer/pom.xml | 4 +- + .../maven/index/DefaultIndexerEngine.java | 27 ++--- + .../core/ui/internal/util/ProposalUtil.java | 2 +- + .../nexus/AetherClientResourceFetcher.java | 11 +- + .../core/internal/index/nexus/NexusIndex.java | 10 +- + .../index/nexus/NexusIndexManager.java | 100 +++++++++--------- + 6 files changed, 83 insertions(+), 71 deletions(-) + +diff --git a/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/pom.xml b/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/pom.xml +index eb809b6..85d3dfe 100644 +--- a/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/pom.xml ++++ b/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/pom.xml +@@ -25,7 +25,7 @@ + + org.apache.maven.indexer + indexer-core +- 3.1.0 ++ 6.0.0 + true + + +@@ -68,7 +68,7 @@ + + + +- !* ++ org.apache.lucene*,!* + + + org.eclipse.m2e.maven.runtime;bundle-version="[1.11.0,1.12.0)", +diff --git a/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/src/main/java/org/apache/maven/index/DefaultIndexerEngine.java b/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/src/main/java/org/apache/maven/index/DefaultIndexerEngine.java +index 4b155c1..6aa1359 100644 +--- a/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/src/main/java/org/apache/maven/index/DefaultIndexerEngine.java ++++ b/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/src/main/java/org/apache/maven/index/DefaultIndexerEngine.java +@@ -25,7 +25,9 @@ import java.util.Set; + + import org.apache.lucene.document.Document; + import org.apache.lucene.document.Field; +-import org.apache.lucene.document.Fieldable; ++import org.apache.lucene.document.StringField; ++import org.apache.lucene.index.IndexableField; ++import org.apache.lucene.index.IndexableFieldType; + import org.apache.lucene.index.IndexWriter; + import org.apache.lucene.index.Term; + import org.apache.lucene.search.IndexSearcher; +@@ -112,10 +114,9 @@ public class DefaultIndexerEngine + { + final HashMap result = new HashMap(); + +- for ( Object o : d.getFields() ) ++ for ( IndexableField f : d.getFields() ) + { +- Fieldable f = (Fieldable) o; +- if ( f.isStored() ) ++ if ( f.fieldType().stored() ) + { + result.put( f.name(), f.stringValue() ); + } +@@ -128,13 +129,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 ) ++ if ( result.totalHits.value == 1 ) + { +- return indexSearcher.doc( result.scoreDocs[0].doc ); ++ Document doc = indexSearcher.doc( result.scoreDocs[0].doc ); ++ context.releaseIndexSearcher( indexSearcher ); ++ return doc; + } + } + catch ( IOException e ) +@@ -155,9 +158,9 @@ public class DefaultIndexerEngine + } + + Set allGroups = context.getAllGroups(); +- if ( !allGroups.contains( ac.getArtifactInfo().groupId ) ) ++ if ( !allGroups.contains( ac.getArtifactInfo().getGroupId() ) ) + { +- allGroups.add( ac.getArtifactInfo().groupId ); ++ allGroups.add( ac.getArtifactInfo().getGroupId() ); + context.setAllGroups( allGroups ); + } + } +@@ -170,9 +173,9 @@ public class DefaultIndexerEngine + String uinfo = ac.getArtifactInfo().getUinfo(); + // add artifact deletion marker + Document doc = new Document(); +- doc.add( new Field( ArtifactInfo.DELETED, uinfo, Field.Store.YES, Field.Index.NO ) ); +- doc.add( new Field( ArtifactInfo.LAST_MODIFIED, // +- Long.toString( System.currentTimeMillis() ), Field.Store.YES, Field.Index.NO ) ); ++ doc.add( new StringField( ArtifactInfo.DELETED, uinfo, Field.Store.YES ) ); ++ doc.add( new StringField( ArtifactInfo.LAST_MODIFIED, // ++ Long.toString( System.currentTimeMillis() ), Field.Store.YES ) ); + IndexWriter w = context.getIndexWriter(); + w.addDocument( doc ); + w.deleteDocuments( new Term( ArtifactInfo.UINFO, uinfo ) ); +diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ProposalUtil.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ProposalUtil.java +index e8d735c..69e42fd 100644 +--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ProposalUtil.java ++++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ProposalUtil.java +@@ -31,7 +31,7 @@ import org.eclipse.swt.widgets.Control; + import org.eclipse.swt.widgets.Text; + import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter; + +-import org.apache.lucene.queryParser.QueryParser; ++import org.apache.lucene.queryparser.classic.QueryParser; + + import org.apache.maven.project.MavenProject; + +diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java +index 16a5b90..aa5e9a0 100644 +--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java ++++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/AetherClientResourceFetcher.java +@@ -31,7 +31,7 @@ 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; + +@@ -46,7 +46,7 @@ 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; + +@@ -94,6 +94,13 @@ public class AetherClientResourceFetcher extends AbstractResourceFetcher { + } + } + ++ public InputStream retrieve(String name) throws IOException, FileNotFoundException { ++ String url = baseUrl + "/" + name; ++ Response response = aetherClient.get(url); ++ ++ return response.getInputStream(); ++ } ++ + class AetherClientConfigAdapter extends AetherClientConfig { + private final Logger log = LoggerFactory.getLogger(AetherClientConfigAdapter.class); + +diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndex.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndex.java +index de52ffc..eb578e8 100644 +--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndex.java ++++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndex.java +@@ -105,7 +105,7 @@ public class NexusIndex implements IIndex, IMutableIndex { + public Collection find(Collection groupId, + Collection artifactId, Collection version, + Collection packaging) throws CoreException { +- BooleanQuery query = new BooleanQuery(); ++ BooleanQuery.Builder query = new BooleanQuery.Builder(); + + addQueryFromSearchExpressionCollection(query, MAVEN.PACKAGING, packaging); + +@@ -115,18 +115,18 @@ public class NexusIndex implements IIndex, IMutableIndex { + + addQueryFromSearchExpressionCollection(query, MAVEN.VERSION, version); + +- return indexManager.search(repository, query).values(); ++ return indexManager.search(repository, query.build()).values(); + } + +- private void addQueryFromSearchExpressionCollection(final BooleanQuery query, final Field field, ++ private void addQueryFromSearchExpressionCollection(final BooleanQuery.Builder query, final Field field, + final Collection sec) { + if(sec != null && !sec.isEmpty()) { + if(sec.size() > 1) { +- BooleanQuery q = new BooleanQuery(); ++ BooleanQuery.Builder q = new BooleanQuery.Builder(); + for(SearchExpression se : sec) { + q.add(indexManager.constructQuery(field, se), Occur.SHOULD); + } +- query.add(q, Occur.MUST); ++ query.add(q.build(), Occur.MUST); + } else { + query.add(indexManager.constructQuery(field, sec.iterator().next()), Occur.MUST); + } +diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java +index 9686315..7ecbb18 100644 +--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java ++++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java +@@ -52,9 +52,7 @@ import org.codehaus.plexus.util.IOUtil; + import org.apache.lucene.search.BooleanClause; + import org.apache.lucene.search.BooleanClause.Occur; + import org.apache.lucene.search.BooleanQuery; +-import org.apache.lucene.search.FilteredQuery; + import org.apache.lucene.search.Query; +-import org.apache.lucene.search.QueryWrapperFilter; + import org.apache.lucene.store.Directory; + import org.apache.lucene.store.FSDirectory; + +@@ -69,7 +67,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; +@@ -229,7 +226,7 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList + public IndexedArtifactFile getIndexedArtifactFile(IRepository repository, ArtifactKey gav) throws CoreException { + + try { +- BooleanQuery query = new BooleanQuery(); ++ BooleanQuery.Builder query = new BooleanQuery.Builder(); + query.add(constructQuery(MAVEN.GROUP_ID, gav.getGroupId(), SearchType.EXACT), BooleanClause.Occur.MUST); + query.add(constructQuery(MAVEN.ARTIFACT_ID, gav.getArtifactId(), SearchType.EXACT), BooleanClause.Occur.MUST); + query.add(constructQuery(MAVEN.VERSION, gav.getVersion(), SearchType.EXACT), BooleanClause.Occur.MUST); +@@ -239,9 +236,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 = getIndexer().identify(query.build(), ++ Collections.singleton(getIndexingContext(repository))); ++ if(artifactInfo != null && !artifactInfo.isEmpty()) { ++ return getIndexedArtifactFile((ArtifactInfo) artifactInfo.toArray()[0]); + } + } + } catch(Exception ex) { +@@ -255,26 +253,26 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList + + /** for Unit test */ + public IndexedArtifactFile getIndexedArtifactFile(ArtifactInfo artifactInfo) { +- String groupId = artifactInfo.groupId; +- String artifactId = artifactInfo.artifactId; +- String repository = artifactInfo.repository; +- String version = artifactInfo.version; +- String classifier = artifactInfo.classifier; +- String packaging = artifactInfo.packaging; +- String fname = artifactInfo.fname; ++ String groupId = artifactInfo.getGroupId(); ++ String artifactId = artifactInfo.getArtifactId(); ++ String repository = artifactInfo.getRepository(); ++ String version = artifactInfo.getVersion(); ++ String classifier = artifactInfo.getClassifier(); ++ String packaging = artifactInfo.getPackaging(); ++ String fname = artifactInfo.getFileName(); + if(fname == null) { + fname = artifactId + '-' + version + + (classifier != null ? '-' + classifier : "") + (packaging != null ? ('.' + packaging) : ""); //$NON-NLS-1$ //$NON-NLS-2$ + } + +- long size = artifactInfo.size; +- Date date = new Date(artifactInfo.lastModified); ++ long size = artifactInfo.getSize(); ++ Date date = new Date(artifactInfo.getLastModified()); + +- int sourcesExists = artifactInfo.sourcesExists.ordinal(); +- int javadocExists = artifactInfo.javadocExists.ordinal(); ++ int sourcesExists = artifactInfo.getSourcesExists().ordinal(); ++ int javadocExists = artifactInfo.getJavadocExists().ordinal(); + +- String prefix = artifactInfo.prefix; +- List goals = artifactInfo.goals; ++ String prefix = artifactInfo.getPrefix(); ++ List goals = artifactInfo.getGoals(); + + return new IndexedArtifactFile(repository, groupId, artifactId, version, packaging, classifier, fname, size, date, + sourcesExists, javadocExists, prefix, goals); +@@ -282,8 +280,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 = 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)); +@@ -341,7 +340,7 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList + return search(null, term, type, classifier); + } + +- private void addClassifiersToQuery(BooleanQuery bq, int classifier) { ++ private void addClassifiersToQuery(BooleanQuery.Builder bq, int classifier) { + boolean includeJavaDocs = (classifier & IIndex.SEARCH_JAVADOCS) > 0; + Query tq = null; + if(!includeJavaDocs) { +@@ -372,46 +371,55 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList + // query = new TermQuery(new Term(ArtifactInfo.GROUP_ID, term)); + // query = new PrefixQuery(new Term(ArtifactInfo.GROUP_ID, term)); + } else if(IIndex.SEARCH_ARTIFACT.equals(type)) { +- BooleanQuery bq = new BooleanQuery(); ++ BooleanQuery.Builder bq = new BooleanQuery.Builder(); + bq.add(constructQuery(MAVEN.GROUP_ID, term), Occur.SHOULD); //$NON-NLS-1$ + bq.add(constructQuery(MAVEN.ARTIFACT_ID, term), Occur.SHOULD); //$NON-NLS-1$ + bq.add( + constructQuery(MAVEN.SHA1, term.getStringValue(), term.getStringValue().length() == 40 ? SearchType.EXACT + : SearchType.SCORED), Occur.SHOULD); + addClassifiersToQuery(bq, classifier); +- query = bq; ++ query = bq.build(); + + } else if(IIndex.SEARCH_PARENTS.equals(type)) { + if(term == null) { + query = constructQuery(MAVEN.PACKAGING, "pom", SearchType.EXACT); //$NON-NLS-1$ + } else { +- BooleanQuery bq = new BooleanQuery(); ++ BooleanQuery.Builder bq = new BooleanQuery.Builder(); + bq.add(constructQuery(MAVEN.GROUP_ID, term), Occur.SHOULD); //$NON-NLS-1$ + bq.add(constructQuery(MAVEN.ARTIFACT_ID, term), Occur.SHOULD); //$NON-NLS-1$ + bq.add( + constructQuery(MAVEN.SHA1, term.getStringValue(), term.getStringValue().length() == 40 ? SearchType.EXACT + : SearchType.SCORED), Occur.SHOULD); + Query tq = constructQuery(MAVEN.PACKAGING, "pom", SearchType.EXACT); //$NON-NLS-1$ +- query = new FilteredQuery(tq, new QueryWrapperFilter(bq)); ++ BooleanQuery.Builder builder = new BooleanQuery.Builder(); ++ builder.add(bq.build(), Occur.MUST); ++ builder.add(tq, Occur.FILTER); ++ query = builder.build(); + } + + } else if(IIndex.SEARCH_PLUGIN.equals(type)) { + if(term == null) { + query = constructQuery(MAVEN.PACKAGING, "maven-plugin", SearchType.EXACT); //$NON-NLS-1$ + } else { +- BooleanQuery bq = new BooleanQuery(); ++ BooleanQuery.Builder bq = new BooleanQuery.Builder(); + bq.add(constructQuery(MAVEN.GROUP_ID, term), Occur.SHOULD); //$NON-NLS-1$ + bq.add(constructQuery(MAVEN.ARTIFACT_ID, term), Occur.SHOULD); //$NON-NLS-1$ + Query tq = constructQuery(MAVEN.PACKAGING, "maven-plugin", SearchType.EXACT); //$NON-NLS-1$ +- query = new FilteredQuery(tq, new QueryWrapperFilter(bq)); ++ BooleanQuery.Builder builder = new BooleanQuery.Builder(); ++ builder.add(bq.build(), Occur.MUST); ++ builder.add(tq, Occur.FILTER); ++ query = builder.build(); + } + + } else if(IIndex.SEARCH_ARCHETYPE.equals(type)) { +- BooleanQuery bq = new BooleanQuery(); ++ BooleanQuery.Builder bq = new BooleanQuery.Builder(); + bq.add(constructQuery(MAVEN.GROUP_ID, term), Occur.SHOULD); //$NON-NLS-1$ + bq.add(constructQuery(MAVEN.ARTIFACT_ID, term), Occur.SHOULD); //$NON-NLS-1$ + Query tq = constructQuery(MAVEN.PACKAGING, "maven-archetype", SearchType.EXACT); //$NON-NLS-1$ +- query = new FilteredQuery(tq, new QueryWrapperFilter(bq)); ++ BooleanQuery.Builder builder = new BooleanQuery.Builder(); ++ builder.add(bq.build(), Occur.MUST); ++ builder.add(tq, Occur.FILTER); ++ query = builder.build(); + + } else if(IIndex.SEARCH_PACKAGING.equals(type)) { + query = constructQuery(MAVEN.PACKAGING, term); +@@ -437,7 +445,7 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList + } + + for(ArtifactInfo artifactInfo : response.getResults()) { +- addArtifactFile(result, getIndexedArtifactFile(artifactInfo), null, null, artifactInfo.packaging); ++ addArtifactFile(result, getIndexedArtifactFile(artifactInfo), null, null, artifactInfo.getPackaging()); + } + + // https://issues.sonatype.org/browse/MNGECLIPSE-1630 +@@ -488,7 +496,7 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList + } + + for(ArtifactInfo artifactInfo : response.getResults()) { +- addArtifactFile(result, getIndexedArtifactFile(artifactInfo), null, null, artifactInfo.packaging); ++ addArtifactFile(result, getIndexedArtifactFile(artifactInfo), null, null, artifactInfo.getPackaging()); + } + + } catch(IOException ex) { +@@ -626,27 +634,20 @@ 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(), +- key.getVersion(), null); +- ai.packaging = facade.getPackaging(); ++ key.getVersion(), key.getClassifier(), null); ++ ai.setPackaging(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 +844,7 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList + } + + protected Directory getIndexDirectory(IRepository repository) throws IOException { +- return FSDirectory.getDirectory(getIndexDirectoryFile(repository)); ++ return FSDirectory.open(getIndexDirectoryFile(repository).toPath()); + } + + public IndexedArtifactGroup resolveGroup(IndexedArtifactGroup group) { +@@ -1132,7 +1133,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.toPath()); + IndexingContext cacheCtx = getIndexer().addIndexingContextForced(id, id, null, directory, null, null, + getIndexers(details)); + request = newIndexUpdateRequest(repository, cacheCtx, monitor); +@@ -1276,7 +1277,8 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList + + Query q = getIndexer().constructQuery(MAVEN.SHA1, encode(digest), SearchType.EXACT); + +- return getIndexer().identify(q, contexts); ++ Collection 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"); +-- +2.20.1 + diff --git a/eclipse-m2e-core-fix-manifests.patch b/eclipse-m2e-core-fix-manifests.patch deleted file mode 100644 index f9bd72a..0000000 --- a/eclipse-m2e-core-fix-manifests.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- org.eclipse.m2e.core.ui/META-INF/MANIFEST.MF -+++ org.eclipse.m2e.core.ui/META-INF/MANIFEST.MF -@@ -36,7 +36,9 @@ Require-Bundle: org.eclipse.m2e.core;bundle-version="[1.6.0,1.7.0)", - org.eclipse.core.expressions;bundle-version="3.4.101", - org.eclipse.ui.forms;bundle-version="3.4.1", - org.eclipse.jface.text, -- org.eclipse.ui -+ org.eclipse.ui, -+ org.apache.maven.archetype.catalog, -+ org.apache.maven.archetype.descriptor - Import-Package: org.eclipse.compare.rangedifferencer, - org.eclipse.ltk.core.refactoring, - org.slf4j;version="1.6.2" ---- org.eclipse.m2e.core/META-INF/MANIFEST.MF.orig 2018-06-20 17:01:37.051314551 +0100 -+++ org.eclipse.m2e.core/META-INF/MANIFEST.MF 2018-06-20 17:03:16.779998408 +0100 -@@ -13,9 +13,10 @@ - org.eclipse.m2e.workspace.cli;bundle-version="0.1.0", - org.eclipse.core.runtime;bundle-version="3.12.0", - org.eclipse.core.resources;bundle-version="3.9.0", -- com.google.guava;bundle-version="[21.0,22.0)" -+ org.apache.maven.archetype.catalog, -+ org.apache.maven.archetype.descriptor, -+ com.google.guava;bundle-version="[18.0,21.0)" - Bundle-ActivationPolicy: lazy --Bundle-ClassPath: . - Bundle-RequiredExecutionEnvironment: JavaSE-1.8 - Export-Package: org.eclipse.m2e.core, - org.eclipse.m2e.core.archetype;x-friends:="org.eclipse.m2e.core.ui", ---- org.eclipse.m2e.editor.xml/META-INF/MANIFEST.MF.orig 2018-06-20 17:03:28.068962622 +0100 -+++ org.eclipse.m2e.editor.xml/META-INF/MANIFEST.MF 2018-06-20 17:03:41.050921469 +0100 -@@ -22,7 +22,7 @@ - org.eclipse.ui.ide, - org.eclipse.core.filesystem, - org.eclipse.ui.forms, -- com.google.guava;bundle-version="[21.0,22.0)" -+ com.google.guava;bundle-version="[18.0,21.0)" - Export-Package: org.eclipse.m2e.editor.xml;x-internal:=true, - org.eclipse.m2e.editor.xml.internal;x-internal:=true, - org.eclipse.m2e.editor.xml.internal.lifecycle;x-internal:=true, ---- org.eclipse.m2e.sourcelookup/META-INF/MANIFEST.MF.orig 2018-06-20 17:45:06.045000839 +0100 -+++ org.eclipse.m2e.sourcelookup/META-INF/MANIFEST.MF 2018-06-20 17:46:00.735826625 +0100 -@@ -15,7 +15,7 @@ - org.eclipse.core.expressions;bundle-version="3.4.400", - org.eclipse.debug.ui;bundle-version="3.10.0", - org.eclipse.core.resources, -- com.google.guava;bundle-version="15.0.0", -+ com.google.guava;bundle-version="[18.0.0,21.0.0)", - com.google.gson;bundle-version="2.2.4", - org.eclipse.core.variables;bundle-version="3.2.0" - Import-Package: org.slf4j;version="1.6.2" diff --git a/eclipse-m2e-core-indexer-5.1.1.patch b/eclipse-m2e-core-indexer-5.1.1.patch deleted file mode 100644 index ecf3647..0000000 --- a/eclipse-m2e-core-indexer-5.1.1.patch +++ /dev/null @@ -1,169 +0,0 @@ -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 -@@ -23,7 +23,7 @@ - - org.apache.maven.indexer - indexer-core -- 3.1.0 -+ 5.1.1 - true - - -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 -@@ -31,7 +31,7 @@ - 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; - -@@ -46,7 +46,7 @@ - import io.takari.aether.okhttp.OkHttpAetherClient; - - --public class AetherClientResourceFetcher extends AbstractResourceFetcher { -+public class AetherClientResourceFetcher implements ResourceFetcher { - - private AetherClient aetherClient; - -@@ -94,6 +94,13 @@ - } - } - -+ public InputStream retrieve(String name) throws IOException, FileNotFoundException { -+ String url = baseUrl + "/" + name; -+ Response response = aetherClient.get(url); -+ -+ return response.getInputStream(); -+ } -+ - class AetherClientConfigAdapter extends AetherClientConfig { - private final Logger log = LoggerFactory.getLogger(AetherClientConfigAdapter.class); - -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 = 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 = 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 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"); diff --git a/eclipse-m2e-core-lucene-5.patch b/eclipse-m2e-core-lucene-5.patch deleted file mode 100644 index fe690c1..0000000 --- a/eclipse-m2e-core-lucene-5.patch +++ /dev/null @@ -1,205 +0,0 @@ ---- 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 -@@ -25,7 +25,9 @@ import java.util.Set; - - import org.apache.lucene.document.Document; - import org.apache.lucene.document.Field; --import org.apache.lucene.document.Fieldable; -+import org.apache.lucene.document.StringField; -+import org.apache.lucene.index.IndexableField; -+import org.apache.lucene.index.IndexableFieldType; - import org.apache.lucene.index.IndexWriter; - import org.apache.lucene.index.Term; - import org.apache.lucene.search.IndexSearcher; -@@ -112,10 +113,9 @@ public class DefaultIndexerEngine - { - final HashMap result = new HashMap(); - -- for ( Object o : d.getFields() ) -+ for ( IndexableField f : d.getFields() ) - { -- Fieldable f = (Fieldable) o; -- if ( f.isStored() ) -+ if ( f.fieldType().stored() ) - { - result.put( f.name(), f.stringValue() ); - } -@@ -172,9 +172,9 @@ - String uinfo = ac.getArtifactInfo().getUinfo(); - // add artifact deletion marker - Document doc = new Document(); -- doc.add( new Field( ArtifactInfo.DELETED, uinfo, Field.Store.YES, Field.Index.NO ) ); -- doc.add( new Field( ArtifactInfo.LAST_MODIFIED, // -- Long.toString( System.currentTimeMillis() ), Field.Store.YES, Field.Index.NO ) ); -+ doc.add( new StringField( ArtifactInfo.DELETED, uinfo, Field.Store.YES ) ); -+ doc.add( new StringField( ArtifactInfo.LAST_MODIFIED, // -+ Long.toString( System.currentTimeMillis() ), Field.Store.YES ) ); - IndexWriter w = context.getIndexWriter(); - w.addDocument( doc ); - w.deleteDocuments( new Term( ArtifactInfo.UINFO, uinfo ) ); ---- org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ProposalUtil.java -+++ org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/util/ProposalUtil.java -@@ -31,7 +31,7 @@ import org.eclipse.swt.widgets.Control; - import org.eclipse.swt.widgets.Text; - import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter; - --import org.apache.lucene.queryParser.QueryParser; -+import org.apache.lucene.queryparser.classic.QueryParser; - - import org.apache.maven.project.MavenProject; - ---- org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndex.java.orig 2017-06-28 00:02:40.142038423 +0100 -+++ org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndex.java 2017-06-28 00:08:18.822265593 +0100 -@@ -105,7 +105,7 @@ - public Collection find(Collection groupId, - Collection artifactId, Collection version, - Collection packaging) throws CoreException { -- BooleanQuery query = new BooleanQuery(); -+ BooleanQuery.Builder query = new BooleanQuery.Builder(); - - addQueryFromSearchExpressionCollection(query, MAVEN.PACKAGING, packaging); - -@@ -115,18 +115,18 @@ - - addQueryFromSearchExpressionCollection(query, MAVEN.VERSION, version); - -- return indexManager.search(repository, query).values(); -+ return indexManager.search(repository, query.build()).values(); - } - -- private void addQueryFromSearchExpressionCollection(final BooleanQuery query, final Field field, -+ private void addQueryFromSearchExpressionCollection(final BooleanQuery.Builder query, final Field field, - final Collection sec) { - if(sec != null && !sec.isEmpty()) { - if(sec.size() > 1) { -- BooleanQuery q = new BooleanQuery(); -+ BooleanQuery.Builder q = new BooleanQuery.Builder(); - for(SearchExpression se : sec) { - q.add(indexManager.constructQuery(field, se), Occur.SHOULD); - } -- query.add(q, Occur.MUST); -+ query.add(q.build(), Occur.MUST); - } else { - query.add(indexManager.constructQuery(field, sec.iterator().next()), Occur.MUST); - } ---- org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java.orig 2017-06-28 00:40:07.535993939 +0100 -+++ org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java 2017-06-28 00:46:54.056462138 +0100 -@@ -52,9 +52,7 @@ - import org.apache.lucene.search.BooleanClause; - import org.apache.lucene.search.BooleanClause.Occur; - import org.apache.lucene.search.BooleanQuery; --import org.apache.lucene.search.FilteredQuery; - import org.apache.lucene.search.Query; --import org.apache.lucene.search.QueryWrapperFilter; - import org.apache.lucene.store.Directory; - import org.apache.lucene.store.FSDirectory; - -@@ -228,7 +226,7 @@ - public IndexedArtifactFile getIndexedArtifactFile(IRepository repository, ArtifactKey gav) throws CoreException { - - try { -- BooleanQuery query = new BooleanQuery(); -+ BooleanQuery.Builder query = new BooleanQuery.Builder(); - query.add(constructQuery(MAVEN.GROUP_ID, gav.getGroupId(), SearchType.EXACT), BooleanClause.Occur.MUST); - query.add(constructQuery(MAVEN.ARTIFACT_ID, gav.getArtifactId(), SearchType.EXACT), BooleanClause.Occur.MUST); - query.add(constructQuery(MAVEN.VERSION, gav.getVersion(), SearchType.EXACT), BooleanClause.Occur.MUST); -@@ -238,7 +236,7 @@ - } - - synchronized(getIndexLock(repository)) { -- Collection artifactInfo = getIndexer().identify(query, -+ Collection artifactInfo = getIndexer().identify(query.build(), - Collections.singleton(getIndexingContext(repository))); - if(artifactInfo != null && !artifactInfo.isEmpty()) { - return getIndexedArtifactFile((ArtifactInfo) artifactInfo.toArray()[0]); -@@ -342,7 +340,7 @@ - return search(null, term, type, classifier); - } - -- private void addClassifiersToQuery(BooleanQuery bq, int classifier) { -+ private void addClassifiersToQuery(BooleanQuery.Builder bq, int classifier) { - boolean includeJavaDocs = (classifier & IIndex.SEARCH_JAVADOCS) > 0; - Query tq = null; - if(!includeJavaDocs) { -@@ -373,46 +371,55 @@ - // query = new TermQuery(new Term(ArtifactInfo.GROUP_ID, term)); - // query = new PrefixQuery(new Term(ArtifactInfo.GROUP_ID, term)); - } else if(IIndex.SEARCH_ARTIFACT.equals(type)) { -- BooleanQuery bq = new BooleanQuery(); -+ BooleanQuery.Builder bq = new BooleanQuery.Builder(); - bq.add(constructQuery(MAVEN.GROUP_ID, term), Occur.SHOULD); //$NON-NLS-1$ - bq.add(constructQuery(MAVEN.ARTIFACT_ID, term), Occur.SHOULD); //$NON-NLS-1$ - bq.add( - constructQuery(MAVEN.SHA1, term.getStringValue(), term.getStringValue().length() == 40 ? SearchType.EXACT - : SearchType.SCORED), Occur.SHOULD); - addClassifiersToQuery(bq, classifier); -- query = bq; -+ query = bq.build(); - - } else if(IIndex.SEARCH_PARENTS.equals(type)) { - if(term == null) { - query = constructQuery(MAVEN.PACKAGING, "pom", SearchType.EXACT); //$NON-NLS-1$ - } else { -- BooleanQuery bq = new BooleanQuery(); -+ BooleanQuery.Builder bq = new BooleanQuery.Builder(); - bq.add(constructQuery(MAVEN.GROUP_ID, term), Occur.SHOULD); //$NON-NLS-1$ - bq.add(constructQuery(MAVEN.ARTIFACT_ID, term), Occur.SHOULD); //$NON-NLS-1$ - bq.add( - constructQuery(MAVEN.SHA1, term.getStringValue(), term.getStringValue().length() == 40 ? SearchType.EXACT - : SearchType.SCORED), Occur.SHOULD); - Query tq = constructQuery(MAVEN.PACKAGING, "pom", SearchType.EXACT); //$NON-NLS-1$ -- query = new FilteredQuery(tq, new QueryWrapperFilter(bq)); -+ BooleanQuery.Builder builder = new BooleanQuery.Builder(); -+ builder.add(bq.build(), Occur.MUST); -+ builder.add(tq, Occur.FILTER); -+ query = builder.build(); - } - - } else if(IIndex.SEARCH_PLUGIN.equals(type)) { - if(term == null) { - query = constructQuery(MAVEN.PACKAGING, "maven-plugin", SearchType.EXACT); //$NON-NLS-1$ - } else { -- BooleanQuery bq = new BooleanQuery(); -+ BooleanQuery.Builder bq = new BooleanQuery.Builder(); - bq.add(constructQuery(MAVEN.GROUP_ID, term), Occur.SHOULD); //$NON-NLS-1$ - bq.add(constructQuery(MAVEN.ARTIFACT_ID, term), Occur.SHOULD); //$NON-NLS-1$ - Query tq = constructQuery(MAVEN.PACKAGING, "maven-plugin", SearchType.EXACT); //$NON-NLS-1$ -- query = new FilteredQuery(tq, new QueryWrapperFilter(bq)); -+ BooleanQuery.Builder builder = new BooleanQuery.Builder(); -+ builder.add(bq.build(), Occur.MUST); -+ builder.add(tq, Occur.FILTER); -+ query = builder.build(); - } - - } else if(IIndex.SEARCH_ARCHETYPE.equals(type)) { -- BooleanQuery bq = new BooleanQuery(); -+ BooleanQuery.Builder bq = new BooleanQuery.Builder(); - bq.add(constructQuery(MAVEN.GROUP_ID, term), Occur.SHOULD); //$NON-NLS-1$ - bq.add(constructQuery(MAVEN.ARTIFACT_ID, term), Occur.SHOULD); //$NON-NLS-1$ - Query tq = constructQuery(MAVEN.PACKAGING, "maven-archetype", SearchType.EXACT); //$NON-NLS-1$ -- query = new FilteredQuery(tq, new QueryWrapperFilter(bq)); -+ BooleanQuery.Builder builder = new BooleanQuery.Builder(); -+ builder.add(bq.build(), Occur.MUST); -+ builder.add(tq, Occur.FILTER); -+ query = builder.build(); - - } else if(IIndex.SEARCH_PACKAGING.equals(type)) { - query = constructQuery(MAVEN.PACKAGING, term); -@@ -837,7 +844,7 @@ - } - - protected Directory getIndexDirectory(IRepository repository) throws IOException { -- return FSDirectory.open(getIndexDirectoryFile(repository)); -+ return FSDirectory.open(getIndexDirectoryFile(repository).toPath()); - } - - public IndexedArtifactGroup resolveGroup(IndexedArtifactGroup group) { -@@ -1126,7 +1133,7 @@ - String details = getIndexDetails(repository); - String id = repository.getUid() + "-cache"; //$NON-NLS-1$ - File luceneCache = new File(request.getLocalIndexCacheDir(), details); -- Directory directory = FSDirectory.open(luceneCache); -+ Directory directory = FSDirectory.open(luceneCache.toPath()); - IndexingContext cacheCtx = getIndexer().addIndexingContextForced(id, id, null, directory, null, null, - getIndexers(details)); - request = newIndexUpdateRequest(repository, cacheCtx, monitor); diff --git a/eclipse-m2e-core.spec b/eclipse-m2e-core.spec index 36638a9..cc8fa27 100644 --- a/eclipse-m2e-core.spec +++ b/eclipse-m2e-core.spec @@ -2,7 +2,7 @@ Name: eclipse-m2e-core Version: 1.11.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Maven integration for Eclipse # Most of components are under EPL, but some of them are licensed under @@ -13,11 +13,11 @@ URL: https://eclipse.org/m2e/ Source0: https://git.eclipse.org/c/m2e/m2e-core.git/snapshot/%{release_dir}.tar.xz Source1: http://www.eclipse.org/legal/epl-v10.html -# Add some necessary stuff (mainly requires & imports) to manifests -Patch0: %{name}-fix-manifests.patch +# Allow building against the Fedora shipped guava version +Patch0: 0001-Fix-manifests-for-guava-and-use-OSGi-fied-archetypes.patch -# API changes to accomodate maven-indexer 5.1.1 -Patch1: %{name}-indexer-5.1.1.patch +# Use latest versions of lucene and maven-indexer +Patch1: 0002-Port-to-latest-versions-of-maven-indexer-and-lucene.patch # API change in aether (remove once implemented) Patch2: %{name}-LifecycleMappingFactory.patch @@ -29,9 +29,6 @@ Patch3: %{name}-jetty.patch # See https://dev.eclipse.org/mhonarc/lists/p2-dev/msg05465.html Patch4: %{name}-mandatory-OSGi-attributes.patch -# Port to lucene 5 -Patch5: %{name}-lucene-5.patch - # Fix build against older maven < 3.5.3 as available on rhel 7 Patch6: eclipse-m2e-maven353.patch @@ -66,7 +63,7 @@ BuildRequires: mvn(org.sonatype.forge:forge-parent:pom:) BuildRequires: mvn(io.takari.aether:aether-connector-okhttp) BuildRequires: mvn(org.apache.felix:maven-bundle-plugin) BuildRequires: mvn(org.apache.maven.archetype:archetype-common) -BuildRequires: mvn(org.apache.maven.indexer:indexer-core) >= 5.1.2-0.4 +BuildRequires: mvn(org.apache.maven.indexer:indexer-core) >= 6.0.0 BuildRequires: mvn(org.apache.maven:maven-compat) BuildRequires: mvn(org.apache.maven:maven-core) BuildRequires: mvn(org.apache.maven:maven-embedder) @@ -174,7 +171,7 @@ Requires: apache-commons-lang Requires: apache-commons-lang3 Requires: atinject Requires: dom4j -Requires: eclipse-m2e-workspace >= 0.4.0 +Requires: eclipse-m2e-workspace Requires: google-guice Requires: jchardet Requires: jdom @@ -188,7 +185,7 @@ Requires: maven-archetype-common Requires: maven-archetype-descriptor Requires: maven-archetype-registry Requires: maven-artifact-manager -Requires: maven-indexer >= 5.1.2-0.6 +Requires: maven-indexer >= 6.0.0 Requires: maven-invoker Requires: maven-lib Requires: maven-model @@ -254,6 +251,8 @@ This package contains %{summary}. %prep %setup -q -n %{release_dir} +%patch0 -p1 +%patch1 -p1 find -name '*.class' -delete find -name '*.jar' -delete @@ -297,16 +296,13 @@ for d in `find m2e-maven-runtime/* -maxdepth 0 -type d`; do %pom_xpath_set pom:Embed-Dependency "*;scope=compile|runtime;groupId=!org.apache.lucene|org.ow2.asm" $d done -%patch0 -p0 -%patch1 -p0 %patch2 -p0 %patch3 -p0 %patch4 -p0 -%patch5 -p0 %if 0%{?rhel} == 7 %patch6 -p0 -%patch7 -p0 %endif +%patch7 -p0 # Not needed for RPM builds %pom_remove_plugin ":jacoco-maven-plugin" @@ -322,7 +318,6 @@ sed -i -e '/com.google.guava/a20.0' \ m2e-maven-runtime/org.eclipse.m2e.maven.runtime/pom.xml # Avoid embedding lucene, use as ordinary OSGi bundle instead -%pom_xpath_set pom:Import-Package "org.apache.lucene*,!*" m2e-maven-runtime/org.eclipse.m2e.maven.indexer sed -i -e '/org.slf4j/s|^\(.*\)|\1,org.apache.lucene.analysis,org.apache.lucene.analysis.standard,org.apache.lucene.analysis.util,org.apache.lucene.document,org.apache.lucene.index,org.apache.lucene.queryparser.classic,org.apache.lucene.search,org.apache.lucene.search.highlight,org.apache.lucene.store,org.apache.lucene.util|' \ org.eclipse.m2e.core/META-INF/MANIFEST.MF org.eclipse.m2e.core.ui/META-INF/MANIFEST.MF @@ -371,6 +366,9 @@ xmvn-subst -s $(find %{buildroot}%{_datadir}/eclipse/droplets/m2e-core -name jar %license epl-v10.html LICENSE-2.0.txt %changelog +* Tue Jun 18 2019 Mat Booth - 1.11.0-4 +- Rebuild against maven-indexer 6.0 + * Wed Jun 12 2019 Mat Booth - 1.11.0-3 - Add obsoletes for eclipse-m2e-sourcelookup