diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-06-22 15:01:47 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2021-06-22 16:57:59 +0000 |
commit | 633cab0ecb07627706c6b523e219490f019eaab5 (patch) | |
tree | 4fb472bdfe2723037dad53dc1b8a87c939015f5e /nixpkgs/doc/languages-frameworks/maven.section.md | |
parent | ffb691c199e7e0cbc4e45e5310779c9e3f7c2a73 (diff) | |
parent | 432fc2d9a67f92e05438dff5fdc2b39d33f77997 (diff) | |
download | nixlib-633cab0ecb07627706c6b523e219490f019eaab5.tar nixlib-633cab0ecb07627706c6b523e219490f019eaab5.tar.gz nixlib-633cab0ecb07627706c6b523e219490f019eaab5.tar.bz2 nixlib-633cab0ecb07627706c6b523e219490f019eaab5.tar.lz nixlib-633cab0ecb07627706c6b523e219490f019eaab5.tar.xz nixlib-633cab0ecb07627706c6b523e219490f019eaab5.tar.zst nixlib-633cab0ecb07627706c6b523e219490f019eaab5.zip |
Merge commit '432fc2d9a67f92e05438dff5fdc2b39d33f77997'
# Conflicts: # nixpkgs/pkgs/applications/editors/emacs/elisp-packages/elpa-generated.nix # nixpkgs/pkgs/applications/networking/mailreaders/thunderbird/default.nix # nixpkgs/pkgs/applications/window-managers/sway/default.nix # nixpkgs/pkgs/build-support/rust/default.nix # nixpkgs/pkgs/development/go-modules/generic/default.nix
Diffstat (limited to 'nixpkgs/doc/languages-frameworks/maven.section.md')
-rw-r--r-- | nixpkgs/doc/languages-frameworks/maven.section.md | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/nixpkgs/doc/languages-frameworks/maven.section.md b/nixpkgs/doc/languages-frameworks/maven.section.md index d66931e808d7..f53a6fa8ac22 100644 --- a/nixpkgs/doc/languages-frameworks/maven.section.md +++ b/nixpkgs/doc/languages-frameworks/maven.section.md @@ -43,9 +43,9 @@ public class Main { You find this demo project at https://github.com/fzakaria/nixos-maven-example -## Solving for dependencies +## Solving for dependencies {#solving-for-dependencies} -### buildMaven with NixOS/mvn2nix-maven-plugin +### buildMaven with NixOS/mvn2nix-maven-plugin {#buildmaven-with-nixosmvn2nix-maven-plugin} > ⚠️ Although `buildMaven` is the "blessed" way within nixpkgs, as of 2020, it hasn't seen much activity in quite a while. @@ -82,6 +82,7 @@ This file is then given to the `buildMaven` function, and it returns 2 attribute A simple derivation that runs through `mvn compile` & `mvn package` to build the JAR. You may use this as inspiration for more complicated derivations. Here is an [example](https://github.com/fzakaria/nixos-maven-example/blob/main/build-maven-repository.nix) of building the Maven repository + ```nix { pkgs ? import <nixpkgs> { } }: with pkgs; @@ -103,7 +104,8 @@ The benefit over the _double invocation_ as we will see below, is that the _/nix │ └── 4.1.3 │ ├── avalon-framework-4.1.3.jar -> /nix/store/iv5fp3955w3nq28ff9xfz86wvxbiw6n9-avalon-framework-4.1.3.jar ``` -### Double Invocation + +### Double Invocation {#double-invocation} > ⚠️ This pattern is the simplest but may cause unnecessary rebuilds due to the output hash changing. @@ -163,7 +165,7 @@ The build will fail, and tell you the expected `outputHash` to place. When you'v If your package uses _SNAPSHOT_ dependencies or _version ranges_; there is a strong likelihood that over-time your output hash will change since the resolved dependencies may change. Hence this method is less recommended then using `buildMaven`. -## Building a JAR +## Building a JAR {#building-a-jar} Regardless of which strategy is chosen above, the step to build the derivation is the same. @@ -201,7 +203,7 @@ in stdenv.mkDerivation rec { 2 directories, 1 file ``` -## Runnable JAR +## Runnable JAR {#runnable-jar} The previous example builds a `jar` file but that's not a file one can run. @@ -213,7 +215,7 @@ We will use the same repository we built above (either _double invocation_ or _b The following two methods are more suited to Nix then building an [UberJar](https://imagej.net/Uber-JAR) which may be the more traditional approach. -### CLASSPATH +### CLASSPATH {#classpath} > This is ideal if you are providing a derivation for _nixpkgs_ and don't want to patch the project's `pom.xml`. @@ -252,11 +254,12 @@ in stdenv.mkDerivation rec { } ``` -### MANIFEST file via Maven Plugin +### MANIFEST file via Maven Plugin {#manifest-file-via-maven-plugin} > This is ideal if you are the project owner and want to change your `pom.xml` to set the CLASSPATH within it. Augment the `pom.xml` to create a JAR with the following manifest: + ```xml <build> <plugins> |