depot/third_party/nixpkgs/pkgs/development/tools/build-managers/apache-maven/default.nix
Default email 5e9e1146e1 Project import generated by Copybara.
GitOrigin-RevId: 18036c0be90f4e308ae3ebcab0e14aae0336fe42
2023-08-05 00:07:22 +02:00

50 lines
1.2 KiB
Nix

{ lib
, stdenvNoCC
, fetchurl
, jdk
, makeWrapper
, callPackage
}:
assert jdk != null;
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "apache-maven";
version = "3.9.3";
src = fetchurl {
url = "mirror://apache/maven/maven-3/${finalAttrs.version}/binaries/${finalAttrs.pname}-${finalAttrs.version}-bin.tar.gz";
hash = "sha256-4eE6wMQvO2TZAMV//GUuzvaCuCVdfTVO+7tPYlGdpPE=";
};
sourceRoot = ".";
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
mkdir -p $out/maven
cp -r ${finalAttrs.pname}-${finalAttrs.version}/* $out/maven
makeWrapper $out/maven/bin/mvn $out/bin/mvn \
--set-default JAVA_HOME "${jdk}"
makeWrapper $out/maven/bin/mvnDebug $out/bin/mvnDebug \
--set-default JAVA_HOME "${jdk}"
runHook postInstall
'';
passthru.buildMavenPackage = callPackage ./build-package.nix {
maven = finalAttrs.finalPackage;
};
meta = with lib; {
mainProgram = "mvn";
description = "Build automation tool (used primarily for Java projects)";
homepage = "https://maven.apache.org/";
license = licenses.asl20;
platforms = platforms.unix;
maintainers = with maintainers; [ cko ];
};
})