mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-11 15:15:36 +00:00
5d6259a973
All JARs in $pkg/share/java (for each $pkg in the build inputs) are added to $CLASSPATH. Thus, you can say buildInputs = [ setJavaClassPath someJavaDependency ]; and the JARs in someJavaDependency will be found automatically by tools like javac or ant. Note that the manual used to say that JARs should be installed in lib/java; this is now share/java, following the Debian policy: http://www.debian.org/doc/packaging-manuals/java-policy/x110.html The directory share/java makes more sense because JARs are architecture-independent. (Also, a quick grep shows that we were not exactly consistent about this in Nixpkgs.)
14 lines
321 B
Bash
14 lines
321 B
Bash
# This setup hook adds every JAR in the share/java subdirectories of
|
|
# the build inputs to $CLASSPATH.
|
|
|
|
export CLASSPATH
|
|
|
|
addPkgToClassPath () {
|
|
local jar
|
|
for jar in $1/share/java/*.jar; do
|
|
export CLASSPATH=''${CLASSPATH}''${CLASSPATH:+:}''${jar}
|
|
done
|
|
}
|
|
|
|
envHooks=(''${envHooks[@]} addPkgToClassPath)
|