diff --git a/integrationTests/gradle-java-toolchain/README.md b/integrationTests/gradle-java-toolchain/README.md index daabc03e..07c3a4a5 100644 --- a/integrationTests/gradle-java-toolchain/README.md +++ b/integrationTests/gradle-java-toolchain/README.md @@ -1,26 +1,30 @@ -# spring-boot-simple +# gradle-java-toolchain -Spring-boot webapp with gretty. +Simple gretty servlet application powered by gradle java toolchain. ## How to run ```bash -cd examples/spring-boot-simple +cd integrationTests/gradle-java-toolchain gradle appRun ``` + ## How to test ```bash -cd examples/spring-boot-simple -gradle integrationTest +cd integrationTests/gradle-java-toolchain +gradle integrationTest -PgeckoDriverPlatform=linux64 -PtoolchainJavaVersion=21 +``` +or +```bash +./docker_gradlew.sh --java 21 --java 11 --gradle 7 --working-dir integrationTests/gradle-java-toolchain -PtoolchainJavaVersion=21 -Pspock_version=2.3-groovy-3.0 -PgebVersion=5.1 integrationTest ``` - ## How to build a product ```bash -cd examples/spring-boot-simple +cd integrationTests/gradle-java-toolchain gradle buildProduct ``` diff --git a/integrationTests/gradle-java-toolchain/build.gradle b/integrationTests/gradle-java-toolchain/build.gradle index 798b623d..644c17f6 100644 --- a/integrationTests/gradle-java-toolchain/build.gradle +++ b/integrationTests/gradle-java-toolchain/build.gradle @@ -17,8 +17,14 @@ defineAsJavaToolchainAwareIntegrationTest() defineIntegrationTest() testAll.dependsOn defineIntegrationTestAllContainers(['jetty8', 'jetty9', 'jetty10', 'tomcat85', 'tomcat9']) -tasks.withType(Test).configureEach { - if(project.findProperty('toolchainJavaVersion')) { - systemProperty 'toolchainJavaVersion', project.findProperty('toolchainJavaVersion') +//typical toolchain DSL +java { + toolchain { + languageVersion = JavaLanguageVersion.of("${project.javaVersion.majorVersion}") } -} \ No newline at end of file +} + +//toolchain aware integration test +tasks.withType(Test).configureEach { + systemProperty 'toolchainJavaVersion', "${project.javaVersion.majorVersion}" +} diff --git a/integrationTests/gradle-java-toolchain/src/integrationTest/groovy/org/akhikhl/examples/gretty/gradle/toolchain/PageSpec.groovy b/integrationTests/gradle-java-toolchain/src/integrationTest/groovy/org/akhikhl/examples/gretty/gradle/toolchain/PageSpec.groovy index 20e4f43e..5861cc0a 100644 --- a/integrationTests/gradle-java-toolchain/src/integrationTest/groovy/org/akhikhl/examples/gretty/gradle/toolchain/PageSpec.groovy +++ b/integrationTests/gradle-java-toolchain/src/integrationTest/groovy/org/akhikhl/examples/gretty/gradle/toolchain/PageSpec.groovy @@ -17,7 +17,7 @@ class PageSpec extends GebReportingSpec { void setupSpec() { baseURI = System.getProperty('gretty.baseURI') - toolchainJavaVersion = System.getProperty('toolchainJavaVersion') ?: System.getProperty('java.vm.version') + toolchainJavaVersion = Objects.requireNonNull(System.getProperty('toolchainJavaVersion')) } def 'should get expected static page'() {