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

Set JAVA_HOME and JDK_HOME as defaults, not overrides #185

Closed
fg-j opened this issue Jul 6, 2022 · 4 comments
Closed

Set JAVA_HOME and JDK_HOME as defaults, not overrides #185

fg-j opened this issue Jul 6, 2022 · 4 comments
Labels
type:question A user question

Comments

@fg-j
Copy link

fg-j commented Jul 6, 2022

In Paketo RFC 0019, the project set the norm that

If a user provides a language ecosystem environment variable at build time and the buildpack typically sets an opinionated build time value, the user's value should override or have precedence over the buildpack-set value.

"Language ecosystem environment variables" are those that are respected by language ecosystem tooling, like the Java toolchain. JAVA_HOME and JDK_HOME are two of these sort of variables.

Currently, libjvm sets these environment variables using the OVERRIDE option.

I propose that these environment variables should be set with the DEFAULT option instead, to bring libjvm in alignment with the RFC. This should not change buildpack behaviour in the happy-path case. But it will allow advanced users to override the buildpack's default JAVA_HOME and JDK_HOME values at build- or launch-time

@loewenstein
Copy link

@dmikusa What about this? If you agree that libjvm should follow the spec here, we can have a look and provide a PR.

@dmikusa
Copy link
Contributor

dmikusa commented Oct 9, 2022

This came up previously and I don't think we should follow the spec for these particular variables. My opinion is that a user should not set these values ever, the buildpack should always set them so I think OVERRIDE is appropriate.

If there is a legitimate use case for setting them, I'd be OK with making the change. I just can't think of a reason. The buildpack is the only thing that will know where the JVM is installed, so it should be setting these. Even in the case where the JVM is installed as part of the stack, or by a buildpack extension, I think that the buildpack should run, pull out the location of the JVM, and set these env variables. Presently, you can't set env variables if you only publish a stack so the buildpack would still be required to get the env variables set in a consistent way.

@loewenstein
Copy link

Hi @dmikusa,
I tend to agree, just had a run over open issues to figure out if we could help.

Best
Jan

@dmikusa dmikusa added the type:question A user question label Oct 10, 2022
@dmikusa
Copy link
Contributor

dmikusa commented Oct 10, 2022

OK. I'm going to mark this as won't fix for now.

If someone comes up with a legitimate reason that requires JAVA_HOME and/or JDK_HOME to be set as DEFAULT by the buildpack please raise it here and we can reconsider this change.

@dmikusa dmikusa closed this as completed Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question A user question
Projects
None yet
Development

No branches or pull requests

3 participants