maven: use headless jdk to avoid GUI dependencies

This fixes build with environment.noXlibs enabled.
This commit is contained in:
Sandro Jäckel 2024-07-12 16:19:03 +02:00
parent a674dd9f11
commit ea0bc32245
No known key found for this signature in database
GPG Key ID: 3AF5A43A3EECC2E5
2 changed files with 6 additions and 4 deletions

View File

@ -87,6 +87,8 @@ stdenv.mkDerivation (builtins.removeAttrs args [ "mvnFetchExtraArgs" ] // {
maven
];
JAVA_HOME = mvnJdk;
buildPhase = ''
runHook preBuild

View File

@ -2,7 +2,7 @@
lib,
callPackage,
fetchurl,
jdk,
jdk_headless,
makeWrapper,
stdenvNoCC,
}:
@ -27,9 +27,9 @@ stdenvNoCC.mkDerivation (finalAttrs: {
cp -r apache-maven-${finalAttrs.version}/* $out/maven
makeWrapper $out/maven/bin/mvn $out/bin/mvn \
--set-default JAVA_HOME "${jdk}"
--set-default JAVA_HOME "${jdk_headless}"
makeWrapper $out/maven/bin/mvnDebug $out/bin/mvnDebug \
--set-default JAVA_HOME "${jdk}"
--set-default JAVA_HOME "${jdk_headless}"
runHook postInstall
'';
@ -55,6 +55,6 @@ stdenvNoCC.mkDerivation (finalAttrs: {
license = lib.licenses.asl20;
mainProgram = "mvn";
maintainers = with lib.maintainers; [ ];
inherit (jdk.meta) platforms;
inherit (jdk_headless.meta) platforms;
};
})