gretty-gradle-plugin / gretty

Advanced gradle plugin for running web-apps on jetty and tomcat.
MIT License
129 stars 36 forks source link

Make Gretty aware of Gradle Java Toolchain (v4.x) #308

Closed mr-serjey closed 4 months ago

mr-serjey commented 5 months ago

Gretty plugin run containers as a separate java process using the same java that is used by Gradle.

However since Gradle introduced Toolchains for JVM projects, the expectation is that Gretty plugin will also respect the java toolchain DSL and run containers using the specified JDK instead of one that used by Gradle.

Currently if java toolchain DSL is declared in a project, the classes compiled by the JDK specified there (e.g. v21), at the same time Gretty plugin uses Gradle JDK (e.g. v11), as result the container fails to start since JVM v11 can't load classes of java v21.

This PR purposes changes into Gretty plugin to respect java toolchain DSL:

With the following DSL the project going to use java 21 both to compile classes and to run them in container using Gretty plugin:

build.gradle
java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(21)
    }
}

Related issue: #261

Complementary changed of tests:

NOTE: This PR is a forward-port of v3.x PR https://github.com/gretty-gradle-plugin/gretty/pull/306

mr-serjey commented 5 months ago

Hi @boris-petrov and @f4lco, please share your plans regarding this PR, are there any timeline for review, merge, release?

boris-petrov commented 4 months ago

@mr-serjey sorry, I'll merge and release next week.

boris-petrov commented 4 months ago

@mr-serjey thanks again for that! I'll release it the end of this week or beginning of next.

boris-petrov commented 4 months ago

Released! Thanks @mr-serjey!