13 , mvnFetchExtraArgs ? { }
14 , mvnDepsParameters ? ""
15 , manualMvnArtifacts ? [ ]
16 , manualMvnSources ? [ ]
21 # originally extracted from dbeaver
22 # created to allow using maven packages in the same style as rust
25 fetchedMavenDeps = stdenv.mkDerivation ({
26 name = "${pname}-${version}-maven-deps";
27 inherit src sourceRoot patches;
35 '' + lib.optionalString buildOffline ''
36 mvn de.qaware.maven:go-offline-maven-plugin:1.2.8:resolve-dependencies -Dmaven.repo.local=$out/.m2 ${mvnDepsParameters}
38 for artifactId in ${builtins.toString manualMvnArtifacts}
40 echo "downloading manual $artifactId"
41 mvn dependency:get -Dartifact="$artifactId" -Dmaven.repo.local=$out/.m2
44 for artifactId in ${builtins.toString manualMvnSources}
46 group=$(echo $artifactId | cut -d':' -f1)
47 artifact=$(echo $artifactId | cut -d':' -f2)
48 echo "downloading manual sources $artifactId"
49 mvn dependency:sources -DincludeGroupIds="$group" -DincludeArtifactIds="$artifact" -Dmaven.repo.local=$out/.m2
51 '' + lib.optionalString (!buildOffline) ''
52 mvn package -Dmaven.repo.local=$out/.m2 ${mvnParameters}
57 # keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside
61 find $out -type f \( \
62 -name \*.lastUpdated \
63 -o -name resolver-status.properties \
64 -o -name _remote.repositories \) \
72 outputHashAlgo = if mvnHash != "" then null else "sha256";
73 outputHashMode = "recursive";
75 } // mvnFetchExtraArgs);
77 stdenv.mkDerivation (builtins.removeAttrs args [ "mvnFetchExtraArgs" ] // {
78 inherit fetchedMavenDeps;
80 nativeBuildInputs = args.nativeBuildInputs or [ ] ++ [
87 mvnDeps=$(cp -dpR ${fetchedMavenDeps}/.m2 ./ && chmod +w -R .m2 && pwd)
88 mvn package -o -nsu "-Dmaven.repo.local=$mvnDeps/.m2" ${mvnParameters}
93 meta = args.meta or { } // {
94 platforms = args.meta.platforms or maven.meta.platforms;