paketo-buildpacks / libjvm

A library and helper applications that form the basis for building the different Paketo-style JVM-providing buildpacks
Apache License 2.0
18 stars 19 forks source link

Support JRE Skipped in Build Plan #378

Closed AidanDelaney closed 2 weeks ago

AidanDelaney commented 3 months ago

Allow specifying a build plan that allows using a JDK as a JRE.

{
  "name": "jdk",
  "metadata": {
    "version": 11,
    "jre-skipped": true
  }
}

Describe the Enhancement

There are two existing situations where a JDK is used as a launch time JRE. These are where a JRE is not available as a dependency and where BP_JRE_TYPE=jdk. Neither of these approaches read the JRE type from the build plan. Therefore, a buildpack cannot programmatically request that a JDK is used instead of a JRE.

Possible Solution

libjvm uses a jreSkipped boolean to allow using a JDK as a JRE. An approach would be to expose jre-skipped: true in the build plan metadata.

Motivation

There are situations where a JDK is needed at runtime. I need to write a buildpack that detects project settings in a slightly strange way (for reasons...). The buildpack requires a jdk implementation (eg: paketo-buildpacks/adoptium or paketo-buildpacks/bellsoft-liberica) and needs to require the jdk at runtime.

AidanDelaney commented 2 weeks ago

Not a great idea.