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

sbt's "openjdk" dependency pulls in JDK 13 #50649

Closed
3 of 4 tasks
eed3si9n opened this issue Feb 24, 2020 · 1 comment
Closed
3 of 4 tasks

sbt's "openjdk" dependency pulls in JDK 13 #50649

eed3si9n opened this issue Feb 24, 2020 · 1 comment

Comments

@eed3si9n
Copy link
Contributor

eed3si9n commented Feb 24, 2020

Ref b812e59#diff-bdf3fc0debecefebed7b56c142626381R11

  • ran brew update and can still reproduce the problem?

  • ran brew doctor, fixed all issues and can still reproduce the problem?

  • ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?
    https://gist.github.com/16a70480726f125b3f962d52838e97bf

  • if brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?

What you were trying to do (and why)

Install sbt and use my existing Java installation.

What happened (include command output)

sbt is running with JDK 13.0.2.

Command output
$ sbt 'eval sys.props("java.version")'
[warn] No sbt.version set in project/build.properties, base directory: /private/tmp/foo
[info] Loading settings for project global-plugins from idea.sbt,vimquit.sbt,plugins.sbt,pgp.sbt ...
[info] Loading global plugins from /Users/eed3si9n/.sbt/1.0/plugins
[info] Set current project to foo (in build file:/private/tmp/foo/)
[info] ans: String = 13.0.2

The reason this is problematic for sbt is because it is a build tool, used to to build libraries and applications on JVM. Changing the JVM version suddenly is a breaking change itself, but the even bigger issue is that the JVM version has a transitive property ("contagious"). Once a library is published with JDK 13, then the consumer has to use JDK 13 too.

For tooling and library authors, this usually means sticking to the lowest stable JDK version. Even for application authors, upgrading from one JDK version to another is a decision we don't make lightly. Certainly not by brew upgrade accidents.

What you expected to happen

Use the JDK that's installed in the environment.

Step-by-step reproduction instructions (by running brew install commands)

# comment out sdkman or jenv in dotfiles

brew install sbt
java -version
sbt 'eval sys.props("java.version")'

notes

#50536

@SMillerDev
Copy link
Member

Homebrew will use brewed dependencies where possible. The fact that other Java versions were previously possible was an unfortunate side-effect of java not being built from source as a formula. The current situation is the intended usage within Homebrew. If people want to use a different dependency the best course of action is to maintain it in a tap, which is very easy to do: https://docs.brew.sh/How-to-Create-and-Maintain-a-Tap.

Just a couple of points to highlight:

  • The openjdk installed as a dependency is not symlinked anywhere and will be used only if JAVA_HOME is not set

  • If you'd like to use another Java installation feel free to set JAVA_HOME to any Java you want

  • Using some random/installed by default Java is not reliable for software shipping.

@Homebrew Homebrew deleted a comment from kshakir Mar 18, 2020
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Mar 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants