summaryrefslogtreecommitdiffstats
path: root/pkgs/development/java-modules/build-maven-package.nix
diff options
context:
space:
mode:
authorTim Steinbach <tim@nequissimus.com>2016-11-15 14:18:19 -0500
committerTim Steinbach <tim@nequissimus.com>2016-11-15 14:18:19 -0500
commit63a46e0914fb1eb40c1903998faf10ffe3383cc5 (patch)
tree430daa662fa30d3d90648d160df7f9d5a8abcc77 /pkgs/development/java-modules/build-maven-package.nix
parent0e10bfa24646637e7054eb8235b260e02c6953a0 (diff)
Complete hello world with test
Diffstat (limited to 'pkgs/development/java-modules/build-maven-package.nix')
-rw-r--r--pkgs/development/java-modules/build-maven-package.nix14
1 files changed, 8 insertions, 6 deletions
diff --git a/pkgs/development/java-modules/build-maven-package.nix b/pkgs/development/java-modules/build-maven-package.nix
index 10dabadb50c8..d83b43ffd75a 100644
--- a/pkgs/development/java-modules/build-maven-package.nix
+++ b/pkgs/development/java-modules/build-maven-package.nix
@@ -1,5 +1,5 @@
{ stdenv, maven, pkgs }:
-{ mavenDeps, src, name, meta, m2Path, skipTests ? true, ... }:
+{ mavenDeps, src, name, meta, m2Path, skipTests ? true, quiet ? true, ... }:
with builtins;
with stdenv.lib;
@@ -13,8 +13,8 @@ in stdenv.mkDerivation rec {
propagatedBuildInput = [ maven ] ++ flatDeps;
- find = ''find ${foldl' (x: y: x + " " + y) "" (map (x: x + "/m2/") flatDeps)} -type d -printf '%P\n' | xargs -I {} mkdir -p $out/m2/{}'';
- copy = ''cp -rs ${foldl' (x: y: x + " " + y) "" (map (x: x + "/m2/*") flatDeps)} $out/m2'';
+ find = ''find ${foldl' (x: y: x + " " + y) "" (map (x: x + "/m2") flatDeps)} -type d -printf '%P\n' | xargs -I {} mkdir -p $out/m2/{}'';
+ copy = ''cp -rsfu ${foldl' (x: y: x + " " + y) "" (map (x: x + "/m2/*") flatDeps)} $out/m2'';
phases = [ "unpackPhase" "buildPhase" ];
@@ -23,10 +23,12 @@ in stdenv.mkDerivation rec {
mkdir -p $out/m2/${m2Path}
${optionalString (length flatDeps > 0) find}
${optionalString (length flatDeps > 0) copy}
+ if [ -f $out/m2/settings.xml ]; then rm $out/m2/settings.xml; fi
echo "<settings><mirrors>\
- <mirror><id>tmpm2</id><url>file://$out/m2</url><mirrorOf>*</mirrorOf></mirror></mirrors>\
- <localRepository>$out/m2</localRepository></settings>" >> $out/m2/settings.xml
- ${maven}/bin/mvn clean package -Dmaven.test.skip=${if skipTests then "true" else "false"} -Danimal.sniffer.skip=true -gs $out/m2/settings.xml
+ <mirror><id>tmpm2</id><url>file://$out/m2</url><mirrorOf>*</mirrorOf></mirror></mirrors>\
+ <localRepository>$out/m2/</localRepository></settings>" >> $out/m2/settings.xml
+ ${maven}/bin/mvn ${optionalString (quiet) "-q"} clean package -Dmaven.test.skip=${if skipTests then "true" else "false"} -Danimal.sniffer.skip=true -gs $out/m2/settings.xml
+ cp ./target/*.jar $out/m2/${m2Path}
cp -v ./target/*.jar $out/target/
'';
}