Skip to content

Document setting buildpack Java version from compiler plugin version #21796

Closed
@scottfrederick

Description

@scottfrederick

The Maven spring-boot:build-image goal and Gradle bootBuildImage task attempt to detect the target Java version for the build and set an environment variable on the CNB builder to instruct buildpacks to install the same Java version. This should be documented in the build plugin documentation.

The Maven plugin first looks for configuration of the maven-compiler-plugin with a target version:

<plugins>
    <plugin>    
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
            <target>1.8</target>
        </configuration>
    </plugin>
</plugins>

If that is not found, it looks for a compiler target property:

<properties>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

The Gradle plugin uses a Gradle API, which exposes the value of the targetCompatibility property of the Java plugin.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions