Skip to content

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

@eed3si9n

Description

@eed3si9n

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions