Search code examples
scalasbt-buildinfo

sbt-buildinfo plugin: How can I add the java version in effect at compile time to the generated BuildInfo.scala?


The build info plugin is working fine for me, but I am wondering if I could add to the generated BuildInfo.scala source file the version of the JDK with which it was generated.


Solution

  • The following should do

    buildInfoKeys += BuildInfoKey.action("javaVersion")(sys.props("java.version"))
    

    The four properties you might want to capture are "java.vm.name", "java.vm.version", "java.version", "java.runtime.version".