From 449dc3a187225c65f18111059c953f2c287ade56 Mon Sep 17 00:00:00 2001 From: "CORP\\mmrzik" Date: Mon, 8 Jan 2024 21:25:19 +0100 Subject: [PATCH] #138: added updater for mvn 4.x versions --- .../ide/tool/eclipse/EclipseUrlUpdater.java | 2 +- .../tools/ide/tool/mvn/Mvn4UrlUpdater.java | 42 +++++++++++++++++++ .../tools/ide/url/updater/UpdateManager.java | 12 +++--- 3 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 cli/src/main/java/com/devonfw/tools/ide/tool/mvn/Mvn4UrlUpdater.java diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/eclipse/EclipseUrlUpdater.java b/cli/src/main/java/com/devonfw/tools/ide/tool/eclipse/EclipseUrlUpdater.java index 63552aacb..f53b6175a 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/tool/eclipse/EclipseUrlUpdater.java +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/eclipse/EclipseUrlUpdater.java @@ -86,7 +86,7 @@ protected Pattern getVersionPattern() { @Override protected String mapVersion(String version) { - // TODO remove this hack and get versiosn from reliable API + // TODO remove this hack and get versions from reliable API return super.mapVersion(version.replace(" ", "-")); } diff --git a/cli/src/main/java/com/devonfw/tools/ide/tool/mvn/Mvn4UrlUpdater.java b/cli/src/main/java/com/devonfw/tools/ide/tool/mvn/Mvn4UrlUpdater.java new file mode 100644 index 000000000..08b5be4f6 --- /dev/null +++ b/cli/src/main/java/com/devonfw/tools/ide/tool/mvn/Mvn4UrlUpdater.java @@ -0,0 +1,42 @@ +package com.devonfw.tools.ide.tool.mvn; + +import java.util.regex.Pattern; + +import com.devonfw.tools.ide.url.model.folder.UrlVersion; +import com.devonfw.tools.ide.url.updater.WebsiteUrlUpdater; + +/** + * {@link WebsiteUrlUpdater} for mvn (maven) versions 4.x. + */ +public class Mvn4UrlUpdater extends WebsiteUrlUpdater { + @Override + protected String getTool() { + + return "mvn"; + } + + @Override + protected void addVersion(UrlVersion urlVersion) { + + doAddVersion(urlVersion, + "https://archive.apache.org/dist/maven/maven-4/${version}/binaries/apache-maven-${version}-bin.tar.gz"); + } + + @Override + protected String mapVersion(String version) { + + return version; + } + + @Override + protected String getVersionUrl() { + + return "https://archive.apache.org/dist/maven/maven-4/"; + } + + @Override + protected Pattern getVersionPattern() { + + return Pattern.compile("(\\d\\.\\d\\.\\d-[a-z]*?-\\d{1,2})"); + } +} diff --git a/cli/src/main/java/com/devonfw/tools/ide/url/updater/UpdateManager.java b/cli/src/main/java/com/devonfw/tools/ide/url/updater/UpdateManager.java index 14642205b..2dc8fb1c4 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/url/updater/UpdateManager.java +++ b/cli/src/main/java/com/devonfw/tools/ide/url/updater/UpdateManager.java @@ -31,6 +31,7 @@ import com.devonfw.tools.ide.tool.kotlinc.KotlincNativeUrlUpdater; import com.devonfw.tools.ide.tool.kotlinc.KotlincUrlUpdater; import com.devonfw.tools.ide.tool.lazydocker.LazyDockerUrlUpdater; +import com.devonfw.tools.ide.tool.mvn.Mvn4UrlUpdater; import com.devonfw.tools.ide.tool.mvn.MvnUrlUpdater; import com.devonfw.tools.ide.tool.node.NodeUrlUpdater; import com.devonfw.tools.ide.tool.npm.NpmUrlUpdater; @@ -57,11 +58,12 @@ public class UpdateManager extends AbstractProcessorWithTimeout { private final UrlRepository urlRepository; private final List updaters = Arrays.asList(new AndroidStudioUrlUpdater(), new AwsUrlUpdater(), - new AzureUrlUpdater(), new CobigenUrlUpdater(), new DockerDesktopUrlUpdater() , new DotNetUrlUpdater(), new EclipseCppUrlUpdater(), - new EclipseJavaUrlUpdater(), new GCloudUrlUpdater(), new GcViewerUrlUpdater(), new GhUrlUpdater(), - new GraalVmCommunityUpdater(), new GraalVmOracleUrlUpdater(), new GradleUrlUpdater(), new HelmUrlUpdater(), new IntellijUrlUpdater(), - new JavaUrlUpdater(), new JenkinsUrlUpdater(), new JmcUrlUpdater(), new KotlincUrlUpdater(), new KotlincNativeUrlUpdater(), - new LazyDockerUrlUpdater(), new MvnUrlUpdater(), new NodeUrlUpdater(), new NpmUrlUpdater(), new OcUrlUpdater(), + new AzureUrlUpdater(), new CobigenUrlUpdater(), new DockerDesktopUrlUpdater(), new DotNetUrlUpdater(), + new EclipseCppUrlUpdater(), new EclipseJavaUrlUpdater(), new GCloudUrlUpdater(), new GcViewerUrlUpdater(), + new GhUrlUpdater(), new GraalVmCommunityUpdater(), new GraalVmOracleUrlUpdater(), new GradleUrlUpdater(), + new HelmUrlUpdater(), new IntellijUrlUpdater(), new JavaUrlUpdater(), new JenkinsUrlUpdater(), + new JmcUrlUpdater(), new KotlincUrlUpdater(), new KotlincNativeUrlUpdater(), new LazyDockerUrlUpdater(), + new MvnUrlUpdater(), new Mvn4UrlUpdater(), new NodeUrlUpdater(), new NpmUrlUpdater(), new OcUrlUpdater(), new PipUrlUpdater(), new PythonUrlUpdater(), new QuarkusUrlUpdater(), new DockerRancherDesktopUrlUpdater(), new SonarUrlUpdater(), new TerraformUrlUpdater(), new TomcatUrlUpdater(), new VsCodeUrlUpdater());