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

Always add java bin directory to PATH in jenv-exec #190

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bhavanki
Copy link

@bhavanki bhavanki commented Mar 5, 2018

The jenv exec command should prepend the path to the selected Java
version's bin directory to the PATH for the command being executed. The
command to be executed, however, is not necessarily a Java interpreter -
for example, the Maven plugin passes in /usr/local/bin/mvn. Therefore
the selected Java version's bin directory should not be determined from
the command, but from JAVA_HOME.

The jenv exec command should prepend the path to the selected Java
version's bin directory to the PATH for the command being executed. The
command to be executed, however, is not necessarily a Java interpreter -
for example, the Maven plugin passes in /usr/local/bin/mvn. Therefore
the selected Java version's bin directory should not be determined from
the command, but from JAVA_HOME.
@bhavanki
Copy link
Author

Just popping in almost a year and a half later to mention that I ran into this problem myself again, having forgotten that I'd filed this PR. :)

The specific problem I experienced was that I was running a Maven build that executed a Python script. I was running the build in a virtualenv, and so I expect that the interpreter in the virtualenv should be used. However, because /usr/local/bin was at the front of the path, Maven executed the system Python, which didn't work. So, there's a concrete example of how the current jenv behavior can be undesirable.

Thanks!

@wimsymons
Copy link

wimsymons commented Nov 27, 2019

I had the same issue with calling npm/node from a Maven build. The jenv maven plugin puts /usr/local/bin in front of the path, so it executed the system default nodejs and not the one I selected with nvm.

Disabling the maven plugin did the trick for me.

@ewilkins-csi
Copy link

I just opened issue #419 so I could push up a PR exactly like this. It might be worth updating jenv-info as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants