Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maven seems to fork with the jre instead of the jdk #21275

Closed
FaustXVI opened this issue Dec 18, 2016 · 4 comments
Closed

Maven seems to fork with the jre instead of the jdk #21275

FaustXVI opened this issue Dec 18, 2016 · 4 comments

Comments

@FaustXVI
Copy link
Contributor

FaustXVI commented Dec 18, 2016

Issue description

Nixos' maven seems to fork with the jre instead of the jdk. This results in not having jdk tools available in test code.

Steps to reproduce

clone this repo https://github.com/FaustXVI/nixos-maven-break
run mvn test

Workaround

Use maven forkcount to 0.
Or explicitly set the right jvm on the command line with mvn -Djvm=$(which java) verify

Technical details

  • System: NixOS: 16.09.1272.81428dd
  • Nix version: nix-env (Nix) 1.11.4
  • Nixpkgs version: "16.09.1272.81428dd"
@tazjin
Copy link
Member

tazjin commented Jan 9, 2018

It's very unclear where this actually comes from to me, been trying to debug it after we ran into it.

The launch scripts generated by the derivation for Maven explicitly set the JAVA_HOME environment variable to the JDK, so that - on my machine for example - it ends up like this:

/n/s/p/bin $ pwd
/nix/store/psd9lhhz259fmzssxxm33b3hzmscd8b3-apache-maven-3.5.0/bin
/n/s/p/bin $ cat mvn
#! /nix/store/hqi64wjn83nw4mnf9a5z9r4vmpl72j3r-bash-4.4-p12/bin/bash -e
export JAVA_HOME="/nix/store/hh30vm83ffsvhk14r09np6cngg4s8vgz-openjdk-8u152b16"
exec "/nix/store/psd9lhhz259fmzssxxm33b3hzmscd8b3-apache-maven-3.5.0/maven/bin/mvn"  "${extraFlagsArray[@]}" "$@"

But asking Maven for information about how it's configured suddenly shows that it's pointing at the JRE:

/n/s/p/bin $ ./mvn -version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T21:39:06+02:00)
Maven home: /nix/store/psd9lhhz259fmzssxxm33b3hzmscd8b3-apache-maven-3.5.0/maven
Java version: 1.8.0_152, vendor: Oracle Corporation
Java home: /nix/store/hh30vm83ffsvhk14r09np6cngg4s8vgz-openjdk-8u152b16/lib/openjdk/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version:

I haven't been able to figure out what makes it append the lib/openjdk/jre yet.

@janchochol
Copy link

Hi, there I faced same issue.
I looks, like it properly works with JDK 11.
Only difference is slight change in directory structure for JDK 8 and JDK 11:

$ find /nix/store/gzixa5nj9bgz3sn2sj9qg53hm27wi0ka-openjdk-11.0.3-ga/ -name tzdb.dat
/nix/store/gzixa5nj9bgz3sn2sj9qg53hm27wi0ka-openjdk-11.0.3-ga/lib/openjdk/lib/tzdb.dat
$ find /nix/store/mv2pihf17dq4inv2s7ndqj5jc0q0m83j-openjdk-8u212-ga/ -name tzdb.dat
/nix/store/mv2pihf17dq4inv2s7ndqj5jc0q0m83j-openjdk-8u212-ga/lib/openjdk/jre/lib/tzdb.dat

When I tries in my project:

mvn -Djava.home=/nix/store/mv2pihf17dq4inv2s7ndqj5jc0q0m83j-openjdk-8u212-ga test

It complained:

Exception in thread "main" java.lang.Error: java.io.FileNotFoundException: /nix/store/mv2pihf17dq4inv2s7ndqj5jc0q0m83j-openjdk-8u212-ga/lib/tzdb.dat (No such file or directory)

So I think, that Maven wrongly guesses java.home due to fact, that some files were under jre subdirectory.

Nevertheless is seems working under JDK 11.

@surajbarkale
Copy link
Contributor

This should be fixed by #80728

@timokau
Copy link
Member

timokau commented Feb 27, 2020

I'll assume this is fixed. If it isn't, please let me know and I'll re-open.

@timokau timokau closed this as completed Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants