depot/third_party/nixpkgs/pkgs/development/java-modules/m2install.nix
Default email aa526eb20f Project import generated by Copybara.
GitOrigin-RevId: fcd48a5a0693f016a5c370460d0c2a8243b882dc
2022-03-10 11:12:11 -08:00

21 lines
534 B
Nix

{ stdenv, fetchurl }:
{ version, artifactId, groupId, sha512, type ? "jar", suffix ? "" }:
let
m2Path = "${builtins.replaceStrings ["."] ["/"] groupId}/${artifactId}/${version}";
m2File = "${artifactId}-${version}${suffix}.${type}";
src = fetchurl {
inherit sha512;
url = "mirror://maven/${m2Path}/${m2File}";
};
in stdenv.mkDerivation {
inherit version m2Path m2File src;
pname = artifactId;
dontUnpack = true;
installPhase = ''
mkdir -p $out/m2/$m2Path
cp $src $out/m2/$m2Path/$m2File
'';
}