mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-23 21:33:49 +00:00
buildMavenPackage: refactor to run test in drv only
Uses the dependency:go-offline goal in the fixed output derivation to download all dependencies. As a result, the derivation can be built and tested offline in the main derivation. The advantage of this approach is that you don't need to redownload all dependencies if there are test failures.
This commit is contained in:
parent
295a5e1e2b
commit
9a7693b704
@ -10,6 +10,8 @@
|
||||
, version
|
||||
, mvnHash ? ""
|
||||
, mvnFetchExtraArgs ? { }
|
||||
, mvnDepsParameters ? ""
|
||||
, manualMvnArtifactIds ? [ ]
|
||||
, mvnParameters ? ""
|
||||
, ...
|
||||
} @args:
|
||||
@ -29,7 +31,13 @@ let
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
mvn package -Dmaven.repo.local=$out/.m2 ${mvnParameters}
|
||||
mvn dependency:go-offline -Dmaven.repo.local=$out/.m2 ${mvnDepsParameters}
|
||||
|
||||
for artifactId in ${builtins.toString manualMvnArtifactIds}
|
||||
do
|
||||
echo "downloading manual $artifactId"
|
||||
mvn dependency:get -Dartifact="$artifactId" -Dmaven.repo.local=$out/.m2
|
||||
done
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
@ -65,7 +73,7 @@ stdenv.mkDerivation (builtins.removeAttrs args [ "mvnFetchExtraArgs" ] // {
|
||||
runHook preBuild
|
||||
|
||||
mvnDeps=$(cp -dpR ${fetchedMavenDeps}/.m2 ./ && chmod +w -R .m2 && pwd)
|
||||
mvn package --offline "-Dmaven.repo.local=$mvnDeps/.m2" ${mvnParameters}
|
||||
mvn package -o -nsu "-Dmaven.repo.local=$mvnDeps/.m2" ${mvnParameters}
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
Loading…
Reference in New Issue
Block a user