cloudfoundry-incubator / cflocal

Stage and launch CF apps, push and pull droplets, and connect to real CF services -- in Docker
Apache License 2.0
178 stars 27 forks source link

java_buildpack configuration for JRE version ignored #42

Open gmuth opened 4 years ago

gmuth commented 4 years ago

local.yml:

applications:
  - name: myjavaapp
    buildpacks:
      - java_buildpack
    env:
      JBP_CONFIG_OPEN_JDK_JRE: "{ jre: { version: 11.+ }}"

stage java 11 application:

cf local stage myjavaapp -p target/myjavaapp.jar

Buildpack: will detect                                                         
-----> Java Buildpack v4.27 | https://github.com/cloudfoundry/java-buildpack.git#e06e00b
-----> Downloading Jvmkill Agent 1.16.0_RELEASE from https://java-buildpack.cloudfoundry.org/jvmkill/bionic/x86_64/jvmkill-1.16.0-RELEASE.so (found in cache)
-----> Downloading Open Jdk JRE 1.8.0_265 from https://java-buildpack.cloudfoundry.org/openjdk/bionic/x86_64/bellsoft-jre8u265%2B1-linux-amd64.tar.gz (found in cache)
       Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.0s)

The default JRE 1.8.x is used, not JRE 11.+ as requested. Consequently starting fails:

Running myjavaapp on port 55683...                                                  
JVM Memory Configuration: -Xmx424887K -Xss1M -XX:ReservedCodeCacheSize=240M -XX:MaxDirectMemorySize=10M -XX:MaxMetaspaceSize=111688K
Exception in thread "main" java.lang.UnsupportedClassVersionError: mypackage/MyJavaApplication has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0