From 0bc28dafcdc025e1ee5f6d6550789c34217e863c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Thu, 2 Feb 2023 19:17:10 -0800 Subject: [PATCH] fetchMavenArtifact: add classifier to filename --- pkgs/build-support/fetchmavenartifact/default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/fetchmavenartifact/default.nix b/pkgs/build-support/fetchmavenartifact/default.nix index efdbd0decf95..b1d8593e72d4 100644 --- a/pkgs/build-support/fetchmavenartifact/default.nix +++ b/pkgs/build-support/fetchmavenartifact/default.nix @@ -43,13 +43,15 @@ let (lib.replaceStrings ["."] ["_"] artifactId) "-" version ]; + suffix = if isNull classifier then "" else "-${classifier}"; + filename = "${artifactId}-${version}${suffix}.jar"; mkJarUrl = repoUrl: lib.concatStringsSep "/" [ (lib.removeSuffix "/" repoUrl) (lib.replaceStrings ["."] ["/"] groupId) artifactId version - "${artifactId}-${version}${lib.optionalString (!isNull classifier) "-${classifier}"}.jar" + filename ]; urls_ = if url != "" then [url] @@ -68,7 +70,7 @@ in # packages packages that mention this derivation in their buildInputs. installPhase = '' mkdir -p $out/share/java - ln -s ${jar} $out/share/java/${artifactId}-${version}.jar + ln -s ${jar} $out/share/java/${filename} ''; # We also add a `jar` attribute that can be used to easily obtain the path # to the downloaded jar file.