paketo-buildpacks/samples

maven sample is broken due to wrong Java version 11 instead of 17

Closed this issue · 1 comments

The maven sample can currently not be built out of the box with buildpacks. The reason is that spring-boot was bumped to version 3 which requires Java 17, but the default for cnb is Java 11.

Expected Behavior

It works when following the instructions.

Current Behavior

[builder]       [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project demo: Fatal error compiling: error: invalid target release: 17 -> [Help 1]

Possible Solution

There are multiple ways to fix this. Some very easy and some very convenient for the user.

  1. Instruct the user to set $BP_JVM_VERSION=17
  2. Add a project.toml that makes sure that $BP_JVM_VERSION is set accordingly
  3. Bump the default Java version like proposed in this rfc
  4. Allow the buildpacks to request specific java versions like proposed in this rfc
    a. maven buildpack could then evaluate a <java.version>17</java.version> in the pom.xml
    b. spring-boot could detect the usage of spring boot 3

Steps to Reproduce

instructions.

Motivations

No real world impact impact, but it would be nice that the first contact points with buildpacks are at smooth as possible.

I would have preferred solution 4 to solve this, because this would have needed no user input and also work with future java versions. But the rfc and the pull requests (libjvm#246 and maven#217) didn't find much interest :(

So I will open a pull request with solution 2 since the --builder is missing anyway in the instruction imho.