From 0593cb33c0502c2044d1580312695ea21d359064 Mon Sep 17 00:00:00 2001 From: Mat Booth Date: Mar 23 2020 02:50:06 +0000 Subject: Update to latest upstream release --- 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 index 3cf379f..95cc8dc 100644 --- a/0001-Fix-manifests-for-guava-and-use-OSGi-fied-archetypes.patch +++ b/0001-Fix-manifests-for-guava-and-use-OSGi-fied-archetypes.patch @@ -1,7 +1,7 @@ -From 5987084e7e4496d683c7b80d6cd0ca3232dd0fa9 Mon Sep 17 00:00:00 2001 +From bfcc8e7f185c01f85d9775047e21ae6399b269ab Mon Sep 17 00:00:00 2001 From: Mat Booth Date: Tue, 18 Jun 2019 15:35:48 +0100 -Subject: [PATCH 1/6] Fix manifests for guava and use OSGi-fied archetypes +Subject: [PATCH 1/5] Fix manifests for guava and use OSGi-fied archetypes --- org.eclipse.m2e.core.ui/META-INF/MANIFEST.MF | 4 +++- @@ -11,10 +11,10 @@ Subject: [PATCH 1/6] Fix manifests for guava and use OSGi-fied archetypes 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/org.eclipse.m2e.core.ui/META-INF/MANIFEST.MF b/org.eclipse.m2e.core.ui/META-INF/MANIFEST.MF -index a75496e..bd42d0f 100644 +index 179c8e8..e4d7d7f 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.13.0,1.14.1)", +@@ -36,7 +36,9 @@ Require-Bundle: org.eclipse.m2e.core;bundle-version="[1.15.0,1.16.0)", org.eclipse.core.expressions;bundle-version="3.4.101", org.eclipse.ui.forms;bundle-version="3.4.1", org.eclipse.jface.text, @@ -26,7 +26,7 @@ index a75496e..bd42d0f 100644 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 3b76f79..57e619c 100644 +index e9a0428..3598d22 100644 --- a/org.eclipse.m2e.core/META-INF/MANIFEST.MF +++ b/org.eclipse.m2e.core/META-INF/MANIFEST.MF @@ -13,7 +13,9 @@ Require-Bundle: org.eclipse.osgi;bundle-version="3.10.0", @@ -41,7 +41,7 @@ index 3b76f79..57e619c 100644 Bundle-ClassPath: . Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/org.eclipse.m2e.editor.xml/META-INF/MANIFEST.MF b/org.eclipse.m2e.editor.xml/META-INF/MANIFEST.MF -index f6890f2..c75cc34 100644 +index 2f155c1..68f61bb 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, @@ -54,10 +54,10 @@ index f6890f2..c75cc34 100644 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 32b4e32..ef462f8 100644 +index e964a7f..c08fb21 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.13.0,1.14.1)", +@@ -16,7 +16,7 @@ Require-Bundle: org.eclipse.m2e.launching;bundle-version="[1.15.0,1.16.0)", org.eclipse.core.expressions;bundle-version="3.4.400", org.eclipse.debug.ui;bundle-version="3.10.0", org.eclipse.core.resources, @@ -67,5 +67,5 @@ index 32b4e32..ef462f8 100644 org.eclipse.core.variables;bundle-version="3.2.0" Import-Package: org.slf4j;version="1.6.2" -- -2.21.0 +2.26.0.rc2 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 index 9aaa5a1..1e4f5b7 100644 --- a/0002-Port-to-latest-versions-of-maven-indexer-and-lucene.patch +++ b/0002-Port-to-latest-versions-of-maven-indexer-and-lucene.patch @@ -1,7 +1,7 @@ -From 432d8606118da63c5afcf1057c510a23a683f70e Mon Sep 17 00:00:00 2001 +From 1ac69bca7c6007f3dd694885fa122beab0004676 Mon Sep 17 00:00:00 2001 From: Mat Booth Date: Tue, 18 Jun 2019 15:45:18 +0100 -Subject: [PATCH 2/6] Port to latest versions of maven-indexer and lucene +Subject: [PATCH 2/5] Port to latest versions of maven-indexer and lucene --- .../org.eclipse.m2e.maven.indexer/pom.xml | 4 +- @@ -13,7 +13,7 @@ Subject: [PATCH 2/6] Port to latest versions of maven-indexer and lucene 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 f0187a4..06c39a3 100644 +index 6c34e73..9f4a91f 100644 --- a/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/pom.xml +++ b/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/pom.xml @@ -27,7 +27,7 @@ @@ -33,7 +33,7 @@ index f0187a4..06c39a3 100644 + org.apache.lucene*,!* - org.eclipse.m2e.maven.runtime;bundle-version="[1.14.0,1.15.0)", + org.eclipse.m2e.maven.runtime;bundle-version="[1.15.0,1.16.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 @@ -120,10 +120,10 @@ index 1446936..40f851e 100644 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 64e1fb7..619b132 100644 +index c549248..b311824 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 -@@ -33,7 +33,7 @@ import org.eclipse.core.runtime.IProgressMonitor; +@@ -35,7 +35,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; @@ -131,8 +131,8 @@ index 64e1fb7..619b132 100644 +import org.apache.maven.index.updater.ResourceFetcher; import org.apache.maven.wagon.authentication.AuthenticationInfo; import org.apache.maven.wagon.proxy.ProxyInfo; - -@@ -48,7 +48,7 @@ import io.takari.aether.client.Response; + import org.apache.maven.wagon.proxy.ProxyUtils; +@@ -51,7 +51,7 @@ import io.takari.aether.client.Response; import io.takari.aether.okhttp.OkHttpAetherClient; @@ -141,7 +141,7 @@ index 64e1fb7..619b132 100644 private AetherClient aetherClient; -@@ -97,6 +97,13 @@ public class AetherClientResourceFetcher extends AbstractResourceFetcher { +@@ -101,6 +101,13 @@ public class AetherClientResourceFetcher extends AbstractResourceFetcher { } } @@ -442,5 +442,5 @@ index 37d6906..e7e0688 100644 } catch(NoSuchAlgorithmException ex) { throw new IOException("Unable to calculate digest"); -- -2.21.0 +2.26.0.rc2 diff --git a/0003-Adapt-to-API-change-in-aether.patch b/0003-Adapt-to-API-change-in-aether.patch index 605cae0..34cde67 100644 --- a/0003-Adapt-to-API-change-in-aether.patch +++ b/0003-Adapt-to-API-change-in-aether.patch @@ -1,7 +1,7 @@ -From c3f244381ba8a22ecb886beba308b3c240fb8910 Mon Sep 17 00:00:00 2001 +From d55099c4a86c682f907ff3948f5c99b98bfc5d11 Mon Sep 17 00:00:00 2001 From: Mat Booth Date: Fri, 21 Jun 2019 11:24:15 +0100 -Subject: [PATCH 3/6] Adapt to API change in aether +Subject: [PATCH 3/5] Adapt to API change in aether --- .../embedder/ContextRepositorySystemSessionImpl.java | 6 ------ @@ -51,5 +51,5 @@ index 416decc..630992a 100644 } } -- -2.21.0 +2.26.0.rc2 diff --git a/0004-Port-tests-to-latest-versionof-jetty.patch b/0004-Port-tests-to-latest-versionof-jetty.patch deleted file mode 100644 index 93aa840..0000000 --- a/0004-Port-tests-to-latest-versionof-jetty.patch +++ /dev/null @@ -1,346 +0,0 @@ -From 626c0dc47c29091d891a7b41bfaff5cf1832526c Mon Sep 17 00:00:00 2001 -From: Mat Booth -Date: Fri, 21 Jun 2019 11:25:11 +0100 -Subject: [PATCH 4/6] Port tests to latest versionof jetty - ---- - .../META-INF/MANIFEST.MF | 13 +- - org.eclipse.m2e.tests.common/build.properties | 1 - - .../eclipse/m2e/tests/common/HttpServer.java | 141 +++++++++++------- - 3 files changed, 95 insertions(+), 60 deletions(-) - -diff --git a/org.eclipse.m2e.tests.common/META-INF/MANIFEST.MF b/org.eclipse.m2e.tests.common/META-INF/MANIFEST.MF -index 1dfb5f1..3088e5b 100644 ---- a/org.eclipse.m2e.tests.common/META-INF/MANIFEST.MF -+++ b/org.eclipse.m2e.tests.common/META-INF/MANIFEST.MF -@@ -11,14 +11,17 @@ Require-Bundle: org.junit;bundle-version="4.0.0", - org.eclipse.core.runtime, - org.eclipse.jdt.core, - org.eclipse.debug.core, -- org.eclipse.core.resources -+ org.eclipse.core.resources, -+ org.eclipse.jetty.server, -+ org.eclipse.jetty.util, -+ org.eclipse.jetty.http, -+ org.eclipse.jetty.security, -+ org.eclipse.jetty.io - Bundle-ActivationPolicy: lazy - Bundle-RequiredExecutionEnvironment: JavaSE-1.8 --Bundle-ClassPath: ., -- jars/javax.servlet_2.5.0.v201103041518.jar, -- jars/org.mortbay.jetty.server_6.1.23.v201012071420.jar, -- jars/org.mortbay.jetty.util_6.1.23.v201012071420.jar - Bundle-Vendor: %Bundle-Vendor - MavenArtifact-GroupId: org.eclipse.m2e - MavenArtifact-ArtifactId: org.eclipse.m2e.tests.common - Export-Package: org.eclipse.m2e.tests.common;x-internal:=true -+Import-Package: javax.servlet;version="3.1.0", -+ javax.servlet.http;version="3.1.0" -diff --git a/org.eclipse.m2e.tests.common/build.properties b/org.eclipse.m2e.tests.common/build.properties -index 1a9040b..36b4965 100644 ---- a/org.eclipse.m2e.tests.common/build.properties -+++ b/org.eclipse.m2e.tests.common/build.properties -@@ -15,6 +15,5 @@ output.. = target/classes/ - bin.includes = META-INF/,\ - .,\ - about.html,\ -- jars/,\ - OSGI-INF/ - src.includes = about.html -diff --git a/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/HttpServer.java b/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/HttpServer.java -index 96db486..79c0e2a 100644 ---- a/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/HttpServer.java -+++ b/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/HttpServer.java -@@ -13,6 +13,8 @@ - - package org.eclipse.m2e.tests.common; - -+import static org.junit.Assert.fail; -+ - import java.io.File; - import java.io.FileInputStream; - import java.io.FileOutputStream; -@@ -25,28 +27,36 @@ import java.util.HashMap; - import java.util.HashSet; - import java.util.List; - import java.util.Map; -+import java.util.Properties; - import java.util.TreeMap; - - import javax.servlet.http.HttpServletRequest; - import javax.servlet.http.HttpServletResponse; - --import org.mortbay.jetty.Connector; --import org.mortbay.jetty.Handler; --import org.mortbay.jetty.HttpMethods; --import org.mortbay.jetty.Request; --import org.mortbay.jetty.Server; --import org.mortbay.jetty.handler.AbstractHandler; --import org.mortbay.jetty.handler.DefaultHandler; --import org.mortbay.jetty.handler.HandlerList; --import org.mortbay.jetty.nio.SelectChannelConnector; --import org.mortbay.jetty.security.B64Code; --import org.mortbay.jetty.security.Constraint; --import org.mortbay.jetty.security.ConstraintMapping; --import org.mortbay.jetty.security.HashUserRealm; --import org.mortbay.jetty.security.SecurityHandler; --import org.mortbay.jetty.security.SslSocketConnector; --import org.mortbay.util.IO; --import org.mortbay.util.URIUtil; -+import org.eclipse.jetty.http.HttpMethod; -+import org.eclipse.jetty.http.HttpVersion; -+import org.eclipse.jetty.security.ConstraintMapping; -+import org.eclipse.jetty.security.ConstraintSecurityHandler; -+import org.eclipse.jetty.security.HashLoginService; -+import org.eclipse.jetty.security.SecurityHandler; -+import org.eclipse.jetty.security.authentication.BasicAuthenticator; -+import org.eclipse.jetty.server.Connector; -+import org.eclipse.jetty.server.Handler; -+import org.eclipse.jetty.server.HttpConfiguration; -+import org.eclipse.jetty.server.HttpConnectionFactory; -+import org.eclipse.jetty.server.NetworkConnector; -+import org.eclipse.jetty.server.Request; -+import org.eclipse.jetty.server.Server; -+import org.eclipse.jetty.server.ServerConnector; -+import org.eclipse.jetty.server.SslConnectionFactory; -+import org.eclipse.jetty.server.handler.AbstractHandler; -+import org.eclipse.jetty.server.handler.DefaultHandler; -+import org.eclipse.jetty.server.handler.HandlerList; -+import org.eclipse.jetty.util.B64Code; -+import org.eclipse.jetty.util.IO; -+import org.eclipse.jetty.util.URIUtil; -+import org.eclipse.jetty.util.security.Constraint; -+import org.eclipse.jetty.util.ssl.SslContextFactory; - - - /** -@@ -103,24 +113,29 @@ public class HttpServer { - private String storePassword; - - protected Connector newHttpConnector() { -- SelectChannelConnector connector = new SelectChannelConnector(); -+ HttpConfiguration config = new HttpConfiguration(); -+ config.setSecurePort(httpsPort); -+ ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(config)); - connector.setPort(httpPort); - return connector; - } - - protected Connector newHttpsConnector() { -- SslSocketConnector connector = new SslSocketConnector(); -- connector.setPort(httpsPort); -- connector.setKeystore(new File(keyStoreLocation).getAbsolutePath()); -- connector.setPassword(storePassword); -- connector.setKeyPassword(keyStorePassword); -+ SslContextFactory sslContextFactory = new SslContextFactory(); -+ sslContextFactory.setKeyManagerPassword(storePassword); -+ sslContextFactory.setKeyStorePath(new File(keyStoreLocation).getAbsolutePath()); -+ sslContextFactory.setKeyStorePassword(keyStorePassword); - if(trustStoreLocation != null && !trustStoreLocation.equals("")) { -- connector.setTruststore(new File(trustStoreLocation).getAbsolutePath()); -+ sslContextFactory.setTrustStorePath(new File(trustStoreLocation).getAbsolutePath()); - } - if(trustStorePassword != null && !trustStoreLocation.equals("")) { -- connector.setTrustPassword(trustStorePassword); -+ sslContextFactory.setTrustStorePassword(trustStorePassword); - } -- connector.setNeedClientAuth(needClientAuth); -+ sslContextFactory.setNeedClientAuth(needClientAuth); -+ -+ ServerConnector connector = new ServerConnector(server, -+ new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString())); -+ connector.setPort(httpsPort); - return connector; - } - -@@ -144,7 +159,7 @@ public class HttpServer { - */ - public int getHttpPort() { - if(httpPort >= 0 && server != null && server.isRunning()) { -- return server.getConnectors()[0].getLocalPort(); -+ return ((NetworkConnector) server.getConnectors()[0]).getLocalPort(); - } - return httpPort; - } -@@ -178,7 +193,7 @@ public class HttpServer { - */ - public int getHttpsPort() { - if(httpsPort >= 0 && server != null && server.isRunning()) { -- return server.getConnectors()[(httpPort < 0) ? 0 : 1].getLocalPort(); -+ return ((NetworkConnector) server.getConnectors()[(httpPort < 0) ? 0 : 1]).getLocalPort(); - } - return httpsPort; - } -@@ -262,12 +277,13 @@ public class HttpServer { - - protected Handler newProxyHandler() { - return new AbstractHandler() { -- public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) -+ @Override -+ public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) - throws IOException { - String auth = request.getHeader("Proxy-Authorization"); - if(auth != null) { - auth = auth.substring(auth.indexOf(' ') + 1).trim(); -- auth = B64Code.decode(auth); -+ auth = new String(B64Code.decode(auth)); - } - - if(!(proxyUsername + ':' + proxyPassword).equals(auth)) { -@@ -295,8 +311,8 @@ public class HttpServer { - - protected Handler newSslRedirectHandler() { - return new AbstractHandler() { -- -- public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) { -+ @Override -+ public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { - int httpsPort = getHttpsPort(); - if(!((Request) request).isHandled() && request.getServerPort() != httpsPort) { - String url = "https://" + request.getServerName() + ":" + httpsPort + request.getRequestURI(); -@@ -338,7 +354,7 @@ public class HttpServer { - return this; - } - -- protected Handler newSecurityHandler() { -+ protected SecurityHandler newSecurityHandler() { - List mappings = new ArrayList(); - - for(String pathSpec : securedRealms.keySet()) { -@@ -356,22 +372,32 @@ public class HttpServer { - mappings.add(constraintMapping); - } - -- HashUserRealm userRealm = new HashUserRealm("TestRealm"); -+ Properties p = new Properties(); - for(String username : userPasswords.keySet()) { - String password = userPasswords.get(username); - String[] roles = userRoles.get(username); - -- userRealm.put(username, password); -- if(roles != null) { -- for(String role : roles) { -- userRealm.addUserToRole(username, role); -- } -+ StringBuilder entry = new StringBuilder(password); -+ for(String role : roles) { -+ entry.append(","); -+ entry.append(role); - } -+ p.put(username, entry.toString()); -+ } -+ File propFile = new File("target/users.properties"); -+ try (FileOutputStream in = new FileOutputStream(propFile)) { -+ p.store(in, null); -+ } catch(IOException ex) { -+ fail("Unable to create users properties file"); - } - -- SecurityHandler securityHandler = new SecurityHandler(); -- securityHandler.setUserRealm(userRealm); -- securityHandler.setConstraintMappings(mappings.toArray(new ConstraintMapping[mappings.size()])); -+ HashLoginService userRealm = new HashLoginService("TestRealm", "target/users.properties"); -+ server.addBean(userRealm); -+ -+ ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler(); -+ securityHandler.setAuthenticator(new BasicAuthenticator()); -+ securityHandler.setLoginService(userRealm); -+ securityHandler.setConstraintMappings(mappings); - - return securityHandler; - } -@@ -472,8 +498,8 @@ public class HttpServer { - - protected Handler newSleepHandler(final long millis) { - return new AbstractHandler() { -- -- public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) { -+ @Override -+ public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { - if(millis >= 0) { - try { - Thread.sleep(millis); -@@ -507,6 +533,8 @@ public class HttpServer { - - recordedRequests.clear(); - -+ server = new Server(); -+ - List connectors = new ArrayList(); - if(httpPort >= 0) { - connectors.add(newHttpConnector()); -@@ -528,15 +556,20 @@ public class HttpServer { - if(proxyUsername != null && proxyPassword != null) { - handlerList.addHandler(newProxyHandler()); - } -+ SecurityHandler security = null; - if(!securedRealms.isEmpty()) { -- handlerList.addHandler(newSecurityHandler()); -+ security = newSecurityHandler(); -+ handlerList.addHandler(security); - } - if(!resourceDirs.isEmpty()) { -- handlerList.addHandler(newResourceHandler()); -+ if(security != null) { -+ security.setHandler(newResourceHandler()); -+ } else { -+ handlerList.addHandler(newResourceHandler()); -+ } - } - handlerList.addHandler(new DefaultHandler()); - -- server = new Server(0); - server.setHandler(handlerList); - server.setConnectors(connectors.toArray(new Connector[connectors.size()])); - server.start(); -@@ -558,7 +591,7 @@ public class HttpServer { - for(int i = 200; i > 0; i-- ) { - badConnectors.clear(); - for(Connector connector : server.getConnectors()) { -- if(connector.getLocalPort() < 0) { -+ if(((NetworkConnector) connector).getLocalPort() < 0) { - badConnectors.add(connector); - } - } -@@ -622,8 +655,8 @@ public class HttpServer { - } - - class ResHandler extends AbstractHandler { -- -- public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) -+ @Override -+ public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) - throws IOException { - String uri = request.getRequestURI(); - -@@ -633,14 +666,14 @@ public class HttpServer { - File basedir = resourceDirs.get(contextRoot); - File file = new File(basedir, path); - -- if(HttpMethods.HEAD.equals(request.getMethod())) { -+ if(HttpMethod.HEAD.equals(request.getMethod())) { - if(file.exists()) - response.setStatus(HttpServletResponse.SC_OK); - else - response.setStatus(HttpServletResponse.SC_NOT_FOUND); - ((Request) request).setHandled(true); - return; -- } else if(HttpMethods.PUT.equals(request.getMethod()) || HttpMethods.POST.equals(request.getMethod())) { -+ } else if(HttpMethod.PUT.equals(request.getMethod()) || HttpMethod.POST.equals(request.getMethod())) { - file.getParentFile().mkdirs(); - FileOutputStream os = new FileOutputStream(file); - try { -@@ -706,8 +739,8 @@ public class HttpServer { - } - - class RecordingHandler extends AbstractHandler { -- -- public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) { -+ @Override -+ public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) { - String uri = request.getRequestURI(); - - for(String pattern : recordedPatterns) { --- -2.21.0 - diff --git a/0004-Remove-mandatory-attirbutes-from-OSGi-manifests-whic.patch b/0004-Remove-mandatory-attirbutes-from-OSGi-manifests-whic.patch new file mode 100644 index 0000000..5b33fb4 --- /dev/null +++ b/0004-Remove-mandatory-attirbutes-from-OSGi-manifests-whic.patch @@ -0,0 +1,67 @@ +From dd1ffee21280be51c9db64a3bbe831685879ef84 Mon Sep 17 00:00:00 2001 +From: Mat Booth +Date: Fri, 21 Jun 2019 11:27:12 +0100 +Subject: [PATCH 4/5] Remove mandatory attirbutes from OSGi manifests, which + cause problems with P2 + +--- + .../org.eclipse.m2e.archetype.common/pom.xml | 4 ++-- + .../org.eclipse.m2e.maven.indexer/pom.xml | 3 +-- + .../org.eclipse.m2e.maven.runtime/pom.xml | 12 ++++++------ + 3 files changed, 9 insertions(+), 10 deletions(-) + +diff --git a/m2e-maven-runtime/org.eclipse.m2e.archetype.common/pom.xml b/m2e-maven-runtime/org.eclipse.m2e.archetype.common/pom.xml +index 68d1db2..9279dce 100644 +--- a/m2e-maven-runtime/org.eclipse.m2e.archetype.common/pom.xml ++++ b/m2e-maven-runtime/org.eclipse.m2e.archetype.common/pom.xml +@@ -91,8 +91,8 @@ + + <_exportcontents> + META-INF.plexus;-noimport:=true;x-internal:=true, +- org.apache.maven.archetype.*;provider=m2e;mandatory:=provider;x-internal:=true, +- org.codehaus.plexus.velocity;provider=m2e;mandatory:=provider;x-internal:=true, ++ org.apache.maven.archetype.*;provider=m2e;x-internal:=true, ++ org.codehaus.plexus.velocity;provider=m2e;x-internal:=true, + + + +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 9f4a91f..e073f24 100644 +--- a/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/pom.xml ++++ b/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/pom.xml +@@ -65,8 +65,7 @@ + + <_exportcontents> + META-INF.plexus;-noimport:=true, +- org.apache.lucene.*;provider=m2e;mandatory:=provider, +- org.apache.maven.*;provider=m2e;mandatory:=provider, ++ org.apache.maven.*;provider=m2e, + + + +diff --git a/m2e-maven-runtime/org.eclipse.m2e.maven.runtime/pom.xml b/m2e-maven-runtime/org.eclipse.m2e.maven.runtime/pom.xml +index 2aa5313..d1f4ad4 100644 +--- a/m2e-maven-runtime/org.eclipse.m2e.maven.runtime/pom.xml ++++ b/m2e-maven-runtime/org.eclipse.m2e.maven.runtime/pom.xml +@@ -139,12 +139,12 @@ + <_exportcontents> + META-INF.plexus;-noimport:=true, + META-INF.sisu;-noimport:=true, +- org.apache.maven.*;provider=m2e;mandatory:=provider, +- org.codehaus.plexus.*;provider=m2e;mandatory:=provider, +- org.sonatype.plexus.*;provider=m2e;mandatory:=provider, +- org.eclipse.aether.*;provider=m2e;mandatory:=provider;version=1.1.1, +- com.google.inject.*;provider=m2e;mandatory:=provider, +- io.takari.*;provider=m2e;mandatory:=provider ++ org.apache.maven.*;provider=m2e, ++ org.codehaus.plexus.*;provider=m2e, ++ org.sonatype.plexus.*;provider=m2e, ++ org.eclipse.aether.*;provider=m2e, ++ com.google.inject.*;provider=m2e, ++ io.takari.*;provider=m2e + + + +-- +2.26.0.rc2 + diff --git a/0005-Port-to-latest-version-of-maven-archetypes.patch b/0005-Port-to-latest-version-of-maven-archetypes.patch new file mode 100644 index 0000000..f128d90 --- /dev/null +++ b/0005-Port-to-latest-version-of-maven-archetypes.patch @@ -0,0 +1,566 @@ +From eccef76a991528e8fde44e3767defd4ec4c1f5b0 Mon Sep 17 00:00:00 2001 +From: Mat Booth +Date: Wed, 3 Jul 2019 15:29:05 +0100 +Subject: [PATCH 5/5] Port to latest version of maven-archetypes + +Change-Id: I208abd50bdbe420d5413ad12bbe5150c428c9453 +--- + .../org.eclipse.m2e.archetype.common/pom.xml | 9 +- + .../MavenArchetypesPreferencePage.java | 93 +--------- + .../MavenProjectWizardArchetypePage.java | 8 +- + .../m2e/core/internal/ExtensionReader.java | 27 +-- + .../eclipse/m2e/core/internal/Messages.java | 2 - + .../archetype/ArchetypeCatalogFactory.java | 164 ++---------------- + .../archetype/ArchetypeCatalogsWriter.java | 49 +----- + .../internal/archetype/ArchetypeManager.java | 5 +- + 8 files changed, 34 insertions(+), 323 deletions(-) + +diff --git a/m2e-maven-runtime/org.eclipse.m2e.archetype.common/pom.xml b/m2e-maven-runtime/org.eclipse.m2e.archetype.common/pom.xml +index 9279dce..ca19922 100644 +--- a/m2e-maven-runtime/org.eclipse.m2e.archetype.common/pom.xml ++++ b/m2e-maven-runtime/org.eclipse.m2e.archetype.common/pom.xml +@@ -24,7 +24,7 @@ + Maven Archetype Common Bundle + + +- 2.4 ++ 3.1.1 + + + +@@ -34,11 +34,6 @@ + ${archetype-common.version} + true + +- +- +- velocity +- velocity +- + + plexus-container-default + org.codehaus.plexus +@@ -76,12 +71,10 @@ + archetype-common, + archetype-catalog, + archetype-descriptor, +- archetype-registry, + maven-invoker, + commons-collections, + commons-io, + commons-lang, +- dom4j;version=2.1.1, + jchardet, + jdom, + oro, +diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/MavenArchetypesPreferencePage.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/MavenArchetypesPreferencePage.java +index 0c95b17..486e3c9 100644 +--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/MavenArchetypesPreferencePage.java ++++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/MavenArchetypesPreferencePage.java +@@ -55,8 +55,6 @@ import org.eclipse.ui.browser.IWebBrowser; + + import org.eclipse.m2e.core.internal.MavenPluginActivator; + import org.eclipse.m2e.core.internal.archetype.ArchetypeCatalogFactory; +-import org.eclipse.m2e.core.internal.archetype.ArchetypeCatalogFactory.LocalCatalogFactory; +-import org.eclipse.m2e.core.internal.archetype.ArchetypeCatalogFactory.RemoteCatalogFactory; + import org.eclipse.m2e.core.internal.archetype.ArchetypeManager; + import org.eclipse.m2e.core.internal.preferences.MavenPreferenceConstants; + import org.eclipse.m2e.core.ui.internal.M2EUIPluginActivator; +@@ -174,84 +172,6 @@ public class MavenArchetypesPreferencePage extends FieldEditorPreferencePage imp + typeColumn.setWidth(250); + typeColumn.setText(""); //$NON-NLS-1$ + +- Button enableAllBtn = new Button(composite, SWT.NONE); +- enableAllBtn.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); +- enableAllBtn.setText(Messages.MavenArchetypesPreferencePage_btnEnableAll); +- enableAllBtn.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> toggleRepositories(true))); +- +- Button disableAllBtn = new Button(composite, SWT.NONE); +- disableAllBtn.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); +- disableAllBtn.setText(Messages.MavenArchetypesPreferencePage_btnDisableAll); +- disableAllBtn.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> toggleRepositories(false))); +- +- Button addLocalButton = new Button(composite, SWT.NONE); +- addLocalButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); +- addLocalButton.setText(Messages.MavenArchetypesPreferencePage_btnAddLocal); +- addLocalButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { +- LocalArchetypeCatalogDialog dialog = new LocalArchetypeCatalogDialog(getShell(), null); +- if(dialog.open() == Window.OK) { +- addCatalogFactory(dialog.getArchetypeCatalogFactory()); +- } +- })); +- +- Button addRemoteButton = new Button(composite, SWT.NONE); +- addRemoteButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); +- addRemoteButton.setText(Messages.MavenArchetypesPreferencePage_btnAddRemote); +- addRemoteButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { +- RemoteArchetypeCatalogDialog dialog = new RemoteArchetypeCatalogDialog(getShell(), null); +- if(dialog.open() == Window.OK) { +- addCatalogFactory(dialog.getArchetypeCatalogFactory()); +- } +- })); +- +- final Button editButton = new Button(composite, SWT.NONE); +- editButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); +- editButton.setEnabled(false); +- editButton.setText(Messages.MavenArchetypesPreferencePage_btnEdit); +- editButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { +- ArchetypeCatalogFactory factory = getSelectedArchetypeCatalogFactory(); +- ArchetypeCatalogFactory newFactory = null; +- if(factory instanceof LocalCatalogFactory) { +- LocalArchetypeCatalogDialog dialog = new LocalArchetypeCatalogDialog(getShell(), factory); +- if(dialog.open() == Window.OK) { +- newFactory = dialog.getArchetypeCatalogFactory(); +- } +- } else if(factory instanceof RemoteCatalogFactory) { +- RemoteArchetypeCatalogDialog dialog = new RemoteArchetypeCatalogDialog(getShell(), factory); +- if(dialog.open() == Window.OK) { +- newFactory = dialog.getArchetypeCatalogFactory(); +- } +- } +- if(newFactory != null) { +- int n = archetypeCatalogs.indexOf(factory); +- if(n > -1) { +- archetypeCatalogs.set(n, newFactory); +- archetypesViewer.setInput(archetypeCatalogs); +- archetypesViewer.setSelection(new StructuredSelection(newFactory), true); +- } +- } +- })); +- +- final Button removeButton = new Button(composite, SWT.NONE); +- removeButton.setEnabled(false); +- removeButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, true)); +- removeButton.setText(Messages.MavenArchetypesPreferencePage_btnRemove); +- removeButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { +- ArchetypeCatalogFactory factory = getSelectedArchetypeCatalogFactory(); +- archetypeCatalogs.remove(factory); +- archetypesViewer.setInput(archetypeCatalogs); +- archetypesViewer.setSelection(null, true); +- })); +- +- archetypesViewer.addSelectionChangedListener(event -> { +- if(archetypesViewer.getSelection() instanceof IStructuredSelection) { +- ArchetypeCatalogFactory factory = getSelectedArchetypeCatalogFactory(); +- boolean isEnabled = factory != null && factory.isEditable(); +- removeButton.setEnabled(isEnabled); +- editButton.setEnabled(isEnabled); +- } +- }); +- + archetypesViewer.addCheckStateListener((event) -> { + archetypesViewer.refresh(event.getElement(), true); + }); +@@ -294,18 +214,7 @@ public class MavenArchetypesPreferencePage extends FieldEditorPreferencePage imp + public String getColumnText(Object element, int columnIndex) { + ArchetypeCatalogFactory factory = (ArchetypeCatalogFactory) element; + String description = factory.getDescription(); +- String text; +- if(factory instanceof LocalCatalogFactory) { +- text = NLS.bind(Messages.MavenArchetypesPreferencePage_local, description); +- } else if(factory instanceof RemoteCatalogFactory) { +- if(factory.isEditable()) { +- text = NLS.bind(Messages.MavenArchetypesPreferencePage_remote, description); +- } else { +- text = NLS.bind(Messages.MavenArchetypesPreferencePage_packaged, description); +- } +- } else { +- text = description; +- } ++ String text = description; + + return factory.isEditable() ? text : NLS.bind(Messages.MavenArchetypesPreferencePage_SystemLabel, text); + } +diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenProjectWizardArchetypePage.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenProjectWizardArchetypePage.java +index 90547dd..bb833c4 100644 +--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenProjectWizardArchetypePage.java ++++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenProjectWizardArchetypePage.java +@@ -82,11 +82,13 @@ import org.apache.maven.artifact.Artifact; + import org.apache.maven.artifact.repository.ArtifactRepository; + import org.apache.maven.artifact.versioning.ArtifactVersion; + import org.apache.maven.artifact.versioning.DefaultArtifactVersion; ++import org.apache.maven.project.ProjectBuildingRequest; + + import org.eclipse.m2e.core.MavenPlugin; + import org.eclipse.m2e.core.archetype.ArchetypeUtil; + import org.eclipse.m2e.core.embedder.ArtifactKey; + import org.eclipse.m2e.core.embedder.IMaven; ++import org.eclipse.m2e.core.embedder.IMavenExecutionContext; + import org.eclipse.m2e.core.internal.MavenPluginActivator; + import org.eclipse.m2e.core.internal.archetype.ArchetypeCatalogFactory; + import org.eclipse.m2e.core.internal.archetype.ArchetypeManager; +@@ -848,7 +850,11 @@ public class MavenProjectWizardArchetypePage extends AbstractMavenWizardPage imp + archetype.setRepository(repositoryUrl); + org.apache.maven.archetype.ArchetypeManager archetyper = MavenPluginActivator.getDefault() + .getArchetypeManager().getArchetyper(); +- archetyper.updateLocalCatalog(archetype); ++ ++ IMavenExecutionContext context = maven.createExecutionContext(); ++ ProjectBuildingRequest buildingReq = context.newProjectBuildingRequest(); ++ ++ archetyper.updateLocalCatalog(buildingReq, archetype); + + archetypesCache.clear(); + +diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/ExtensionReader.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/ExtensionReader.java +index a7a4fd4..0afbc71 100644 +--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/ExtensionReader.java ++++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/ExtensionReader.java +@@ -13,11 +13,9 @@ + + package org.eclipse.m2e.core.internal; + +-import java.net.URL; + import java.util.ArrayList; + import java.util.List; + +-import org.osgi.framework.Bundle; + import org.slf4j.Logger; + import org.slf4j.LoggerFactory; + +@@ -84,29 +82,8 @@ public class ExtensionReader { + + private static ArchetypeCatalogFactory readArchetypeCatalogs(IConfigurationElement element, + IContributor contributor) { +- if(ELEMENT_LOCAL_ARCHETYPE.equals(element.getName())) { +- String name = element.getAttribute(ATTR_NAME); +- if(name != null) { +- Bundle[] bundles = Platform.getBundles(contributor.getName(), null); +- URL catalogUrl = null; +- for(int i = 0; i < bundles.length; i++ ) { +- Bundle bundle = bundles[i]; +- catalogUrl = bundle.getEntry(name); +- if(catalogUrl != null) { +- String description = element.getAttribute(ATTR_DESCRIPTION); +- String url = catalogUrl.toString(); +- return new ArchetypeCatalogFactory.LocalCatalogFactory(url, description, false); +- } +- } +- log.error("Unable to find Archetype catalog " + name + " in " + contributor.getName()); +- } +- } else if(ELEMENT_REMOTE_ARCHETYPE.equals(element.getName())) { +- String url = element.getAttribute(ATTR_URL); +- if(url != null) { +- String description = element.getAttribute(ATTR_DESCRIPTION); +- return new ArchetypeCatalogFactory.RemoteCatalogFactory(url, description, false); +- } +- } ++ log.error("Local and remote Archetype catalogs specified by URL from " + contributor.getName() ++ + " are no longer supported"); + return null; + } + +diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java +index 0f486cd..069e210 100644 +--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java ++++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java +@@ -50,8 +50,6 @@ public class Messages extends NLS { + + public static String ArchetypeCatalogFactory_internal; + +- public static String ArchetypeCatalogFactory_local; +- + public static String ArchetypeCatalogFactory_remote; + + public static String ArchetypeCatalogsWriter_error_parse; +diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeCatalogFactory.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeCatalogFactory.java +index 8c82854..3da1f1a 100644 +--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeCatalogFactory.java ++++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeCatalogFactory.java +@@ -31,10 +31,13 @@ import org.eclipse.osgi.util.NLS; + import org.apache.maven.archetype.ArchetypeManager; + import org.apache.maven.archetype.catalog.Archetype; + import org.apache.maven.archetype.catalog.ArchetypeCatalog; +-import org.apache.maven.archetype.catalog.io.xpp3.ArchetypeCatalogXpp3Reader; + import org.apache.maven.archetype.source.ArchetypeDataSource; + import org.apache.maven.archetype.source.ArchetypeDataSourceException; ++import org.apache.maven.project.ProjectBuildingRequest; + ++import org.eclipse.m2e.core.MavenPlugin; ++import org.eclipse.m2e.core.embedder.IMaven; ++import org.eclipse.m2e.core.embedder.IMavenExecutionContext; + import org.eclipse.m2e.core.internal.IMavenConstants; + import org.eclipse.m2e.core.internal.MavenPluginActivator; + import org.eclipse.m2e.core.internal.Messages; +@@ -107,8 +110,12 @@ public abstract class ArchetypeCatalogFactory { + + public ArchetypeCatalog getArchetypeCatalog() throws CoreException { + try { ++ final IMaven maven = MavenPlugin.getMaven(); ++ IMavenExecutionContext context = maven.createExecutionContext(); ++ ProjectBuildingRequest buildingReq = context.newProjectBuildingRequest(); ++ + ArchetypeDataSource source = MavenPluginActivator.getDefault().getIndexManager().getArchetypeCatalog(); +- return source.getArchetypeCatalog(new Properties()); ++ return source.getArchetypeCatalog(buildingReq); + } catch(ArchetypeDataSourceException ex) { + String msg = NLS.bind(Messages.ArchetypeCatalogFactory_error_missing_catalog, ex.getMessage()); + log.error(msg, ex); +@@ -143,156 +150,11 @@ public abstract class ArchetypeCatalogFactory { + super(ID, Messages.ArchetypeCatalogFactory_default_local, false); + } + +- public ArchetypeCatalog getArchetypeCatalog() { +- return getArchetyper().getDefaultLocalCatalog(); +- } +- } +- +- /** +- * Factory for local ArchetypeCatalog +- */ +- public static class LocalCatalogFactory extends ArchetypeCatalogFactory { +- +- public LocalCatalogFactory(String path, String description, boolean editable) { +- this(path, description, editable, true); +- } +- +- public LocalCatalogFactory(String path, String description, boolean editable, boolean enabled) { +- super(path, description == null || description.trim().length() == 0 +- ? NLS.bind(Messages.ArchetypeCatalogFactory_local, path) +- : description, editable, enabled); +- } +- + public ArchetypeCatalog getArchetypeCatalog() throws CoreException { +- ArchetypeCatalog catalog = getEmbeddedCatalog(); +- if(catalog == null) { +- //local but not embedded catalog +- catalog = getArchetyper().getLocalCatalog(getId()); +- } +- return catalog; +- } +- +- private ArchetypeCatalog getEmbeddedCatalog() throws CoreException { +- URL url = getEmbeddedUrl(); +- if(url == null) { +- //Not an embedded catalog, nothing else to do +- return null; +- } +- try (InputStream is = new BufferedInputStream(url.openStream())) { +- return new ArchetypeCatalogXpp3Reader().read(is); +- } catch(Exception ex) { +- String msg = NLS.bind(Messages.ArchetypeCatalogFactory_error_missing_catalog, ex.getMessage()); +- log.error(msg, ex); +- throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, -1, msg, ex)); +- } +- } +- +- private URL getEmbeddedUrl() { +- String path = getId(); +- if(path != null && path.startsWith("bundleentry://")) { +- try { +- return new URL(path); +- } catch(Exception ex) { +- log.error(ex.getMessage(), ex); +- } +- } +- return null; +- } +- } +- +- /** +- * Factory for remote ArchetypeCatalog +- */ +- public static class RemoteCatalogFactory extends ArchetypeCatalogFactory { +- +- private String repositoryUrl = null; +- +- public RemoteCatalogFactory(String url, String description, boolean editable) { +- this(url, description, editable, true); +- } +- +- public RemoteCatalogFactory(String url, String description, boolean editable, boolean enabled) { +- super(url, description == null || description.trim().length() == 0 +- ? NLS.bind(Messages.ArchetypeCatalogFactory_remote, url) +- : description, editable, enabled); +- repositoryUrl = parseCatalogUrl(url); +- } +- +- /** +- * @param url +- * @return +- */ +- private String parseCatalogUrl(String url) { +- if(url == null) { +- return null; +- } +- int length = url.length(); +- if(length > 1 && url.endsWith("/")) //$NON-NLS-1$ +- { +- return url.substring(0, url.length() - 1); +- } +- int idx = url.lastIndexOf("/"); //$NON-NLS-1$ +- idx = (idx > 0) ? idx : 0; +- if(url.lastIndexOf(".") >= idx) { //$NON-NLS-1$ +- //Assume last fragment of the url is a file, let's keep its parent folder +- return url.substring(0, idx); +- } +- return url; +- } +- +- public ArchetypeCatalog getArchetypeCatalog() { +- String url = getId(); +- int idx = url.lastIndexOf("/archetype-catalog.xml"); +- if(idx > -1) { +- url = url.substring(0, idx); +- } +- final ArchetypeCatalog catalog = getArchetyper().getRemoteCatalog(url); +- final String remoteUrl = url; +- @SuppressWarnings("serial") +- ArchetypeCatalog catalogWrapper = new ArchetypeCatalog() { +- public void addArchetype(Archetype archetype) { +- catalog.addArchetype(archetype); +- } +- +- public List getArchetypes() { +- List archetypes = new ArrayList<>(catalog.getArchetypes()); +- for(Archetype arch : archetypes) { +- if(arch.getRepository() == null || arch.getRepository().trim().isEmpty()) { +- arch.setRepository(remoteUrl); +- } +- } +- return archetypes; +- } +- +- public String getModelEncoding() { +- return catalog.getModelEncoding(); +- } +- +- public void removeArchetype(Archetype archetype) { +- catalog.removeArchetype(archetype); +- } +- +- public void setModelEncoding(String modelEncoding) { +- catalog.setModelEncoding(modelEncoding); +- } +- +- public void setArchetypes(List archetypes) { +- catalog.setArchetypes(archetypes); +- } +- +- public String toString() { +- return catalog.toString(); +- } +- }; +- +- return catalogWrapper; +- } +- +- /** +- * @return the url of the remote repository hosting the catalog +- */ +- public String getRepositoryUrl() { +- return repositoryUrl; ++ final IMaven maven = MavenPlugin.getMaven(); ++ IMavenExecutionContext context = maven.createExecutionContext(); ++ ProjectBuildingRequest buildingReq = context.newProjectBuildingRequest(); ++ return getArchetyper().getLocalCatalog(buildingReq); + } + } + +diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeCatalogsWriter.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeCatalogsWriter.java +index 2adb946..31ef580 100644 +--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeCatalogsWriter.java ++++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeCatalogsWriter.java +@@ -45,8 +45,6 @@ import org.xml.sax.helpers.XMLFilterImpl; + import org.eclipse.osgi.util.NLS; + + import org.eclipse.m2e.core.internal.Messages; +-import org.eclipse.m2e.core.internal.archetype.ArchetypeCatalogFactory.LocalCatalogFactory; +-import org.eclipse.m2e.core.internal.archetype.ArchetypeCatalogFactory.RemoteCatalogFactory; + + + /** +@@ -63,14 +61,8 @@ public class ArchetypeCatalogsWriter { + + private static final String ATT_CATALOG_TYPE = "type"; //$NON-NLS-1$ + +- private static final String ATT_CATALOG_LOCATION = "location"; //$NON-NLS-1$ +- + public static final String ATT_CATALOG_DESCRIPTION = "description"; //$NON-NLS-1$ + +- private static final String TYPE_LOCAL = "local"; //$NON-NLS-1$ +- +- private static final String TYPE_REMOTE = "remote"; //$NON-NLS-1$ +- + private static final String TYPE_SYSTEM = "system"; //$NON-NLS-1$ + + public static final String ATT_CATALOG_ID = "id"; +@@ -127,20 +119,8 @@ public class ArchetypeCatalogsWriter { + + for(ArchetypeCatalogFactory factory : this.catalogs) { + AttributesImpl attrs = new AttributesImpl(); +- if(factory.isEditable()) { +- if(factory instanceof LocalCatalogFactory) { +- attrs.addAttribute(null, ATT_CATALOG_TYPE, ATT_CATALOG_TYPE, null, TYPE_LOCAL); +- attrs.addAttribute(null, ATT_CATALOG_LOCATION, ATT_CATALOG_LOCATION, null, factory.getId()); +- attrs.addAttribute(null, ATT_CATALOG_DESCRIPTION, ATT_CATALOG_DESCRIPTION, null, factory.getDescription()); +- } else if(factory instanceof RemoteCatalogFactory) { +- attrs.addAttribute(null, ATT_CATALOG_TYPE, ATT_CATALOG_TYPE, null, TYPE_REMOTE); +- attrs.addAttribute(null, ATT_CATALOG_LOCATION, ATT_CATALOG_LOCATION, null, factory.getId()); +- attrs.addAttribute(null, ATT_CATALOG_DESCRIPTION, ATT_CATALOG_DESCRIPTION, null, factory.getDescription()); +- } +- } else { +- attrs.addAttribute(null, ATT_CATALOG_TYPE, ATT_CATALOG_TYPE, null, TYPE_SYSTEM); +- attrs.addAttribute(null, ATT_CATALOG_ID, ATT_CATALOG_ID, null, factory.getId()); +- } ++ attrs.addAttribute(null, ATT_CATALOG_TYPE, ATT_CATALOG_TYPE, null, TYPE_SYSTEM); ++ attrs.addAttribute(null, ATT_CATALOG_ID, ATT_CATALOG_ID, null, factory.getId()); + attrs.addAttribute(null, ATT_CATALOG_ENABLED, ATT_CATALOG_ENABLED, null, Boolean.toString(factory.isEnabled())); + handler.startElement(null, ELEMENT_CATALOG, ELEMENT_CATALOG, attrs); + handler.endElement(null, ELEMENT_CATALOG, ELEMENT_CATALOG); +@@ -165,28 +145,13 @@ public class ArchetypeCatalogsWriter { + + public void startElement(String uri, String localName, String qName, Attributes attributes) { + if(ELEMENT_CATALOG.equals(qName) && attributes != null) { +- String type = attributes.getValue(ATT_CATALOG_TYPE); + String enabledStr = attributes.getValue(ATT_CATALOG_ENABLED); + boolean enabled = enabledStr==null||Boolean.parseBoolean(enabledStr); +- if(TYPE_LOCAL.equals(type)) { +- String path = attributes.getValue(ATT_CATALOG_LOCATION); +- if(path != null) { +- String description = attributes.getValue(ATT_CATALOG_DESCRIPTION); +- catalogs.add(new LocalCatalogFactory(path, description, true, enabled)); +- } +- } else if(TYPE_REMOTE.equals(type)) { +- String url = attributes.getValue(ATT_CATALOG_LOCATION); +- if(url != null) { +- String description = attributes.getValue(ATT_CATALOG_DESCRIPTION); +- catalogs.add(new RemoteCatalogFactory(url, description, true, enabled)); +- } +- } else { +- String id = attributes.getValue(ATT_CATALOG_ID); +- if(id != null && !id.isEmpty()) { +- ArchetypeCatalogFactory catalog = existingCatalogs.get(id); +- if(catalog != null) { +- catalog.setEnabled(enabled); +- } ++ String id = attributes.getValue(ATT_CATALOG_ID); ++ if(id != null && !id.isEmpty()) { ++ ArchetypeCatalogFactory catalog = existingCatalogs.get(id); ++ if(catalog != null) { ++ catalog.setEnabled(enabled); + } + } + } +diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeManager.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeManager.java +index d14614f..c98dead 100644 +--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeManager.java ++++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeManager.java +@@ -180,11 +180,12 @@ public class ArchetypeManager { + try { + return maven.execute((context, monitor1) -> { + ArtifactRepository localRepository = context.getLocalRepository(); +- if(aaMgr.isFileSetArchetype(groupId, artifactId, version, null, localRepository, repositories)) { ++ if(aaMgr.isFileSetArchetype(groupId, artifactId, version, null, localRepository, repositories, ++ context.newProjectBuildingRequest())) { + ArchetypeDescriptor descriptor; + try { + descriptor = aaMgr.getFileSetArchetypeDescriptor(groupId, artifactId, version, null, localRepository, +- repositories); ++ repositories, context.newProjectBuildingRequest()); + } catch(UnknownArchetype ex) { + throw new WrappedUnknownArchetype(ex); + } +-- +2.26.0.rc2 + diff --git a/0005-Remove-mandatory-attirbutes-from-OSGi-manifests-whic.patch b/0005-Remove-mandatory-attirbutes-from-OSGi-manifests-whic.patch deleted file mode 100644 index 7cea2c0..0000000 --- a/0005-Remove-mandatory-attirbutes-from-OSGi-manifests-whic.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 5bfc220447528961cf47627e6682eb87c5dcaf04 Mon Sep 17 00:00:00 2001 -From: Mat Booth -Date: Fri, 21 Jun 2019 11:27:12 +0100 -Subject: [PATCH 5/6] Remove mandatory attirbutes from OSGi manifests, which - cause problems with P2 - ---- - .../org.eclipse.m2e.archetype.common/pom.xml | 4 ++-- - .../org.eclipse.m2e.maven.indexer/pom.xml | 3 +-- - .../org.eclipse.m2e.maven.runtime/pom.xml | 12 ++++++------ - 3 files changed, 9 insertions(+), 10 deletions(-) - -diff --git a/m2e-maven-runtime/org.eclipse.m2e.archetype.common/pom.xml b/m2e-maven-runtime/org.eclipse.m2e.archetype.common/pom.xml -index e06a064..57eaca4 100644 ---- a/m2e-maven-runtime/org.eclipse.m2e.archetype.common/pom.xml -+++ b/m2e-maven-runtime/org.eclipse.m2e.archetype.common/pom.xml -@@ -82,8 +82,8 @@ - - <_exportcontents> - META-INF.plexus;-noimport:=true;x-internal:=true, -- org.apache.maven.archetype.*;provider=m2e;mandatory:=provider;x-internal:=true, -- org.codehaus.plexus.velocity;provider=m2e;mandatory:=provider;x-internal:=true, -+ org.apache.maven.archetype.*;provider=m2e;x-internal:=true, -+ org.codehaus.plexus.velocity;provider=m2e;x-internal:=true, - - - -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 06c39a3..0d35e9b 100644 ---- a/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/pom.xml -+++ b/m2e-maven-runtime/org.eclipse.m2e.maven.indexer/pom.xml -@@ -65,8 +65,7 @@ - - <_exportcontents> - META-INF.plexus;-noimport:=true, -- org.apache.lucene.*;provider=m2e;mandatory:=provider, -- org.apache.maven.*;provider=m2e;mandatory:=provider, -+ org.apache.maven.*;provider=m2e, - - - -diff --git a/m2e-maven-runtime/org.eclipse.m2e.maven.runtime/pom.xml b/m2e-maven-runtime/org.eclipse.m2e.maven.runtime/pom.xml -index 012edf6..948b4ef 100644 ---- a/m2e-maven-runtime/org.eclipse.m2e.maven.runtime/pom.xml -+++ b/m2e-maven-runtime/org.eclipse.m2e.maven.runtime/pom.xml -@@ -140,12 +140,12 @@ - <_exportcontents> - META-INF.plexus;-noimport:=true, - META-INF.sisu;-noimport:=true, -- org.apache.maven.*;provider=m2e;mandatory:=provider, -- org.codehaus.plexus.*;provider=m2e;mandatory:=provider, -- org.sonatype.plexus.*;provider=m2e;mandatory:=provider, -- org.eclipse.aether.*;provider=m2e;mandatory:=provider;version=1.1.1, -- com.google.inject.*;provider=m2e;mandatory:=provider, -- io.takari.*;provider=m2e;mandatory:=provider -+ org.apache.maven.*;provider=m2e, -+ org.codehaus.plexus.*;provider=m2e, -+ org.sonatype.plexus.*;provider=m2e, -+ org.eclipse.aether.*;provider=m2e, -+ com.google.inject.*;provider=m2e, -+ io.takari.*;provider=m2e - - - --- -2.21.0 - diff --git a/0006-Port-to-latest-version-of-maven-archetypes.patch b/0006-Port-to-latest-version-of-maven-archetypes.patch deleted file mode 100644 index 3aa6ae2..0000000 --- a/0006-Port-to-latest-version-of-maven-archetypes.patch +++ /dev/null @@ -1,582 +0,0 @@ -From 1e6c94ad3bbe31d299bbc5a3feebed839eeeab82 Mon Sep 17 00:00:00 2001 -From: Mat Booth -Date: Wed, 3 Jul 2019 15:29:05 +0100 -Subject: [PATCH 6/6] Port to latest version of maven-archetypes - -Change-Id: I208abd50bdbe420d5413ad12bbe5150c428c9453 ---- - .../org.eclipse.m2e.archetype.common/pom.xml | 9 +- - .../MavenArchetypesPreferencePage.java | 109 +----------- - .../MavenProjectWizardArchetypePage.java | 8 +- - .../m2e/core/internal/ExtensionReader.java | 27 +-- - .../eclipse/m2e/core/internal/Messages.java | 2 - - .../archetype/ArchetypeCatalogFactory.java | 164 ++---------------- - .../archetype/ArchetypeCatalogsWriter.java | 49 +----- - .../internal/archetype/ArchetypeManager.java | 5 +- - 8 files changed, 34 insertions(+), 339 deletions(-) - -diff --git a/m2e-maven-runtime/org.eclipse.m2e.archetype.common/pom.xml b/m2e-maven-runtime/org.eclipse.m2e.archetype.common/pom.xml -index 57eaca4..29a2496 100644 ---- a/m2e-maven-runtime/org.eclipse.m2e.archetype.common/pom.xml -+++ b/m2e-maven-runtime/org.eclipse.m2e.archetype.common/pom.xml -@@ -24,7 +24,7 @@ - Maven Archetype Common Bundle - - -- 2.4 -+ 3.1.1 - - - -@@ -34,11 +34,6 @@ - ${archetype-common.version} - true - -- -- -- velocity -- velocity -- - - plexus-container-default - org.codehaus.plexus -@@ -67,12 +62,10 @@ - archetype-common, - archetype-catalog, - archetype-descriptor, -- archetype-registry, - maven-invoker, - commons-collections, - commons-io, - commons-lang, -- dom4j, - jchardet, - jdom, - oro, -diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/MavenArchetypesPreferencePage.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/MavenArchetypesPreferencePage.java -index 6a931a0..503e69b 100644 ---- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/MavenArchetypesPreferencePage.java -+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/MavenArchetypesPreferencePage.java -@@ -57,8 +57,6 @@ import org.eclipse.ui.browser.IWebBrowser; - - import org.eclipse.m2e.core.internal.MavenPluginActivator; - import org.eclipse.m2e.core.internal.archetype.ArchetypeCatalogFactory; --import org.eclipse.m2e.core.internal.archetype.ArchetypeCatalogFactory.LocalCatalogFactory; --import org.eclipse.m2e.core.internal.archetype.ArchetypeCatalogFactory.RemoteCatalogFactory; - import org.eclipse.m2e.core.internal.archetype.ArchetypeManager; - import org.eclipse.m2e.core.ui.internal.Messages; - -@@ -181,100 +179,6 @@ public class MavenArchetypesPreferencePage extends PreferencePage implements IWo - typeColumn.setWidth(250); - typeColumn.setText(""); //$NON-NLS-1$ - -- Button enableAllBtn = new Button(composite, SWT.NONE); -- enableAllBtn.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); -- enableAllBtn.setText(Messages.MavenArchetypesPreferencePage_btnEnableAll); -- enableAllBtn.addSelectionListener(new SelectionAdapter() { -- public void widgetSelected(SelectionEvent e) { -- toggleRepositories(true); -- } -- }); -- -- Button disableAllBtn = new Button(composite, SWT.NONE); -- disableAllBtn.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); -- disableAllBtn.setText(Messages.MavenArchetypesPreferencePage_btnDisableAll); -- disableAllBtn.addSelectionListener(new SelectionAdapter() { -- public void widgetSelected(SelectionEvent e) { -- toggleRepositories(false); -- } -- }); -- -- Button addLocalButton = new Button(composite, SWT.NONE); -- addLocalButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); -- addLocalButton.setText(Messages.MavenArchetypesPreferencePage_btnAddLocal); -- addLocalButton.addSelectionListener(new SelectionAdapter() { -- public void widgetSelected(SelectionEvent e) { -- LocalArchetypeCatalogDialog dialog = new LocalArchetypeCatalogDialog(getShell(), null); -- if(dialog.open() == Window.OK) { -- addCatalogFactory(dialog.getArchetypeCatalogFactory()); -- } -- } -- }); -- -- Button addRemoteButton = new Button(composite, SWT.NONE); -- addRemoteButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); -- addRemoteButton.setText(Messages.MavenArchetypesPreferencePage_btnAddRemote); -- addRemoteButton.addSelectionListener(new SelectionAdapter() { -- public void widgetSelected(SelectionEvent e) { -- RemoteArchetypeCatalogDialog dialog = new RemoteArchetypeCatalogDialog(getShell(), null); -- if(dialog.open() == Window.OK) { -- addCatalogFactory(dialog.getArchetypeCatalogFactory()); -- } -- } -- }); -- -- final Button editButton = new Button(composite, SWT.NONE); -- editButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); -- editButton.setEnabled(false); -- editButton.setText(Messages.MavenArchetypesPreferencePage_btnEdit); -- editButton.addSelectionListener(new SelectionAdapter() { -- public void widgetSelected(SelectionEvent e) { -- ArchetypeCatalogFactory factory = getSelectedArchetypeCatalogFactory(); -- ArchetypeCatalogFactory newFactory = null; -- if(factory instanceof LocalCatalogFactory) { -- LocalArchetypeCatalogDialog dialog = new LocalArchetypeCatalogDialog(getShell(), factory); -- if(dialog.open() == Window.OK) { -- newFactory = dialog.getArchetypeCatalogFactory(); -- } -- } else if(factory instanceof RemoteCatalogFactory) { -- RemoteArchetypeCatalogDialog dialog = new RemoteArchetypeCatalogDialog(getShell(), factory); -- if(dialog.open() == Window.OK) { -- newFactory = dialog.getArchetypeCatalogFactory(); -- } -- } -- if(newFactory != null) { -- int n = archetypeCatalogs.indexOf(factory); -- if(n > -1) { -- archetypeCatalogs.set(n, newFactory); -- archetypesViewer.setInput(archetypeCatalogs); -- archetypesViewer.setSelection(new StructuredSelection(newFactory), true); -- } -- } -- } -- }); -- -- final Button removeButton = new Button(composite, SWT.NONE); -- removeButton.setEnabled(false); -- removeButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, true)); -- removeButton.setText(Messages.MavenArchetypesPreferencePage_btnRemove); -- removeButton.addSelectionListener(new SelectionAdapter() { -- public void widgetSelected(SelectionEvent e) { -- ArchetypeCatalogFactory factory = getSelectedArchetypeCatalogFactory(); -- archetypeCatalogs.remove(factory); -- archetypesViewer.setInput(archetypeCatalogs); -- archetypesViewer.setSelection(null, true); -- } -- }); -- -- archetypesViewer.addSelectionChangedListener(event -> { -- if(archetypesViewer.getSelection() instanceof IStructuredSelection) { -- ArchetypeCatalogFactory factory = getSelectedArchetypeCatalogFactory(); -- boolean isEnabled = factory != null && factory.isEditable(); -- removeButton.setEnabled(isEnabled); -- editButton.setEnabled(isEnabled); -- } -- }); -- - archetypesViewer.addCheckStateListener((event) -> { - archetypesViewer.refresh(event.getElement(), true); - }); -@@ -316,18 +220,7 @@ public class MavenArchetypesPreferencePage extends PreferencePage implements IWo - public String getColumnText(Object element, int columnIndex) { - ArchetypeCatalogFactory factory = (ArchetypeCatalogFactory) element; - String description = factory.getDescription(); -- String text; -- if(factory instanceof LocalCatalogFactory) { -- text = NLS.bind(Messages.MavenArchetypesPreferencePage_local, description); -- } else if(factory instanceof RemoteCatalogFactory) { -- if(factory.isEditable()) { -- text = NLS.bind(Messages.MavenArchetypesPreferencePage_remote, description); -- } else { -- text = NLS.bind(Messages.MavenArchetypesPreferencePage_packaged, description); -- } -- } else { -- text = description; -- } -+ String text = description; - - return factory.isEditable() ? text : NLS.bind(Messages.MavenArchetypesPreferencePage_SystemLabel, text); - } -diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenProjectWizardArchetypePage.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenProjectWizardArchetypePage.java -index 663854d..d868da4 100644 ---- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenProjectWizardArchetypePage.java -+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/wizards/MavenProjectWizardArchetypePage.java -@@ -83,11 +83,13 @@ import org.apache.maven.artifact.Artifact; - import org.apache.maven.artifact.repository.ArtifactRepository; - import org.apache.maven.artifact.versioning.ArtifactVersion; - import org.apache.maven.artifact.versioning.DefaultArtifactVersion; -+import org.apache.maven.project.ProjectBuildingRequest; - - import org.eclipse.m2e.core.MavenPlugin; - import org.eclipse.m2e.core.archetype.ArchetypeUtil; - import org.eclipse.m2e.core.embedder.ArtifactKey; - import org.eclipse.m2e.core.embedder.IMaven; -+import org.eclipse.m2e.core.embedder.IMavenExecutionContext; - import org.eclipse.m2e.core.internal.MavenPluginActivator; - import org.eclipse.m2e.core.internal.archetype.ArchetypeCatalogFactory; - import org.eclipse.m2e.core.internal.archetype.ArchetypeManager; -@@ -850,7 +852,11 @@ public class MavenProjectWizardArchetypePage extends AbstractMavenWizardPage imp - archetype.setRepository(repositoryUrl); - org.apache.maven.archetype.ArchetypeManager archetyper = MavenPluginActivator.getDefault() - .getArchetypeManager().getArchetyper(); -- archetyper.updateLocalCatalog(archetype); -+ -+ IMavenExecutionContext context = maven.createExecutionContext(); -+ ProjectBuildingRequest buildingReq = context.newProjectBuildingRequest(); -+ -+ archetyper.updateLocalCatalog(buildingReq, archetype); - - archetypesCache.clear(); - -diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/ExtensionReader.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/ExtensionReader.java -index a7a4fd4..0afbc71 100644 ---- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/ExtensionReader.java -+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/ExtensionReader.java -@@ -13,11 +13,9 @@ - - package org.eclipse.m2e.core.internal; - --import java.net.URL; - import java.util.ArrayList; - import java.util.List; - --import org.osgi.framework.Bundle; - import org.slf4j.Logger; - import org.slf4j.LoggerFactory; - -@@ -84,29 +82,8 @@ public class ExtensionReader { - - private static ArchetypeCatalogFactory readArchetypeCatalogs(IConfigurationElement element, - IContributor contributor) { -- if(ELEMENT_LOCAL_ARCHETYPE.equals(element.getName())) { -- String name = element.getAttribute(ATTR_NAME); -- if(name != null) { -- Bundle[] bundles = Platform.getBundles(contributor.getName(), null); -- URL catalogUrl = null; -- for(int i = 0; i < bundles.length; i++ ) { -- Bundle bundle = bundles[i]; -- catalogUrl = bundle.getEntry(name); -- if(catalogUrl != null) { -- String description = element.getAttribute(ATTR_DESCRIPTION); -- String url = catalogUrl.toString(); -- return new ArchetypeCatalogFactory.LocalCatalogFactory(url, description, false); -- } -- } -- log.error("Unable to find Archetype catalog " + name + " in " + contributor.getName()); -- } -- } else if(ELEMENT_REMOTE_ARCHETYPE.equals(element.getName())) { -- String url = element.getAttribute(ATTR_URL); -- if(url != null) { -- String description = element.getAttribute(ATTR_DESCRIPTION); -- return new ArchetypeCatalogFactory.RemoteCatalogFactory(url, description, false); -- } -- } -+ log.error("Local and remote Archetype catalogs specified by URL from " + contributor.getName() -+ + " are no longer supported"); - return null; - } - -diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java -index 0f486cd..069e210 100644 ---- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java -+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java -@@ -50,8 +50,6 @@ public class Messages extends NLS { - - public static String ArchetypeCatalogFactory_internal; - -- public static String ArchetypeCatalogFactory_local; -- - public static String ArchetypeCatalogFactory_remote; - - public static String ArchetypeCatalogsWriter_error_parse; -diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeCatalogFactory.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeCatalogFactory.java -index 8c82854..3da1f1a 100644 ---- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeCatalogFactory.java -+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeCatalogFactory.java -@@ -31,10 +31,13 @@ import org.eclipse.osgi.util.NLS; - import org.apache.maven.archetype.ArchetypeManager; - import org.apache.maven.archetype.catalog.Archetype; - import org.apache.maven.archetype.catalog.ArchetypeCatalog; --import org.apache.maven.archetype.catalog.io.xpp3.ArchetypeCatalogXpp3Reader; - import org.apache.maven.archetype.source.ArchetypeDataSource; - import org.apache.maven.archetype.source.ArchetypeDataSourceException; -+import org.apache.maven.project.ProjectBuildingRequest; - -+import org.eclipse.m2e.core.MavenPlugin; -+import org.eclipse.m2e.core.embedder.IMaven; -+import org.eclipse.m2e.core.embedder.IMavenExecutionContext; - import org.eclipse.m2e.core.internal.IMavenConstants; - import org.eclipse.m2e.core.internal.MavenPluginActivator; - import org.eclipse.m2e.core.internal.Messages; -@@ -107,8 +110,12 @@ public abstract class ArchetypeCatalogFactory { - - public ArchetypeCatalog getArchetypeCatalog() throws CoreException { - try { -+ final IMaven maven = MavenPlugin.getMaven(); -+ IMavenExecutionContext context = maven.createExecutionContext(); -+ ProjectBuildingRequest buildingReq = context.newProjectBuildingRequest(); -+ - ArchetypeDataSource source = MavenPluginActivator.getDefault().getIndexManager().getArchetypeCatalog(); -- return source.getArchetypeCatalog(new Properties()); -+ return source.getArchetypeCatalog(buildingReq); - } catch(ArchetypeDataSourceException ex) { - String msg = NLS.bind(Messages.ArchetypeCatalogFactory_error_missing_catalog, ex.getMessage()); - log.error(msg, ex); -@@ -143,156 +150,11 @@ public abstract class ArchetypeCatalogFactory { - super(ID, Messages.ArchetypeCatalogFactory_default_local, false); - } - -- public ArchetypeCatalog getArchetypeCatalog() { -- return getArchetyper().getDefaultLocalCatalog(); -- } -- } -- -- /** -- * Factory for local ArchetypeCatalog -- */ -- public static class LocalCatalogFactory extends ArchetypeCatalogFactory { -- -- public LocalCatalogFactory(String path, String description, boolean editable) { -- this(path, description, editable, true); -- } -- -- public LocalCatalogFactory(String path, String description, boolean editable, boolean enabled) { -- super(path, description == null || description.trim().length() == 0 -- ? NLS.bind(Messages.ArchetypeCatalogFactory_local, path) -- : description, editable, enabled); -- } -- - public ArchetypeCatalog getArchetypeCatalog() throws CoreException { -- ArchetypeCatalog catalog = getEmbeddedCatalog(); -- if(catalog == null) { -- //local but not embedded catalog -- catalog = getArchetyper().getLocalCatalog(getId()); -- } -- return catalog; -- } -- -- private ArchetypeCatalog getEmbeddedCatalog() throws CoreException { -- URL url = getEmbeddedUrl(); -- if(url == null) { -- //Not an embedded catalog, nothing else to do -- return null; -- } -- try (InputStream is = new BufferedInputStream(url.openStream())) { -- return new ArchetypeCatalogXpp3Reader().read(is); -- } catch(Exception ex) { -- String msg = NLS.bind(Messages.ArchetypeCatalogFactory_error_missing_catalog, ex.getMessage()); -- log.error(msg, ex); -- throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, -1, msg, ex)); -- } -- } -- -- private URL getEmbeddedUrl() { -- String path = getId(); -- if(path != null && path.startsWith("bundleentry://")) { -- try { -- return new URL(path); -- } catch(Exception ex) { -- log.error(ex.getMessage(), ex); -- } -- } -- return null; -- } -- } -- -- /** -- * Factory for remote ArchetypeCatalog -- */ -- public static class RemoteCatalogFactory extends ArchetypeCatalogFactory { -- -- private String repositoryUrl = null; -- -- public RemoteCatalogFactory(String url, String description, boolean editable) { -- this(url, description, editable, true); -- } -- -- public RemoteCatalogFactory(String url, String description, boolean editable, boolean enabled) { -- super(url, description == null || description.trim().length() == 0 -- ? NLS.bind(Messages.ArchetypeCatalogFactory_remote, url) -- : description, editable, enabled); -- repositoryUrl = parseCatalogUrl(url); -- } -- -- /** -- * @param url -- * @return -- */ -- private String parseCatalogUrl(String url) { -- if(url == null) { -- return null; -- } -- int length = url.length(); -- if(length > 1 && url.endsWith("/")) //$NON-NLS-1$ -- { -- return url.substring(0, url.length() - 1); -- } -- int idx = url.lastIndexOf("/"); //$NON-NLS-1$ -- idx = (idx > 0) ? idx : 0; -- if(url.lastIndexOf(".") >= idx) { //$NON-NLS-1$ -- //Assume last fragment of the url is a file, let's keep its parent folder -- return url.substring(0, idx); -- } -- return url; -- } -- -- public ArchetypeCatalog getArchetypeCatalog() { -- String url = getId(); -- int idx = url.lastIndexOf("/archetype-catalog.xml"); -- if(idx > -1) { -- url = url.substring(0, idx); -- } -- final ArchetypeCatalog catalog = getArchetyper().getRemoteCatalog(url); -- final String remoteUrl = url; -- @SuppressWarnings("serial") -- ArchetypeCatalog catalogWrapper = new ArchetypeCatalog() { -- public void addArchetype(Archetype archetype) { -- catalog.addArchetype(archetype); -- } -- -- public List getArchetypes() { -- List archetypes = new ArrayList<>(catalog.getArchetypes()); -- for(Archetype arch : archetypes) { -- if(arch.getRepository() == null || arch.getRepository().trim().isEmpty()) { -- arch.setRepository(remoteUrl); -- } -- } -- return archetypes; -- } -- -- public String getModelEncoding() { -- return catalog.getModelEncoding(); -- } -- -- public void removeArchetype(Archetype archetype) { -- catalog.removeArchetype(archetype); -- } -- -- public void setModelEncoding(String modelEncoding) { -- catalog.setModelEncoding(modelEncoding); -- } -- -- public void setArchetypes(List archetypes) { -- catalog.setArchetypes(archetypes); -- } -- -- public String toString() { -- return catalog.toString(); -- } -- }; -- -- return catalogWrapper; -- } -- -- /** -- * @return the url of the remote repository hosting the catalog -- */ -- public String getRepositoryUrl() { -- return repositoryUrl; -+ final IMaven maven = MavenPlugin.getMaven(); -+ IMavenExecutionContext context = maven.createExecutionContext(); -+ ProjectBuildingRequest buildingReq = context.newProjectBuildingRequest(); -+ return getArchetyper().getLocalCatalog(buildingReq); - } - } - -diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeCatalogsWriter.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeCatalogsWriter.java -index 2adb946..31ef580 100644 ---- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeCatalogsWriter.java -+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeCatalogsWriter.java -@@ -45,8 +45,6 @@ import org.xml.sax.helpers.XMLFilterImpl; - import org.eclipse.osgi.util.NLS; - - import org.eclipse.m2e.core.internal.Messages; --import org.eclipse.m2e.core.internal.archetype.ArchetypeCatalogFactory.LocalCatalogFactory; --import org.eclipse.m2e.core.internal.archetype.ArchetypeCatalogFactory.RemoteCatalogFactory; - - - /** -@@ -63,14 +61,8 @@ public class ArchetypeCatalogsWriter { - - private static final String ATT_CATALOG_TYPE = "type"; //$NON-NLS-1$ - -- private static final String ATT_CATALOG_LOCATION = "location"; //$NON-NLS-1$ -- - public static final String ATT_CATALOG_DESCRIPTION = "description"; //$NON-NLS-1$ - -- private static final String TYPE_LOCAL = "local"; //$NON-NLS-1$ -- -- private static final String TYPE_REMOTE = "remote"; //$NON-NLS-1$ -- - private static final String TYPE_SYSTEM = "system"; //$NON-NLS-1$ - - public static final String ATT_CATALOG_ID = "id"; -@@ -127,20 +119,8 @@ public class ArchetypeCatalogsWriter { - - for(ArchetypeCatalogFactory factory : this.catalogs) { - AttributesImpl attrs = new AttributesImpl(); -- if(factory.isEditable()) { -- if(factory instanceof LocalCatalogFactory) { -- attrs.addAttribute(null, ATT_CATALOG_TYPE, ATT_CATALOG_TYPE, null, TYPE_LOCAL); -- attrs.addAttribute(null, ATT_CATALOG_LOCATION, ATT_CATALOG_LOCATION, null, factory.getId()); -- attrs.addAttribute(null, ATT_CATALOG_DESCRIPTION, ATT_CATALOG_DESCRIPTION, null, factory.getDescription()); -- } else if(factory instanceof RemoteCatalogFactory) { -- attrs.addAttribute(null, ATT_CATALOG_TYPE, ATT_CATALOG_TYPE, null, TYPE_REMOTE); -- attrs.addAttribute(null, ATT_CATALOG_LOCATION, ATT_CATALOG_LOCATION, null, factory.getId()); -- attrs.addAttribute(null, ATT_CATALOG_DESCRIPTION, ATT_CATALOG_DESCRIPTION, null, factory.getDescription()); -- } -- } else { -- attrs.addAttribute(null, ATT_CATALOG_TYPE, ATT_CATALOG_TYPE, null, TYPE_SYSTEM); -- attrs.addAttribute(null, ATT_CATALOG_ID, ATT_CATALOG_ID, null, factory.getId()); -- } -+ attrs.addAttribute(null, ATT_CATALOG_TYPE, ATT_CATALOG_TYPE, null, TYPE_SYSTEM); -+ attrs.addAttribute(null, ATT_CATALOG_ID, ATT_CATALOG_ID, null, factory.getId()); - attrs.addAttribute(null, ATT_CATALOG_ENABLED, ATT_CATALOG_ENABLED, null, Boolean.toString(factory.isEnabled())); - handler.startElement(null, ELEMENT_CATALOG, ELEMENT_CATALOG, attrs); - handler.endElement(null, ELEMENT_CATALOG, ELEMENT_CATALOG); -@@ -165,28 +145,13 @@ public class ArchetypeCatalogsWriter { - - public void startElement(String uri, String localName, String qName, Attributes attributes) { - if(ELEMENT_CATALOG.equals(qName) && attributes != null) { -- String type = attributes.getValue(ATT_CATALOG_TYPE); - String enabledStr = attributes.getValue(ATT_CATALOG_ENABLED); - boolean enabled = enabledStr==null||Boolean.parseBoolean(enabledStr); -- if(TYPE_LOCAL.equals(type)) { -- String path = attributes.getValue(ATT_CATALOG_LOCATION); -- if(path != null) { -- String description = attributes.getValue(ATT_CATALOG_DESCRIPTION); -- catalogs.add(new LocalCatalogFactory(path, description, true, enabled)); -- } -- } else if(TYPE_REMOTE.equals(type)) { -- String url = attributes.getValue(ATT_CATALOG_LOCATION); -- if(url != null) { -- String description = attributes.getValue(ATT_CATALOG_DESCRIPTION); -- catalogs.add(new RemoteCatalogFactory(url, description, true, enabled)); -- } -- } else { -- String id = attributes.getValue(ATT_CATALOG_ID); -- if(id != null && !id.isEmpty()) { -- ArchetypeCatalogFactory catalog = existingCatalogs.get(id); -- if(catalog != null) { -- catalog.setEnabled(enabled); -- } -+ String id = attributes.getValue(ATT_CATALOG_ID); -+ if(id != null && !id.isEmpty()) { -+ ArchetypeCatalogFactory catalog = existingCatalogs.get(id); -+ if(catalog != null) { -+ catalog.setEnabled(enabled); - } - } - } -diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeManager.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeManager.java -index 6096dab..34d54d4 100644 ---- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeManager.java -+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/archetype/ArchetypeManager.java -@@ -183,11 +183,12 @@ public class ArchetypeManager { - return maven.execute(new ICallable>() { - public List call(IMavenExecutionContext context, IProgressMonitor monitor) { - ArtifactRepository localRepository = context.getLocalRepository(); -- if(aaMgr.isFileSetArchetype(groupId, artifactId, version, null, localRepository, repositories)) { -+ if(aaMgr.isFileSetArchetype(groupId, artifactId, version, null, localRepository, repositories, -+ context.newProjectBuildingRequest())) { - ArchetypeDescriptor descriptor; - try { - descriptor = aaMgr.getFileSetArchetypeDescriptor(groupId, artifactId, version, null, localRepository, -- repositories); -+ repositories, context.newProjectBuildingRequest()); - } catch(UnknownArchetype ex) { - throw new WrappedUnknownArchetype(ex); - } --- -2.21.0 - diff --git a/eclipse-m2e-core.spec b/eclipse-m2e-core.spec index 07a465f..8827aba 100644 --- a/eclipse-m2e-core.spec +++ b/eclipse-m2e-core.spec @@ -1,8 +1,8 @@ -%global release_dir m2e-core-acf8703b40fd6aebecd9a00ef2c57536cdb55ac5 +%global release_dir m2e-core-8328691915d0e67544c97597b0ea02d559f0f4ea Name: eclipse-m2e-core -Version: 1.14.0 -Release: 2%{?dist} +Version: 1.15.0 +Release: 1%{?dist} Summary: Maven integration for Eclipse # Most of components are under EPL, but some of them are licensed under @@ -23,10 +23,10 @@ Patch2: 0003-Adapt-to-API-change-in-aether.patch # Remove "mandatory" attirbutes from OSGi manifests, which cause problems with P2. # See https://dev.eclipse.org/mhonarc/lists/p2-dev/msg05465.html -Patch3: 0005-Remove-mandatory-attirbutes-from-OSGi-manifests-whic.patch +Patch3: 0004-Remove-mandatory-attirbutes-from-OSGi-manifests-whic.patch # Use latest version of maven-archetypes -Patch4: 0006-Port-to-latest-version-of-maven-archetypes.patch +Patch4: 0005-Port-to-latest-version-of-maven-archetypes.patch BuildArch: noarch @@ -358,6 +358,9 @@ xmvn-subst -s $(find %{buildroot}%{_datadir}/eclipse/droplets/m2e-core -name jar %license LICENSE-2.0.txt %changelog +* Sun Mar 22 2020 Mat Booth - 1.15.0-1 +- Update to latest upstream release + * Tue Jan 07 2020 Mat Booth - 1.14.0-2 - Correctly obsolete tests diff --git a/eclipse-m2e-maven353.patch b/eclipse-m2e-maven353.patch deleted file mode 100644 index 91d3501..0000000 --- a/eclipse-m2e-maven353.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 34867d6eecf3cc1a44aa14021f88ba95b55efb96 Mon Sep 17 00:00:00 2001 -From: Fred Bricon -Date: Tue, 13 Mar 2018 17:01:00 -0400 -Subject: Update Maven embedder to 3.5.3 - -Change-Id: If72332c8d627016ecaf9ebd7afddef33809a03fe -Signed-off-by: Fred Bricon ---- - .../eclipse/m2e/core/internal/project/EclipseExtensionRealmCache.java | 2 +- - .../eclipse/m2e/core/internal/project/EclipsePluginRealmCache.java | 2 +- - .../eclipse/m2e/core/internal/project/EclipseProjectRealmCache.java | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - -diff --git org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/EclipseExtensionRealmCache.java org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/EclipseExtensionRealmCache.java -index 794b00a..147c055 100644 ---- org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/EclipseExtensionRealmCache.java -+++ org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/EclipseExtensionRealmCache.java -@@ -34,7 +34,7 @@ public class EclipseExtensionRealmCache extends DefaultExtensionRealmCache imple - protected void flush(Key cacheKey) { - CacheRecord cacheRecord = cache.remove(cacheKey); - if(cacheRecord != null) { -- disposeClassRealm(cacheRecord.getRealm()); -+ disposeClassRealm(cacheRecord.realm); - } - } - }; -diff --git org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/EclipsePluginRealmCache.java org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/EclipsePluginRealmCache.java -index 835fea5..6520137 100644 ---- org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/EclipsePluginRealmCache.java -+++ org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/EclipsePluginRealmCache.java -@@ -33,7 +33,7 @@ public class EclipsePluginRealmCache extends DefaultPluginRealmCache implements - protected void flush(Key cacheKey) { - CacheRecord cacheRecord = cache.remove(cacheKey); - if(cacheRecord != null) { -- disposeClassRealm(cacheRecord.getRealm()); -+ disposeClassRealm(cacheRecord.realm); - } - } - }; -diff --git org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/EclipseProjectRealmCache.java org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/EclipseProjectRealmCache.java -index 4cd4c29..4292d99 100644 ---- org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/EclipseProjectRealmCache.java -+++ org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/EclipseProjectRealmCache.java -@@ -33,7 +33,7 @@ public class EclipseProjectRealmCache extends DefaultProjectRealmCache implement - protected void flush(Key cacheKey) { - CacheRecord cacheRecord = cache.remove(cacheKey); - if(cacheRecord != null) { -- disposeClassRealm(cacheRecord.getRealm()); -+ disposeClassRealm(cacheRecord.realm); - } - } - }; --- -cgit v1.1 - diff --git a/sources b/sources index 128ef59..7cd5736 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (m2e-core-acf8703b40fd6aebecd9a00ef2c57536cdb55ac5.tar.xz) = 539729e29c0c9d5b77cd7d878ba57420ce6e0bcdcf9d4c7b27d2db0835d138f30870eb465487894d31e6fa9afba6e8aa881b324211cfc0ed7229706a4e72b2d7 +SHA512 (m2e-core-8328691915d0e67544c97597b0ea02d559f0f4ea.tar.xz) = 48b71abc8d7ad450a3f9e3d4e5ed03601065bd3f313bbd197f1513a9d72d29d115fe40b8ea73d6d7b185fc66799caac08c9871adc5118e60db35096180836c33